feat update
Some checks failed
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Has been cancelled
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Has been cancelled
linux-arm-gcc / linux-gcc-armhf (push) Has been cancelled
linux-x64-gcc / linux-gcc (Debug) (push) Has been cancelled
linux-x64-gcc / linux-gcc (Release) (push) Has been cancelled
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Has been cancelled

This commit is contained in:
tqcq 2024-04-07 09:31:23 +00:00
parent 3f8f1fee36
commit e5a53a90a4

View File

@ -16,6 +16,7 @@ InitializeSymbolizer(const char *argv0)
if (g_elf) { return; } if (g_elf) { return; }
int self_fd = open(argv0, O_RDONLY); int self_fd = open(argv0, O_RDONLY);
if (self_fd < 0) { return; } if (self_fd < 0) { return; }
LOGW(kTag, "open self({}) fd: {}", argv0, self_fd);
g_elf = new elf::elf(elf::create_mmap_loader(self_fd)); g_elf = new elf::elf(elf::create_mmap_loader(self_fd));
g_dwarf = new dwarf::dwarf(dwarf::elf::create_loader(*g_elf)); g_dwarf = new dwarf::dwarf(dwarf::elf::create_loader(*g_elf));
} }
@ -34,8 +35,8 @@ Symbolize(const void *pc, char *out, int out_size)
out[0] = '\0'; out[0] = '\0';
union { union {
const void *void_pc;
dwarf::taddr pc_addr; dwarf::taddr pc_addr;
const void *void_pc;
} u; } u;
u.void_pc = pc; u.void_pc = pc;
@ -48,6 +49,8 @@ Symbolize(const void *pc, char *out, int out_size)
if (iter == lt.end()) { if (iter == lt.end()) {
return false; return false;
} else { } else {
snprintf(out, out_size, "%s", iter->get_description().c_str());
out[out_size - 1] = '\0';
LOGD("found line {}", iter->get_description()); LOGD("found line {}", iter->get_description());
} }
found = true; found = true;