I'm using DDD/GDB to debug a homebrew game running on NintendoDS, built with "arm-eabi-gcc (devkitARM release 32) 4.5.1". FYI, I uploaded the unstripped .elf binary (file no longer hosted), in case anybody wants to reproduce some of the steps below.
I ask gdb for a listing of one of the functions sitting in GameScript.o (GobExpression::eval) it handles it fine.
I ask gdb for a listing of SimpleGob::play, in the same GameScript.o, it complains that "No line number known for SimpleGob::play". (arm-eabi-gdb session just below:)
arm-eabi-gdb AppleAssault.elf
GNU gdb (GDB) 7.2
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-eabi".
Reading symbols from AppleAssault.elf...done.
(gdb) list GobExpression::eval
342 bool eval(s16 data[REGISTERS], iGun **extra=0) {
343 GobCollision gc[2]={{0,0,data},{0,0,0}};
344 return eval(gc,extra);
345 }
346
347 bool eval(GobCollision* c, iGun **extra=0) {
348 s16 *data=c[0].data;
349 s16 stack[STACKSIZE]; int sp=0;
350 u8 op;
351 if (!code) return true;
gdb) list SimpleGob::play
play play()
(gdb) list SimpleGob::play
No line number known for SimpleGob::play.
However, if I invoke arm-eabi-objdump -drl AppleAssault.elf, it obviously do find some line numbers, as they are mentioned in the dump:
0203c7f8 <_ZN9SimpleGob4playEv>:
_ZN9SimpleGob4playEv():
/beetle/hobby/DS/dsgametools/branches/companim/libgeds/source/GameObject.cpp:1710
203c7f8: b5f0 push {r4, r5, r6, r7, lr}
203c7fa: 465f mov r7, fp
203c7fc: 4656 mov r6, sl
203c7fe: 464d mov r5, r9
203c800: 4644 mov r4, r8
203c802: b4f0 push {r4, r5, r6, r7}
203c804: b0a7 sub sp, #156 ; 0x9c
_ZN9CommonGob11gobDoChecksEv():
/beetle/hobby/DS/dsgametools/branches/companim/libgeds/source/GameObject.cpp:1430
203c806: 7c03 ldrb r3, [r0, #16]
_ZN9SimpleGob4playEv():
/beetle/hobby/DS/dsgametools/branches/companim/libgeds/source/GameObject.cpp:1710
203c808: 1c05 adds r5, r0, #0
_ZN9CommonGob11gobDoChecksEv():
/beetle/hobby/DS/dsgametools/branches/companim/libgeds/source/GameObject.cpp:1430
203c80a: 2b00 cmp r3, #0
203c80c: d100 bne.n 203c810 <_ZN9SimpleGob4playEv+0x18>
203c80e: e099 b.n 203c944 <_ZN9SimpleGob4playEv+0x14c>
File is compiled with arm-eabi-g++ -MMD -MP -MF /beetle/hobby/DS/dsgametools/branches/companim/libgeds/build/GameObject.d -g -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork {include path stripped} -DARM9 -fno-rtti -Wall -O2 -c /beetle/hobby/DS/dsgametools/branches/companim/libgeds/source/GameObject.cpp -o GameObject.o
, thus with debugging symbols enabled, packed in a .a archive, and finally linked with the program. Recompiling with -O0 doesn't seem to help.
I've seen a workaround at GDB can not find line numbers that suggests to use add-symbol-file, although I don't quite know which symbol file I'd add ... Am I missing a subtle key concept of GDB debugging symbols that would explain what (some part of) my programs are missing for GDB to be able to annotate it with line numbers ?
Try
-gstabs+
when compiling withg++
to try with GNU extensions debugging information (only understood bygdb
).