diff options
author | Christopher Ferris <cferris@google.com> | 2014-01-10 16:33:16 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2014-01-13 14:21:52 -0800 |
commit | 20303f856f1f1cdb5af58af0b116b8c598f0ea5c (patch) | |
tree | de0b205001d3afdf97bd54e4ee39a81750e9bf70 /include/backtrace | |
parent | e76343ef72458aff8fdc25c57f4e84407c05a2f2 (diff) | |
download | system_core-20303f856f1f1cdb5af58af0b116b8c598f0ea5c.zip system_core-20303f856f1f1cdb5af58af0b116b8c598f0ea5c.tar.gz system_core-20303f856f1f1cdb5af58af0b116b8c598f0ea5c.tar.bz2 |
Next phase of the move, reformat use C++ features.
Use the libbacktrace C++ interface instead of the C interface in debuggerd.
Reformat the debuggerd code to be closer to Google C++ style.
Fix all debuggerd casts to be C++ casts.
Add a frame number to the frame data structure for ease of formatting and
add another FormatFrameData function.
Change the format_test to use the new FormatFrameData function.
Modify all of the backtrace_test to use the C++ interface.
Change-Id: I10e1610861acf7f4a3ad53276b74971cfbfda464
Diffstat (limited to 'include/backtrace')
-rw-r--r-- | include/backtrace/Backtrace.h | 8 | ||||
-rw-r--r-- | include/backtrace/backtrace.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/backtrace/Backtrace.h b/include/backtrace/Backtrace.h index bf4efd3..df40b87 100644 --- a/include/backtrace/Backtrace.h +++ b/include/backtrace/Backtrace.h @@ -60,6 +60,7 @@ public: // Create a string representing the formatted line of backtrace information // for a single frame. virtual std::string FormatFrameData(size_t frame_num); + virtual std::string FormatFrameData(const backtrace_frame_data_t* frame); pid_t Pid() { return backtrace_.pid; } pid_t Tid() { return backtrace_.tid; } @@ -68,9 +69,16 @@ public: const backtrace_t* GetBacktrace() { return &backtrace_; } const backtrace_frame_data_t* GetFrame(size_t frame_num) { + if (frame_num > NumFrames()) { + return NULL; + } return &backtrace_.frames[frame_num]; } + const backtrace_map_info_t* GetMapList() { + return map_info_; + } + protected: Backtrace(BacktraceImpl* impl, pid_t pid, backtrace_map_info_t* map_info); diff --git a/include/backtrace/backtrace.h b/include/backtrace/backtrace.h index fa81f21..cfcbf0f 100644 --- a/include/backtrace/backtrace.h +++ b/include/backtrace/backtrace.h @@ -44,6 +44,7 @@ typedef struct backtrace_map_info { } backtrace_map_info_t; typedef struct { + size_t num; /* The current fame number. */ uintptr_t pc; /* The absolute pc. */ uintptr_t sp; /* The top of the stack. */ size_t stack_size; /* The size of the stack, zero indicate an unknown stack size. */ |