gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Debugging in emulators

#138646 - Moby Disk - Mon Aug 27, 2007 6:11 am

How does one go about debugging code for the DS? Devkitpro comes with Insight and there is an arm-eabi-gdb.exe but I don't understand how to use this with an emulator, or with a real DS either. I've used gdb on Linux before and it made sense, but I'm completely confused as to how it even applies here. Does anybody have any links on how to get started with this?

#138648 - Kiz - Mon Aug 27, 2007 7:55 am

I'm a complete newbie with this stuff myself, but I'll see if I can help you out with this stuff.

Read: http://www.devkitpro.org/debugging-with-vba-and-insight.shtml

The VBA stuff is irrelevant to you, but it shows you how to setup Insight for what you want to do. Then, download DeSmuME (with gdb stub). I think this has the most up to date version, I could be wrong.

Depending on your environment, starting up DeSmuME so that it uses the right port can be different. For Windows, run it from command prompt with something like:

desmume_gdb.exe --arm9gdb=20001 --arm7gdb=20000

Then setup Insight to use the appropriate port.

Have Insight run the .elf, have DeSmuME run the .nds, and you're good to go. That said, after I finally got it all running, I couldn't get anything remotely useful out of it. I could step through tutorials/examples just fine, but it didn't help me at all with my code, just said that it received Signal 0 and told me to piss off.

Hope that helped a little.

#138653 - simonjhall - Mon Aug 27, 2007 11:45 am

I should really re-release this, since I spent so much time on it:
http://forum.gbadev.org/viewtopic.php?t=10332

It allows you to debug your code running on your DS over wifi, using gdb and any gdb-compatible GUI debugger (I use eclipse).
_________________
Big thanks to everyone who donated for Quake2

#138655 - Kiz - Mon Aug 27, 2007 12:10 pm

When I first read that, it made me sad that I don't have a wireless router/dongle. I think I'm gonna have to invest in a dongle soon, it was a nightmare trying to get anything useful out of a debugger when I was toying around with my basic .obj loader the other day.

#138656 - kusma - Mon Aug 27, 2007 1:00 pm

simonjhall wrote:
I should really re-release this, since I spent so much time on it:
http://forum.gbadev.org/viewtopic.php?t=10332

It allows you to debug your code running on your DS over wifi, using gdb and any gdb-compatible GUI debugger (I use eclipse).

Yeah, you should, since the link is dead :)

#138746 - Moby Disk - Tue Aug 28, 2007 2:23 pm

I found my answer. Over at the desmume forums there is a post about a version of desmume that works with gdb. It does exactly what I was looking for.

http://forums.desmume.org/viewtopic.php?id=85

Also, no$gba has a commercial version that supports debugging, but I'm unclear if that is gdb debugging, or a built-in debugger, or if it loads symbols or what.

http://nocash.emubase.de/gba.htm

#138749 - masscat - Tue Aug 28, 2007 4:09 pm

The GDB stubs in Desmume are in the main CVS and should be present and usable in releases after version 0.7.

I also did a GDB stub for on hardware (similar to Simon's). There was talk of putting this into under the devkitpro tool set but I have not had time recently to bring it to a point where that can happen.