 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
CrazyT
Joined: 23 Dec 2006 Posts: 18
|
Posted: Mon Jan 05, 2009 11:34 pm Post subject: [Solved] Wrong line numbers - Bug in psp-objdump? |
|
|
Hi, i have a question that probably nobody asked before.
I'm using the sdk-example "sprite" in samples/gu folder:
http://c.pastebin.com/f1227a361
I modified the Makefiles.sample to build debuginformation inside:
CFLAGS = -Wall -O2 -g
But when i use "psp-objdump -D -l sprite.elf>output.txt" it seems to have wrong line numbers inside the output.txt.
Here is a little example:
| Code: | /cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c:75
41c: 8fa30054 lw v1,84(sp)
420: 0460010d bltz v1,858 <main+0x4ac>
424: 8fa20054 lw v0,84(sp)
428: 44830000 mtc1 v1,$f0
42c: 00000000 nop
430: 46800520 cvt.s.w $f20,$f0
434: 461aa500 add.s $f20,$f20,$f26
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c:68
438: afa00050 sw zero,80(sp)
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c:75
43c: 4618a502 mul.s $f20,$f20,$f24
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c:68
440: 0c000a5f jal 297c <cosf>
444: 4600a306 mov.s $f12,$f20
448: 4600a306 mov.s $f12,$f20
44c: 0c000aa1 jal 2a84 <sinf>
450: 46190580 add.s $f22,$f0,$f25
|
As you may see, the line number 68 appears several times.
The cosinus(cosf) function is on line 82, but it shows line 68, wich confuses me a bit.
I just write this, because i want to create a program that fetches the line numbers and offsets, so that you can set breakpoints inside a c-source-file and debug it with that.
But with this wrong line information my debugger just jumps to wrong lines.
Note:
This bug also seems to happen for psp-addr2line:
| Code: | sh-3.2$ psp-addr2line.exe -e sprite.elf 440
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c:68
|
Read on the wiki that you also need that information:
| Code: | sh-3.2$ psp-gcc.exe -v
Using built-in specs.
Target: psp
Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-l
anguages=c,c++ --with-newlib --with-gmp --with-mpfr --enable-cxx-flags=-G0
Thread model: single
gcc version 4.3.2 (GCC)
sh-3.2$ psp-objdump.exe -v
GNU objdump 2.16.1 (PSPDEV 20060116)
Copyright 2005 Free Software Foundation, Inc. |
Last edited by CrazyT on Tue Jan 06, 2009 3:06 am; edited 1 time in total |
|
| Back to top |
|
 |
jbit Site Admin

Joined: 28 May 2005 Posts: 293 Location: København, Danmark
|
Posted: Tue Jan 06, 2009 12:14 am Post subject: |
|
|
| Optimized code output will never match up perfectly with C, using -O0 will help (but will produce slower code). |
|
| Back to top |
|
 |
CrazyT
Joined: 23 Dec 2006 Posts: 18
|
Posted: Tue Jan 06, 2009 12:23 am Post subject: |
|
|
Forgot to mention that i also used "BUILD_PRX=1" in the makefile.
If i do not use it, it shows linenumbers correctly, no idea why.
EDIT:
Using -O0 seems to work!
Thanks mate. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|