diff options
author | Yabin Cui | 2015-08-13 21:49:12 -0500 |
---|---|---|
committer | Yabin Cui | 2015-09-16 19:38:23 -0500 |
commit | c9c6b6ee7735f014771d81615c0278b53d14f61c (patch) | |
tree | 0c76a529e0593f4278e38eafc9a8cc72cb6d8db4 /include/backtrace | |
parent | c372a778626dffdf6d1be5f98eafa966a95be082 (diff) | |
download | platform-system-core-c9c6b6ee7735f014771d81615c0278b53d14f61c.tar.gz platform-system-core-c9c6b6ee7735f014771d81615c0278b53d14f61c.tar.xz platform-system-core-c9c6b6ee7735f014771d81615c0278b53d14f61c.zip |
Add BacktraceOffline for offline backtracing.
It is used by simpeleprf for stack unwinding.
Bug: 22229391
Change-Id: I26d698610ccdc9545da837bc5a8a9ec787f27a6b
Diffstat (limited to 'include/backtrace')
-rw-r--r-- | include/backtrace/Backtrace.h | 14 | ||||
-rw-r--r-- | include/backtrace/BacktraceMap.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/backtrace/Backtrace.h b/include/backtrace/Backtrace.h index 290682a74..f440bd283 100644 --- a/include/backtrace/Backtrace.h +++ b/include/backtrace/Backtrace.h | |||
@@ -52,6 +52,12 @@ struct ucontext; | |||
52 | typedef ucontext ucontext_t; | 52 | typedef ucontext ucontext_t; |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | struct backtrace_stackinfo_t { | ||
56 | uint64_t start; | ||
57 | uint64_t end; | ||
58 | const uint8_t* data; | ||
59 | }; | ||
60 | |||
55 | class Backtrace { | 61 | class Backtrace { |
56 | public: | 62 | public: |
57 | // Create the correct Backtrace object based on what is to be unwound. | 63 | // Create the correct Backtrace object based on what is to be unwound. |
@@ -66,6 +72,14 @@ public: | |||
66 | // If map is not NULL, the map is still owned by the caller. | 72 | // If map is not NULL, the map is still owned by the caller. |
67 | static Backtrace* Create(pid_t pid, pid_t tid, BacktraceMap* map = NULL); | 73 | static Backtrace* Create(pid_t pid, pid_t tid, BacktraceMap* map = NULL); |
68 | 74 | ||
75 | // Create an offline Backtrace object that can be used to do an unwind without a process | ||
76 | // that is still running. If cache_file is set to true, then elf information will be cached | ||
77 | // for this call. The cached information survives until the calling process ends. This means | ||
78 | // that subsequent calls to create offline Backtrace objects will continue to use the same | ||
79 | // cache. It also assumes that the elf files used for each offline unwind are the same. | ||
80 | static Backtrace* CreateOffline(pid_t pid, pid_t tid, BacktraceMap* map, | ||
81 | const backtrace_stackinfo_t& stack, bool cache_file = false); | ||
82 | |||
69 | virtual ~Backtrace(); | 83 | virtual ~Backtrace(); |
70 | 84 | ||
71 | // Get the current stack trace and store in the backtrace_ structure. | 85 | // Get the current stack trace and store in the backtrace_ structure. |
diff --git a/include/backtrace/BacktraceMap.h b/include/backtrace/BacktraceMap.h index bb18aa2e2..2373c45e8 100644 --- a/include/backtrace/BacktraceMap.h +++ b/include/backtrace/BacktraceMap.h | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <deque> | 32 | #include <deque> |
33 | #include <string> | 33 | #include <string> |
34 | #include <vector> | ||
34 | 35 | ||
35 | struct backtrace_map_t { | 36 | struct backtrace_map_t { |
36 | uintptr_t start = 0; | 37 | uintptr_t start = 0; |
@@ -48,6 +49,8 @@ public: | |||
48 | // is unsupported. | 49 | // is unsupported. |
49 | static BacktraceMap* Create(pid_t pid, bool uncached = false); | 50 | static BacktraceMap* Create(pid_t pid, bool uncached = false); |
50 | 51 | ||
52 | static BacktraceMap* Create(pid_t pid, const std::vector<backtrace_map_t>& maps); | ||
53 | |||
51 | virtual ~BacktraceMap(); | 54 | virtual ~BacktraceMap(); |
52 | 55 | ||
53 | // Fill in the map data structure for the given address. | 56 | // Fill in the map data structure for the given address. |