1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-21 23:27:39 +01:00

Enhance debug messages

This commit is contained in:
Théophile Bastian 2019-06-09 19:02:24 +02:00
parent 453253dd0e
commit f6cca76ee3
2 changed files with 20 additions and 5 deletions

View file

@ -97,6 +97,12 @@ int set_dwarf_loc_ifdef(
int eh_elf_step_cursor(struct cursor *cursor) {
uintptr_t ip = cursor->dwarf.ip;
{
uintptr_t dbp;
dwarf_get(&cursor->dwarf, cursor->dwarf.loc[UNW_TDEP_BP], &dbp);
Debug (4, "AT ENTER bp=%016lx%s sp=%016lx ip=%016lx\n", dbp,
DWARF_IS_NULL_LOC(cursor->dwarf.loc[UNW_TDEP_BP])?" [NULL]":"",
cursor->dwarf.cfa, cursor->dwarf.ip);
}
// Retrieve memory map entry
@ -134,10 +140,12 @@ int eh_elf_step_cursor(struct cursor *cursor) {
_fetch_state.last_rc = 0;
_fetch_state.cur_rsp = cursor->dwarf.cfa;
Debug(4, "Unwinding in mmap entry %s at position 0x%lx (sp=%016lx)\n",
Debug(4, "Unwinding in mmap entry %s at position 0x%lx (sp=%016lx, bp=%016lx)\n",
mmap_entry->object_name,
ip - mmap_entry->offset,
eh_elf_context.rsp);
eh_elf_context.rsp,
eh_elf_context.rbp
);
eh_elf_context.flags = 0;
// Call fde_func

View file

@ -80,6 +80,13 @@ unw_step (unw_cursor_t *cursor)
_step_id_data.orig_cfa = c->dwarf.cfa;
UnwDebug(3, "unw_step called\n");
{
uintptr_t dbp;
dwarf_get(&c->dwarf, c->dwarf.loc[RBP], &dbp);
UnwDebug (4, "unw_step context: bp=%016lx%s sp=%016lx ip=%016lx\n", dbp,
DWARF_IS_NULL_LOC(c->dwarf.loc[RBP])? " [NULL]": "",
c->dwarf.cfa, c->dwarf.ip);
}
struct timespec _timer_start = chrono_start();
int ret, i;
@ -114,11 +121,10 @@ unw_step (unw_cursor_t *cursor)
if (ret < 0 && ret != -UNW_ENOINFO)
{
UnwDebug (3, "dwarf_step also failed?\n", ret);
UnwDebug (3, "dwarf_step also failed [%d]?\n", ret);
UnwDebug (2, "returning %d\n", ret);
return ret;
}
UnwDebug(4, "UNW_ENOINFO=%d\n", UNW_ENOINFO);
UnwDebug(3, "fallback continuing\n");
if (likely (ret >= 0))
@ -135,6 +141,7 @@ unw_step (unw_cursor_t *cursor)
uintptr_t dbp;
dwarf_get(&c->dwarf, c->dwarf.loc[RBP], &dbp);
UnwDebug (3, " DWARF: bp=%016lx sp=%016lx ip=%016lx\n", dbp, c->dwarf.cfa, c->dwarf.ip);
UnwDebug(3, "fallback with actual dwarf\n");
}
else
{
@ -157,7 +164,7 @@ unw_step (unw_cursor_t *cursor)
Validate all addresses before dereferencing. */
c->validate = 1;
UnwDebug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret);
UnwDebug (4, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret);
if (unw_is_signal_frame (cursor))
{