Skip to content

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

@zZeck

Description

@zZeck

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions