| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
|
|
| #ifndef ABSL_DEBUGGING_INTERNAL_SYMBOLIZE_H_ |
| #define ABSL_DEBUGGING_INTERNAL_SYMBOLIZE_H_ |
|
|
| #ifdef __cplusplus |
|
|
| #include <cstddef> |
| #include <cstdint> |
|
|
| #include "absl/base/config.h" |
| #include "absl/strings/string_view.h" |
|
|
| #ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE |
| #error ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE cannot be directly set |
| #elif defined(__ELF__) && defined(__GLIBC__) && !defined(__native_client__) \ |
| && !defined(__asmjs__) && !defined(__wasm__) |
| #define ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE 1 |
|
|
| #include <elf.h> |
| #include <link.h> |
| #include <functional> |
| #include <string> |
|
|
| namespace absl { |
| ABSL_NAMESPACE_BEGIN |
| namespace debugging_internal { |
|
|
| |
| |
| |
| |
| |
| |
| bool ForEachSection(int fd, |
| const std::function<bool(absl::string_view name, |
| const ElfW(Shdr) &)>& callback); |
|
|
| |
| |
| bool GetSectionHeaderByName(int fd, const char *name, size_t name_len, |
| ElfW(Shdr) *out); |
|
|
| } |
| ABSL_NAMESPACE_END |
| } |
|
|
| #endif |
|
|
| #ifdef ABSL_INTERNAL_HAVE_DARWIN_SYMBOLIZE |
| #error ABSL_INTERNAL_HAVE_DARWIN_SYMBOLIZE cannot be directly set |
| #elif defined(__APPLE__) |
| #define ABSL_INTERNAL_HAVE_DARWIN_SYMBOLIZE 1 |
| #endif |
|
|
| #ifdef ABSL_INTERNAL_HAVE_EMSCRIPTEN_SYMBOLIZE |
| #error ABSL_INTERNAL_HAVE_EMSCRIPTEN_SYMBOLIZE cannot be directly set |
| #elif defined(__EMSCRIPTEN__) |
| #define ABSL_INTERNAL_HAVE_EMSCRIPTEN_SYMBOLIZE 1 |
| #endif |
|
|
| namespace absl { |
| ABSL_NAMESPACE_BEGIN |
| namespace debugging_internal { |
|
|
| struct SymbolDecoratorArgs { |
| |
| const void *pc; |
| |
| ptrdiff_t relocation; |
| |
| |
| int fd; |
| |
| |
| |
| |
| |
| char *const symbol_buf; |
| size_t symbol_buf_size; |
| |
| |
| |
| char *const tmp_buf; |
| size_t tmp_buf_size; |
| |
| void* arg; |
| }; |
| using SymbolDecorator = void (*)(const SymbolDecoratorArgs *); |
|
|
| |
| |
| |
| |
| int InstallSymbolDecorator(SymbolDecorator decorator, void* arg); |
|
|
| |
| |
| bool RemoveSymbolDecorator(int ticket); |
|
|
| |
| |
| bool RemoveAllSymbolDecorators(); |
|
|
| |
| |
| |
| |
| |
| |
| |
| bool RegisterFileMappingHint(const void* start, const void* end, |
| uint64_t offset, const char* filename); |
|
|
| |
| |
| |
| |
| bool GetFileMappingHint(const void** start, const void** end, uint64_t* offset, |
| const char** filename); |
|
|
| } |
| ABSL_NAMESPACE_END |
| } |
|
|
| #endif |
|
|
| #include <stdbool.h> |
|
|
| #ifdef __cplusplus |
| extern "C" |
| #endif |
|
|
| bool |
| AbslInternalGetFileMappingHint(const void** start, const void** end, |
| uint64_t* offset, const char** filename); |
|
|
| #endif |
|
|