Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy C file to get struct debug information to go with non-debug builds? #78

Open
zZeck opened this issue Jun 8, 2024 · 0 comments
Open

Comments

@zZeck
Copy link

zZeck commented Jun 8, 2024

I patched GDB to fix its mdebug loading problems. Works well with Ares gdb stub. This then lead me to want to use mdebug symbols from IDO compiled things. But of course, you get minimal symbols for code built in non debug mode. Don't even get the typdefs.
To work around this, I made a small .c file that just imports the header files from ultralib, and builds that single file with -g, (and -woff 625 to disable Empty declaration warnings). I can load that .o into GDB and then easily interpret memory as various structs when debugging non-debug build libultra code.

I don't know if it would be in scope for this project to do this, and optionally output one "debug helper" .o file people can load into GDB with just debugging information like that, but I just thought I would ask. It seemed like it may be useful, and I don't know if this solution will occur to everyone. It was at least a bit unintuitive/unnatural to me. Maybe it's too obscure to bother with.

Just handy to be able to debug/explore and build scripts.

file /home/zeck/newtetrisdecomp/build/thenewtetris.elf
add-symbol-file /home/zeck/newtetrisdecomp/src/ultralib/debughack.o

(gdb) p *(OSIoMesg*)$a0
$3 = {hdr = {type = 11, pri = 0 '\000', status = 0 '\000', retQueue = 0x8012ca48 <_binary_assets___osActiveQueue_bin_end+14036>}, 
  dramAddr = 0x80107508 <_binary_assets_A15F0_bin_start+180632>, devAddr = 711032, size = 16, piHandle = 0x0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant