switchbrew / switch-examples

Switch examples for devkitA64 and libnx.
https://devkitpro.org/viewforum.php?f=42
559 stars 99 forks source link

How use addr2line with dump from exception-handler? #88

Closed rock88 closed 3 years ago

rock88 commented 3 years ago

Hi! I'm trying to understand how inspect crash logs, I installed exception-handler example, got dump, but what next? I read this article - https://switch.homebrew.guide/homebrew_dev/app_dev.html (PC and Backtrace section), but dump doesn't contain a Backtrace - Start Address (for subtract it from PC) and app just closed with error alert, without Atmosphère fatal error screen.

So can I find a valid PC address for addr2line? Or, maybe, you can suggest another solution for debugging (gdb will be nice xD, Twili not maintained, any chance with aarch64-none-elf-gdb?).

Thanks in advance!

yellows8 commented 3 years ago

You want crash_reports, not fatal_reports. {app_name} + {offset} from the report is what you'd use with addr2line (where you'd use {offset}).

FWIW exception-handler example is intended for when an app wants to handle exceptions themselves, not needed when you just want AMS crash_reports.

rock88 commented 3 years ago

Ohhhh, my mistake. I removed __libnx_exception_handler from exception-handler example, get PC address from AMS crash report and pass to addr2line - all fine, I see some like this:

0x000000000000020c: main at main.c:61

Many thanks!