summaryrefslogtreecommitdiffstats
path: root/libbacktrace/UnwindMap.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2015-02-06 13:22:01 -0800
committerChristopher Ferris <cferris@google.com>2015-02-06 15:00:09 -0800
commit12385e3ad085aa1ac06c26529b32b688503a9fcf (patch)
treec73a344e4e481a95eae2e9a9fb2216ec09cf64a3 /libbacktrace/UnwindMap.cpp
parent6289412222bfe26ebeef2ea9c422e828c11ffc30 (diff)
downloadsystem_core-12385e3ad085aa1ac06c26529b32b688503a9fcf.tar.gz
system_core-12385e3ad085aa1ac06c26529b32b688503a9fcf.tar.bz2
system_core-12385e3ad085aa1ac06c26529b32b688503a9fcf.zip
Move map data into backtrace data proper.
The backtrace structure used to include a pointer to a backtrace_map_t that represented the map data for a particular pc. This introduced a race condition where the pointer could be discarded, but the backtrace structure still contained a pointer to garbage memory. Now all of the map information is right in the structure. Bug: 19028453 Change-Id: If7088a73f3c6bf1f3bc8cdd2bb4b62e7cab831c0
Diffstat (limited to 'libbacktrace/UnwindMap.cpp')
-rw-r--r--libbacktrace/UnwindMap.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/libbacktrace/UnwindMap.cpp b/libbacktrace/UnwindMap.cpp
index 387d768aa..284a5615b 100644
--- a/libbacktrace/UnwindMap.cpp
+++ b/libbacktrace/UnwindMap.cpp
@@ -113,18 +113,17 @@ bool UnwindMapLocal::Build() {
return (map_created_ = (unw_map_local_create() == 0)) && GenerateMap();;
}
-const backtrace_map_t* UnwindMapLocal::Find(uintptr_t addr) {
- const backtrace_map_t* map = BacktraceMap::Find(addr);
- if (!map) {
+void UnwindMapLocal::FillIn(uintptr_t addr, backtrace_map_t* map) {
+ BacktraceMap::FillIn(addr, map);
+ if (!IsValid(*map)) {
// Check to see if the underlying map changed and regenerate the map
// if it did.
if (unw_map_local_cursor_valid(&map_cursor_) < 0) {
if (GenerateMap()) {
- map = BacktraceMap::Find(addr);
+ BacktraceMap::FillIn(addr, map);
}
}
}
- return map;
}
//-------------------------------------------------------------------------