Add ability to skip function name resolution.
Bug: 73558129
Test: New unit tests pass.
Change-Id: I3a6b17d2590aacb367ab3e3a51cc85be73ad64eb
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp
index 7e2e6d0..0e32e47 100644
--- a/libbacktrace/UnwindStack.cpp
+++ b/libbacktrace/UnwindStack.cpp
@@ -52,6 +52,7 @@
auto process_memory = stack_map->process_memory();
unwindstack::Unwinder unwinder(MAX_BACKTRACE_FRAMES + num_ignore_frames, stack_map->stack_maps(),
regs, stack_map->process_memory());
+ unwinder.SetResolveNames(stack_map->ResolveNames());
if (stack_map->GetJitDebug() != nullptr) {
unwinder.SetJitDebug(stack_map->GetJitDebug(), regs->Arch());
}
diff --git a/libbacktrace/include/backtrace/BacktraceMap.h b/libbacktrace/include/backtrace/BacktraceMap.h
index 7b26079..da54472 100644
--- a/libbacktrace/include/backtrace/BacktraceMap.h
+++ b/libbacktrace/include/backtrace/BacktraceMap.h
@@ -154,6 +154,13 @@
const std::vector<std::string>& GetSuffixesToIgnore() { return suffixes_to_ignore_; }
+ // Disabling the resolving of names results in the function name being
+ // set to an empty string and the function offset being set to zero
+ // in the frame data when unwinding.
+ void SetResolveNames(bool resolve) { resolve_names_ = resolve; }
+
+ bool ResolveNames() { return resolve_names_; }
+
protected:
BacktraceMap(pid_t pid);
@@ -164,6 +171,7 @@
pid_t pid_;
std::deque<backtrace_map_t> maps_;
std::vector<std::string> suffixes_to_ignore_;
+ bool resolve_names_ = true;
};
class ScopedBacktraceMapIteratorLock {