summaryrefslogtreecommitdiff
path: root/libbacktrace/UnwindStackMap.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-11-27 14:50:38 -0800
committerChristopher Ferris <cferris@google.com>2017-11-28 15:20:38 -0800
commitbe788d891da26943b1ad6abe0f07a8745fa676d5 (patch)
tree859d524e7673f9e700d5c5f9a102e485fd8c8602 /libbacktrace/UnwindStackMap.cpp
parentf03f2a5cd7a7ad7a2cfa3c2ae5f512c0ddbeeb80 (diff)
Allow multiple threads sharing a map to unwind.
Add a mutex in MapInfo, and a mutex in Elf. Lock the creation of an Elf file using the MapInfo mutex, and lock when calling Step, GetFunctionName, or GetSoname since they can modify information in the object. It might be beneficial to use a fine grained lock in the future. Change the Maps object to contain a vector of MapInfo pointers rather than the total objects. This avoids copying this data around. Add a test to libbacktrace to verify that sharing a map while doing unwinds in different threads works. Add concurrency tests in libunwindstack to verify the locking works. Add always inline to the RegsGetLocal arm and aarch64 functions. I had a case where clang did not inline the code, so make sure this is specified. Bug: 68813077 Test: New unit tests to cover the case. Passes all unit tests. Test: Ran a monkey test while dumping bugreports and verified that Test: no crashes in libunwind. Test: Remove the locking and verified that all of the concurrenty tests fail. Change-Id: I769e728c676f6bdae9e64ce4cdc03b6749beae03
Diffstat (limited to 'libbacktrace/UnwindStackMap.cpp')
-rw-r--r--libbacktrace/UnwindStackMap.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbacktrace/UnwindStackMap.cpp b/libbacktrace/UnwindStackMap.cpp
index 25e5002ba..9ac0a0b54 100644
--- a/libbacktrace/UnwindStackMap.cpp
+++ b/libbacktrace/UnwindStackMap.cpp
@@ -44,15 +44,15 @@ bool UnwindStackMap::Build() {
}
// Iterate through the maps and fill in the backtrace_map_t structure.
- for (auto& map_info : *stack_maps_) {
+ for (auto* map_info : *stack_maps_) {
backtrace_map_t map;
- map.start = map_info.start;
- map.end = map_info.end;
- map.offset = map_info.offset;
+ map.start = map_info->start;
+ map.end = map_info->end;
+ map.offset = map_info->offset;
// Set to -1 so that it is demand loaded.
map.load_bias = static_cast<uintptr_t>(-1);
- map.flags = map_info.flags;
- map.name = map_info.name;
+ map.flags = map_info->flags;
+ map.name = map_info->name;
maps_.push_back(map);
}