Line 12:
Line 12:
Your wii code must be compiled with the option -g linked with the option -ldb, included before other libraries such as -logc.
Your wii code must be compiled with the option -g linked with the option -ldb, included before other libraries such as -logc.
−
Start your wii code using normal means such as the homebrew channel. Start gdb by typing:
+
Start your wii code using normal means such as the homebrew channel. Start the more user friendly versino of gdb by typing:
−
powerpc-gekko-gdb
+
powerpc-gekko-gdbtui
At the gdb command prompt, type:
At the gdb command prompt, type:
Line 26:
Line 26:
You can then insert other break points manually by typing for example (assuming you are in the same directory as the source file):
You can then insert other break points manually by typing for example (assuming you are in the same directory as the source file):
break sourcefile.c:linenum
break sourcefile.c:linenum
+
+
If sources are in another directory, you can tell gdb where with the command:
+
+
directory name/of/source/directory
You can then continue running the program by typing:
You can then continue running the program by typing:
cont
cont
+
+
Particularly if you have hardcoded a breakpoint with the _break() function, it is useful to be able to run until the current function exits with the command:
+
finish
Examine the value of variables by typing
Examine the value of variables by typing
print variablename
print variablename
+
+
The above examples are confirmed to work under linux but may require some modification to work under windows/msys (particularly /dev/ttyUSB0).
==Diagnosing crashes==
==Diagnosing crashes==
Line 47:
Line 56:
The 800084ac is the memory address in hex of where the crash occurred. 809F0020 is the machine code for the offending instruction.
The 800084ac is the memory address in hex of where the crash occurred. 809F0020 is the machine code for the offending instruction.
+
+
===With GDB===
+
Using gdb, you can find out where the relevant code is with the command:
+
+
gdb info line *0x800084ac
+
+
This should work even if you don't have a USB gecko, as it is only using the symbol information stored in the .elf file.
+
+
===Alternative Method===
*Step 1:
*Step 1: