Welcome! Log In Create A New Profile

Advanced

GDB

Posted by technik 
GDB
March 27, 2009 01:06PM
I'm cleaning up the code of the new version of revolution engine and sometimes i get code-dumps that i have no idea where come from.
So i have decided to use GDB for debbugging thos codedumps but actually I don't know how to do that. I'm on windows and have installed the full devkitpro so gdb must be installed, right?
Then, how do i run it?
Re: GDB
March 27, 2009 02:44PM
In devkitpro the tool is actually called powerpc-gekko-gdb (or something like that). You can set your environment variables to devkitpro's bin folder, so you can access the debugger from anywhere.

I've not actually used core dumps for Wii programs yet, but I assume it dumps a file in elf format, which you can load into GDB to check the state of the machine at the point of the crash.

The following page explains how to load a core dump:
[www.unknownroad.com]

You will then need to learn some GDB commands in order to examine the program state. I haven't tried this either, but Insight or another GUI frontend may make this easier.

Also, I'd recommend getting set up to use GDB even when a core dump doesn't occur. I wrote a post a few days ago pointing to a patch I made to libogc to support debugging with GDB over the wifi connection. You can apply the patch yourself and recompile libogc to support it.
[forum.wiibrew.org]

Some information on how to set up:
[www.wiibrew.org]

Thanks,
cdmac
Re: GDB
March 27, 2009 09:58PM
Just a note on random code dumps: Make sure you're not passing global variables as function parameters. That always gives me a code dump.
Re: GDB
March 28, 2009 05:46AM
Quote
Arikado
Just a note on random code dumps: Make sure you're not passing global variables as function parameters. That always gives me a code dump.
wut.

Mind taking the generic Hello World example and adding whatever you're doing with functions to it in order to demonstrate the crash?
Re: GDB
March 28, 2009 10:50PM
Hi,

I have some problems getting my USB Gekko box & GDB working together.

I've followed the instructions on the USB Gekko web site to install drives etc and configure the driver as a Virtual Comm Port.

I have also setup my application for debugging as per the guide on this site.

I.e. call DEBUG_Init(GDBSTUB_DEVICE_USB, 1) at the start compile with -g and link against db.

I have my application running on the wii and I start up powerpc-gekko-gdb.exe on my pc.

When I type "target remote COM3" I get the following:

(gdb) target remote COM3
Remote debugging using COM3
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response

And that's it. The appplication keeps running on the wii but gdb is hung.

Has anybody seen this before or have any suggestions as what I can try?

Thanks...
Re: GDB
May 09, 2009 11:10PM
Hi njohn1970,

Were you able to solve the problem?

Quote
njohn1970

When I type "target remote COM3" I get the following:

(gdb) target remote COM3
Remote debugging using COM3
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response

I get exactly the same problem too. Can anyone shed some light on this please?

Thanks.
Re: GDB
May 10, 2009 09:47PM
Hi,

Nope, I'm affraid I didn't make any further progress with this.

Cheers..

Quote
robert50
Hi njohn1970,

Were you able to solve the problem?

Quote
njohn1970

When I type "target remote COM3" I get the following:

(gdb) target remote COM3
Remote debugging using COM3
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response

I get exactly the same problem too. Can anyone shed some light on this please?

Thanks.
Re: GDB
May 10, 2009 11:36PM
Thanks for your reply...

I managed to get it to work. I had to uninstall both the "COM3" followed by "USB Serial Converter" from Device Manager, then reinstall it.
Re: GDB
November 15, 2009 06:23AM
Tried uninstalling as suggested and installed the latest drivers, but I still see this issue. I'm on Windows XP 32-bit.
Re: GDB
November 15, 2009 07:28AM
for debugging, i use a few different ways. if i have a code dump that i want to find the line of code to match, just use
powerpc-gekko-addr2line -e "elf file" "address"  #without quotes

or in gdb

symbol-file "elf file"
gdb info line "address"
in the terminal. it also works fine in the cmd in windows. and make sure you should use the elf and not the dol.

if i want to do a bit more poking around, i just open gdb or insight and use the open command to open the elf and dig around. as far as the COM# stuff, i had the same issue. im not sure it the gecko is mounted correctly in gdb/insight as it just froze the app when i tried. i know wiiload had some bug in previous versions that couldnt mount the gecko in windows for me. i had to get a new version of wiiload, (fixed by r-win) to get it to work. maybe there is the same bug in the way gdb and insight try to mount the gecko. once i switched to linux all the gecko tools just magically worked.



Edited 1 time(s). Last edit at 11/15/2009 07:30AM by giantpune.
Re: GDB
November 16, 2009 09:07AM
Thanks for the additional debugging tips giantpune. You inspired me to finally try out linux; I decided on Ubuntu 9.10. I'm following the devkitppc setup guide for linux here. I installed the premade archive available here. When I do 'make run' I get the following:

wiiload template.dol
wiiload v0.4
coded by dhewg

connecting to 192.168.1.10:4299
sending upload request
sending file size (219104 bytes)
sending data..make: *** [run] Broken pipe

I've been stuck on this for a while. I can ping my Wii just fine... Any ideas?



Edited 1 time(s). Last edit at 11/16/2009 09:09AM by calvinss4.
Re: GDB
November 25, 2009 02:22PM
Try getting the new version of Wiiload. (0.5).

I recently setup Eclipse* for Wiibrewing on Ubuntu 9.10 and had problems with Wiiload until I updated it.

* at least I think I've set it up correctly - the template works
Sorry, only registered users may post in this forum.

Click here to login