GP2X Remote Debugging To Gp2x


gmiller1018

Member
Joined
Sep 21, 2006
Messages
336
Location
USA Florida
Website
Visit site
I guess I am spoiled when it comes to debugging. I like being able to set break points, step into/outof functions and do it from a visual debugger. As I tried to remember all of the gdb commands I had forgotten I remembered that gdb support a remote connection. This can be done by linking in some code or using gdbserver to do the remote support. I was looking to build the code when I found it already built for me so I set it up to do the debugging. Now from a development point of view their are a number of visual debuggers that layer on top of gdb, two that I have used are DDD and Insignt, both of with are generally available. On windows if you have devkitPro it is available and that is the one I chose to use.

My windows development environment is limited in use because I link filure for generally no reason (but I am sure I screwed it up somehow). I build and link all of my code with the "-g" switch added to all (this includes debug information) and usually -O0 (Oh-Zero) to disable optimization if basic functionality is all I am testing. I ftp the debug executable to my GP2X where I want to test it. I then telnet to the GP2X with the the following in by bin directory in the root of the SD card.
Code:
drwxr-xr-x 2 gmiller Domain Users	   0 Dec 31  1979 .
drwxr-xr-x 9 gmiller Domain Users	   0 Dec 31  1969 ..
-rw-r--r-- 1 gmiller Domain Users 3102144 Jul 13 17:05 gdb
-rw-r--r-- 1 gmiller Domain Users   40692 Jul  9 23:13 gdbserver

These files will allow me to start the gdbserver and connect via TCP/IP to the code from the machine that is running my visual debugger (Insight in my case). I start the server on my GP2X with the following commands:
Code:
PATH=$PATH:/mnt/sd/bin
export PATH

gdbserver localhost:10000 vba InterruptTest.gba
COMMENT: I am currently testing my version of the 1.8.0 VisualBoyAdvance code on the GP2X
This starts the server listening on port 10000 on the GP2X. I then start Insight from a copy (in my case because I can't link on my windows box) of my linux build tree using the following "insight.ini" tree.
Code:
File vba
target remote gp2x:10000
b main
directory dir:wd:c

These setting point at my executable (vba) what machine to connect to and what port on that machine (gp2x which is in my hosts file as 10.1.0.2) and port 10000 which is the port I told the server to listen on. Set a breakpoint at main and somehow set the search directories for the source files. The command to start insight using this file is:
Code:
/c/devkitPro/insight-6.4.50/bin/arm-elf-insight.exe --command=insight.ini vba

Which points at where I have a customized insight (at least it was, not it is the standard for devkitPro) using the commands I defined in "inisght.ini" and start vba (the code I am testing). Your code for main should show (you might have to do a continue (press C)). There are some other setting in insight you might need to set as well prior to trying to debug your first program.

Start insight without anything special:
Code:
/c/devkitPro/insight-6.4.50/bin/insight.exe

This is where I have it on the disk ... Then click File->Target Setting. On that screen there is a More Options triangle that you need to click and make sure no other options other that the run method are set. I could not get the load program over the ling to work so I am avoind it for now. Set the target tol Remote/Tcp and the host and port number to your choices for those values (I use gp2x and 10000). Click OK and then click file and exit. This will set the startup options (this creates a "gbtk.ini" file in the root of your hard drive (WTF). From this point on you SHOULD not need to mess with these values unless this are really sccrewed up (and that take a computer). I hope this helps I will try to get the files into the archives soon.

Since I have not put files in the archive before I might not get it right at first.
 
I have tried to queue up the files for the archive and I get:
Code:
Error: Licence not specified.
There does not seem to be a way to specify this so I am dropping my attempt for now. I have wasted an hour already trying to do this.
:blink:
 
Ok it is there ...
http://www.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,14,1827

Let me know if this helps, I saw the eclipse stuff there but I gave up on eclise after a hard fought battle with no definite winner (of course I was gragging my tail).

If you do your conding on windows this is a definite help. If you do your codding on linux you just need an ARM compatable remote debugger and the files that go on the gp2x side.
 
One thing I just noticed was that the code on the gp2x can be stripped to limit the size because the version on the system where you are running the visual debugger just needs the symbols. I am also thinking the you do not neet GDB on the gp2x just the gdbserver code. I will check that out shortly and re-edit this message.
 
I noticed you haven't gotten any comments on this, but I'd just like to say I think it's good info to have around, so thanks for the effort :)
 
Back
Top