- 55
- Posts
- 15
- Years
- Seen Feb 1, 2023
I'm trying to debug an issue I'm facing, but it's extremely difficult just to tweak code and run/check the results. I know that pokeemerald supports console logging via the AGBPrintf function. In config.h there's the following message:
When I comment out that line (and build via make), however, the linker spits out a bunch of errors about things in optimized-out sections that are now being accessed:
(and a bunch more)
My question: how do I get AGBPrintf to compile into the ROM without getting the linker errors? Alternately, is there another way I can debug my features without AGBPrintf -- and how do I do it? I'm currently using VBA-M (v2.1.4) on Windows and building in WSL. I also have an old version of the pokeemerald repo, if that's relevant. Further, it seems like VBA supports connecting to a debugger, but idk how I'd even go about that; I've found the console window in the emulator, and have turned on AGBPrintf logging.
Note: I'm intentionally not describing the details of the specific problem I'm facing because they aren't actually relevant to debugging. If you need/want more details of the problem(s) I'm trying to solve, feel free to PM me directly.
Thanks in advance :)
Code:
#define NDEBUG
// To enable print debugging, comment out "#define NDEBUG". This allows
// the various AGBPrint functions to be used. (See include/gba/isagbprint.h).
// Some emulators support a debug console window: uncomment NoCashGBAPrint()
// and NoCashGBAPrintf() in libisagbprn.c to use no$gba's own proprietary
// printing system. Use NoCashGBAPrint() and NoCashGBAPrintf() like you
// would normally use AGBPrint() and AGBPrintf().
When I comment out that line (and build via make), however, the linker spits out a bunch of errors about things in optimized-out sections that are now being accessed:
Spoiler:
Code:
`.rodata' referenced in section `.text' of src/mevent_news.o: defined in discarded section `.rodata' of src/mevent_news.o
`.rodata' referenced in section `.text' of src/mevent_news.o: defined in discarded section `.rodata' of src/mevent_news.o
`_impure_ptr' referenced in section `.text' of ../../tools/agbcc/lib/libc.a(vsprintf.o): defined in discarded section `.data' of ../../tools/agbcc/lib/libc.a(impure.o)
`_impure_ptr' referenced in section `.text' of ../../tools/agbcc/lib/libc.a(vfprintf.o): defined in discarded section `.data' of ../../tools/agbcc/lib/libc.a(impure.o)
`_impure_ptr' referenced in section `.text' of ../../tools/agbcc/lib/libc.a(vfprintf.o): defined in discarded section `.data' of ../../tools/agbcc/lib/libc.a(impure.o)
`__mb_cur_max' referenced in section `.text' of ../../tools/agbcc/lib/libc.a(vfprintf.o): defined in discarded section `.data' of ../../tools/agbcc/lib/libc.a(locale.o)
`.rodata' referenced in section `.text' of ../../tools/agbcc/lib/libc.a(vfprintf.o): defined in discarded section `.rodata' of ../../tools/agbcc/lib/libc.a(vfprintf.o)
My question: how do I get AGBPrintf to compile into the ROM without getting the linker errors? Alternately, is there another way I can debug my features without AGBPrintf -- and how do I do it? I'm currently using VBA-M (v2.1.4) on Windows and building in WSL. I also have an old version of the pokeemerald repo, if that's relevant. Further, it seems like VBA supports connecting to a debugger, but idk how I'd even go about that; I've found the console window in the emulator, and have turned on AGBPrintf logging.
Note: I'm intentionally not describing the details of the specific problem I'm facing because they aren't actually relevant to debugging. If you need/want more details of the problem(s) I'm trying to solve, feel free to PM me directly.
Thanks in advance :)