• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Enabling AGBPrintf Debugging

  • 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:
    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:


    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 :)
     
    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:
    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:


    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 :)
    I encourage you to use mGBA as your GBA emulator instead of VBA-M. On mGBA, you can use its printf which there's a tutorial about in the Pokeemerald wiki.
    https://github.com/pret/pokeemerald/wiki/printf-in-mGBA

    Alternatively, try asking about AGBPrintf in Pret's Discord server.
     
    I encourage you to use mGBA as your GBA emulator instead of VBA-M. On mGBA, you can use its printf which there's a tutorial about in the Pokeemerald wiki.
    https://github.com/pret/pokeemerald/wiki/printf-in-mGBA

    Alternatively, try asking about AGBPrintf in Pret's Discord server.

    This was an excellent suggestion! Got logging up and working via the tutorial, and was able to fix a bunch of my issues based on the logs :D

    Thanks!!
     
    Back
    Top