Debugging

Discussion in 'NDS - Emulation and Homebrew' started by gudenaurock, Jan 16, 2012.

Jan 16, 2012

Debugging by gudenaurock at 1:57 AM (1,451 Views / 0 Likes) 11 replies

  1. gudenaurock
    OP

    Member gudenaurock Never a unique idea

    Joined:
    Jul 7, 2010
    Messages:
    2,955
    Location:
    /dev/random
    Country:
    United States
    How may I do this on a nds, I have a Trainer Toolkit and ards, so is there a way that I may use my pc to remote debug my nds?
     
  2. LeRodeur

    Member LeRodeur GBAtemp Regular

    Joined:
    Dec 12, 2009
    Messages:
    162
    Country:
    France
    I think that no$gba is still the greatest debugger for nds, though I never tried other emulators ones. I don't think you can debug directly on nds, if it is your homebrew then you only have to output messages, easiest way of debugging
     
  3. gudenaurock
    OP

    Member gudenaurock Never a unique idea

    Joined:
    Jul 7, 2010
    Messages:
    2,955
    Location:
    /dev/random
    Country:
    United States
    Well, nds emus don't work for me, oh well...
     
  4. LeRodeur

    Member LeRodeur GBAtemp Regular

    Joined:
    Dec 12, 2009
    Messages:
    162
    Country:
    France
    Whats the game? Most run fine on nogba
     
  5. smealum

    Member smealum growing up sucks.

    Joined:
    May 1, 2006
    Messages:
    627
    Location:
    SF
    Country:
    United States
    You might want to read this : http://www.console-dev.de/2009/09/20/guru-meditation-error-data-abort-exception/ ; it explains how to use the "guru meditation error" you might sometimes see in homebrew games (among other things) to debug your games. Basically, every time your program crashes, it will give you information which you can use to know which line of your code is faulty. Of course, it's only one tool and it won't give useful information every time, but it's better than nothing, and it'll work on the DS (you don't need an emulator to get it to work).
     
  6. gudenaurock
    OP

    Member gudenaurock Never a unique idea

    Joined:
    Jul 7, 2010
    Messages:
    2,955
    Location:
    /dev/random
    Country:
    United States
    The ds emulators don't like to run on my computer.

    Thanks.
     
  7. Schmendrick

    Newcomer Schmendrick Advanced Member

    Joined:
    Sep 12, 2009
    Messages:
    55
    Country:
    Netherlands
    You could also use the console to print info to the screen. It's very limited, but it'll get you some more info on specific variables.

    My game framework contains, among other debugging functions, simple logging options that can be accessed at any time while playing, and automatically gets saved to the sd card when it crashes with said guru exceptions; See my level editor app for an example (link in my sig, press select+L+R). It's easy enough to make, and I find it very useful, though the logs do take up some memory (if memory is an issue for you).
     
  8. Dirbaio

    Member Dirbaio GBAtemp Regular

    Joined:
    Sep 26, 2010
    Messages:
    158
    Location:
    Spain
    Country:
    Spain
    Yea. Pretty much your debugging choices are:
    - No$GBA Debugger: Awesome debugger, but bad emulator. Supports breakpoints and many other stuff, console printing, but doesn't support DLDI :(
    - Desmume: You can print out with it if you use the dev+ builds, accurate emulation, DLDI supporting
    - Real DS: you can just use the guru error screen, and libnds console. The guru error doesn't catch all kinds of errors though.

    The one I always use is demume. It's accurate as hell :)

    I always open the .ELF file in IDA Pro and look up the faulty addresses. You can get many, many more info this way, you can look at the registers and see what variable they are :) That, eif you know how to read ARM assembler code :)
     
  9. DanTheManMS

    Member DanTheManMS aka Ricochet Otter

    Joined:
    Jun 2, 2007
    Messages:
    4,325
    Location:
    Georgia
    Country:
    United States
    With the FCSR thing, you can build your filesystem into a single *.nds executable that no$gba can load. It's read-only, but it works for testing sometimes. I usually used the DLDIrc addon to quickly build my FCSR images for testing. If you're interested I can give more detailed instructions and a more stable image builder tool.
     
  10. CoolAs

    Newcomer CoolAs Advanced Member

    Joined:
    Oct 21, 2011
    Messages:
    75
    Country:
    Australia
    Hehe when i get guru's I use the arm-eabi-objdump tool you provide it with an .elf and it gives a conplete dissembly. Work's like a free version of IDA's .elf reader. (but you cant hack .arm9 in games with it xD).
    In terms of debugging you could also make a ram dump to a file.(and a vram  dump if you are really needy) then just print the offsets of all your variables to a file. Allowing you to check everything. Also you could make it read ram dumps so you can modify variables and see what happens. Although my preferred debugger is desmume, this is because it has not only Dldi, but also can read ram, view vram, and heaps more. The only thing it can't do is dissemblies.
    But yeah, try ram dumping to see whats happening - that is without an emulator.
     
  11. Nagato

    Member Nagato GBAtemp Advanced Fan

    Joined:
    Jul 15, 2011
    Messages:
    529
    Country:
    United States
    If you're already using IDA Pro then I'd suggest taking it a step further and looking into compiling an SVN copy of DeSmuME with the gdbstub enabled (see also the command line arguments for when you have the gdbstub enabled). IDA Pro already includes a way to attach to a gdb server so you will have the power of IDA Pro and the ability to debug NDS software at the same time.
     
  12. Dirbaio

    Member Dirbaio GBAtemp Regular

    Joined:
    Sep 26, 2010
    Messages:
    158
    Location:
    Spain
    Country:
    Spain
    Yeah, I've used desmume's GDB too, but it's way too unstable for me. It tends to hang / screw up/ crash :(

    It works a bit more reliably if using Insight as a GDB client instead of IDA but it's still far from ideal.
     

Share This Page