//===-- sanitizer_symbolizer_internal.h -------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Header for internal classes and functions to be used by implementations of // symbolizers. // //===----------------------------------------------------------------------===// #ifndef SANITIZER_SYMBOLIZER_INTERNAL_H #define SANITIZER_SYMBOLIZER_INTERNAL_H #include "sanitizer_file.h" #include "sanitizer_symbolizer.h" #include "sanitizer_vector.h" namespace __sanitizer { // Parsing helpers, 'str' is searched for delimiter(s) and a string or uptr // is extracted. When extracting a string, a newly allocated (using // InternalAlloc) and null-terminated buffer is returned. They return a pointer // to the next characted after the found delimiter. const char *ExtractToken(const char *str, const char *delims, char **result); const char *ExtractInt(const char *str, const char *delims, int *result); const char *ExtractUptr(const char *str, const char *delims, uptr *result); const char *ExtractTokenUpToDelimiter(const char *str, const char *delimiter, char **result); const char *DemangleSwiftAndCXX(const char *name); // SymbolizerTool is an interface that is implemented by individual "tools" // that can perform symbolication (external llvm-symbolizer, libbacktrace, // Windows DbgHelp symbolizer, etc.). class SymbolizerTool { … }; // SymbolizerProcess encapsulates communication between the tool and // external symbolizer program, running in a different subprocess. // SymbolizerProcess may not be used from two threads simultaneously. class SymbolizerProcess { … }; class LLVMSymbolizerProcess; // This tool invokes llvm-symbolizer in a subprocess. It should be as portable // as the llvm-symbolizer tool is. class LLVMSymbolizer final : public SymbolizerTool { … }; // Parses one or more two-line strings in the following format: // <function_name> // <file_name>:<line_number>[:<column_number>] // Used by LLVMSymbolizer, Addr2LinePool and InternalSymbolizer, since all of // them use the same output format. Returns true if any useful debug // information was found. void ParseSymbolizePCOutput(const char *str, SymbolizedStack *res); // Parses a two-line string in the following format: // <symbol_name> // <start_address> <size> // Used by LLVMSymbolizer and InternalSymbolizer. void ParseSymbolizeDataOutput(const char *str, DataInfo *info); // Parses repeated strings in the following format: // <function_name> // <var_name> // <file_name>:<line_number>[:<column_number>] // [<frame_offset>|??] [<size>|??] [<tag_offset>|??] // Used by LLVMSymbolizer and InternalSymbolizer. void ParseSymbolizeFrameOutput(const char *str, InternalMmapVector<LocalInfo> *locals); } // namespace __sanitizer #endif // SANITIZER_SYMBOLIZER_INTERNAL_H