Allow map name to be empty in DumpNativeStack.
For the gdb jit interface, functions in the stack trace will come from
maps that have no names. Print a special name for these maps and also do
not allow addr2line to run on these maps either.
Test: Build and ran a stack through that use the jit gdb interface.
Change-Id: I39d3f7e24a38df0a02214d1014a5d0b2e0174dd7
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index ec94552..fa46709 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -340,14 +340,22 @@
os << StringPrintf(Is64BitInstructionSet(kRuntimeISA) ? "%016" PRIxPTR " "
: "%08" PRIxPTR " ",
it->rel_pc);
- os << it->map.name;
+ if (it->map.name.empty()) {
+ os << StringPrintf("<anonymous:%" PRIxPTR ">", it->map.start);
+ } else {
+ os << it->map.name;
+ }
os << " (";
if (!it->func_name.empty()) {
os << it->func_name;
if (it->func_offset != 0) {
os << "+" << it->func_offset;
}
- try_addr2line = true;
+ // Functions found using the gdb jit interface will be in an empty
+ // map that cannot be found using addr2line.
+ if (!it->map.name.empty()) {
+ try_addr2line = true;
+ }
} else if (current_method != nullptr &&
Locks::mutator_lock_->IsSharedHeld(Thread::Current()) &&
PcIsWithinQuickCode(current_method, it->pc)) {