diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-11-22 12:57:15 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-22 12:57:15 -0800 |
commit | b75a9a833bca5aea836a021b3db4d70ef5d475d9 (patch) | |
tree | e152f29436ac3ce6cad3cfe7a4e7f226030c1d80 /include | |
parent | 3544e33247fb66de561f8007f553f99c6e087f54 (diff) | |
parent | 19b39f371be5250e7b9e88016be1e5e665367b3f (diff) | |
download | core-b75a9a833bca5aea836a021b3db4d70ef5d475d9.tar.gz core-b75a9a833bca5aea836a021b3db4d70ef5d475d9.tar.bz2 core-b75a9a833bca5aea836a021b3db4d70ef5d475d9.zip |
Merge "Improve backtrace formatting."
Diffstat (limited to 'include')
-rw-r--r-- | include/corkscrew/backtrace.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/corkscrew/backtrace.h b/include/corkscrew/backtrace.h index 157d02934..556ad04c0 100644 --- a/include/corkscrew/backtrace.h +++ b/include/corkscrew/backtrace.h @@ -41,10 +41,12 @@ typedef struct { * Describes the symbols associated with a backtrace frame. */ typedef struct { - uintptr_t relative_pc; /* relative PC offset from the start of the library, + uintptr_t relative_pc; /* relative frame PC offset from the start of the library, or the absolute PC if the library is unknown */ + uintptr_t relative_symbol_addr; /* relative offset of the symbol from the start of the + library or 0 if the library is unknown */ char* map_name; /* executable or library name, or NULL if unknown */ - char* name; /* symbol name, or NULL if unknown */ + char* symbol_name; /* symbol name, or NULL if unknown */ char* demangled_name; /* demangled symbol name, or NULL if unknown */ } backtrace_symbol_t; @@ -95,6 +97,17 @@ void get_backtrace_symbols_ptrace(const ptrace_context_t* context, */ void free_backtrace_symbols(backtrace_symbol_t* backtrace_symbols, size_t frames); +enum { + // A hint for how big to make the line buffer for format_backtrace_line + MAX_BACKTRACE_LINE_LENGTH = 800, +}; + +/** + * Formats a line from a backtrace as a zero-terminated string into the specified buffer. + */ +void format_backtrace_line(unsigned frameNumber, const backtrace_frame_t* frame, + const backtrace_symbol_t* symbol, char* buffer, size_t bufferSize); + #ifdef __cplusplus } #endif |