libbacktrace: remove exit time destructors.
If libbacktrace is statically linked into a library that interposes libc, exit-time destructors can lead to a segfault upon exit if static variables are used after their destruction. Remove the one use of a static variable (with inconsequential performance impact of less than 1us per backtrace), and enable -Wexit-time-destructors to ensure this stays fixed in the future. Test: mma Change-Id: Icdaf1cf1c1f166cf501d9ecd1983c44e4305f7e9
This commit is contained in:
parent
b9670bb437
commit
e22701ee8a
|
@ -73,6 +73,10 @@ cc_library {
|
|||
defaults: ["libbacktrace_common"],
|
||||
host_supported: true,
|
||||
|
||||
cflags: [
|
||||
"-Wexit-time-destructors",
|
||||
],
|
||||
|
||||
srcs: [
|
||||
"BacktraceMap.cpp",
|
||||
],
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
bool Backtrace::Unwind(unwindstack::Regs* regs, BacktraceMap* back_map,
|
||||
std::vector<backtrace_frame_data_t>* frames, size_t num_ignore_frames) {
|
||||
static std::vector<std::string> skip_names{"libunwindstack.so", "libbacktrace.so"};
|
||||
std::vector<std::string> skip_names{"libunwindstack.so", "libbacktrace.so"};
|
||||
UnwindStackMap* stack_map = reinterpret_cast<UnwindStackMap*>(back_map);
|
||||
auto process_memory = stack_map->process_memory();
|
||||
unwindstack::Unwinder unwinder(MAX_BACKTRACE_FRAMES + num_ignore_frames, stack_map->stack_maps(),
|
||||
|
|
|
@ -65,6 +65,10 @@ cc_library {
|
|||
"Symbols.cpp",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-Wexit-time-destructors",
|
||||
],
|
||||
|
||||
target: {
|
||||
// Always disable optimizations for host to make it easier to debug.
|
||||
host: {
|
||||
|
|
Loading…
Reference in New Issue