WerWolv / nx-ovlloader

Host process for loading Switch overlay OVLs (NROs)
ISC License
497 stars 27 forks source link

How to debug loaded ovls with atmosphere gdbstub? #29

Open Vyacguru opened 10 months ago

Vyacguru commented 10 months ago

Hello, I'm trying write new overlay with teslalib, but it crashes, and I don't know why. How I can use atmosphere gdbstub implementation for debug my overlay?

masagrator commented 10 months ago

You are attaching to ovloader process and when overlay will crash, gdbstub will stop process, then you send command "monitor get mappings" and search for first "AliasCode" address - this is your overlay start address.

Or monitor get mappings and provide address of instruction where it stopped at the end, f. e. monitor get mappings 0x7100567890, it should provide also the start address of overlay.

If you ask for stuff like how to use IDA/Ghidra to load debug ELF or how to interpret this issue, then well - this is a very broad topic not for discussion here. I have answered that only because ovloader doesn't register properly new overlays as modules, so it's not possible to retrieve base address of overlay with monitor get info except for first time loaded tesla menu.

Vyacguru commented 10 months ago

You are attaching to ovloader process and when overlay will crash, gdbstub will stop process, then you send command "monitor get mappings" and search for first "AliasCode" address - this is your overlay start address.

Or monitor get mappings and provide address of instruction where it stopped at the end, f. e. monitor get mappings 0x7100567890, it should provide also the start address of overlay.

If you ask for stuff like how to use IDA/Ghidra to load debug ELF or how to interpret this issue, then well - this is a very broad topic not for discussion here. I have answered that only because ovloader doesn't register properly new overlays as modules, so it's not possible to retrieve base address of overlay with monitor get info except for first time loaded tesla menu.

Thanks you for answer One more question, where I can get info about how to load debug elf to use it in IDE integrated debugger? I want to check my code line by line