* commit '54c7ef7fbd1f79ae490eb737f558fccf3c1dbd55': Fix bionic's built-in stack trace dumping for LP64.
This commit is contained in:
commit
8cc98f0b1e
@ -29,6 +29,7 @@
|
|||||||
#include "debug_stacktrace.h"
|
#include "debug_stacktrace.h"
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <unwind.h>
|
#include <unwind.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -142,12 +143,12 @@ __LIBC_HIDDEN__ void log_backtrace(uintptr_t* frames, size_t frame_count) {
|
|||||||
"*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
|
"*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
|
||||||
|
|
||||||
for (size_t i = 0 ; i < frame_count; ++i) {
|
for (size_t i = 0 ; i < frame_count; ++i) {
|
||||||
void* offset = 0;
|
uintptr_t offset = 0;
|
||||||
const char* symbol = NULL;
|
const char* symbol = NULL;
|
||||||
|
|
||||||
Dl_info info;
|
Dl_info info;
|
||||||
if (dladdr((void*) frames[i], &info) != 0) {
|
if (dladdr((void*) frames[i], &info) != 0) {
|
||||||
offset = info.dli_saddr;
|
offset = reinterpret_cast<uintptr_t>(info.dli_saddr);
|
||||||
symbol = info.dli_sname;
|
symbol = info.dli_sname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,13 +163,20 @@ __LIBC_HIDDEN__ void log_backtrace(uintptr_t* frames, size_t frame_count) {
|
|||||||
char* demangled_symbol = demangle(symbol);
|
char* demangled_symbol = demangle(symbol);
|
||||||
const char* best_name = (demangled_symbol != NULL) ? demangled_symbol : symbol;
|
const char* best_name = (demangled_symbol != NULL) ? demangled_symbol : symbol;
|
||||||
|
|
||||||
__libc_format_log(ANDROID_LOG_ERROR, "libc", " #%02d pc %08x %s (%s+0x%x)",
|
__libc_format_log(ANDROID_LOG_ERROR, "libc",
|
||||||
i, rel_pc, soname, best_name, frames[i] - (uintptr_t) offset);
|
" #%02zd pc %0*" PRIxPTR " %s (%s+%" PRIuPTR ")",
|
||||||
|
i,
|
||||||
|
static_cast<int>(2 * sizeof(void*)), rel_pc,
|
||||||
|
soname,
|
||||||
|
best_name, frames[i] - offset);
|
||||||
|
|
||||||
free(demangled_symbol);
|
free(demangled_symbol);
|
||||||
} else {
|
} else {
|
||||||
__libc_format_log(ANDROID_LOG_ERROR, "libc", " #%02d pc %08x %s",
|
__libc_format_log(ANDROID_LOG_ERROR, "libc",
|
||||||
i, rel_pc, soname);
|
" #%02zd pc %0*" PRIxPTR " %s",
|
||||||
|
i,
|
||||||
|
static_cast<int>(2 * sizeof(void*)), rel_pc,
|
||||||
|
soname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user