[Solved] Wrong line numbers - Bug in psp-objdump?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

[Solved] Wrong line numbers - Bug in psp-objdump?

Post by CrazyT »

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: Select all

/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c:75
     41c:	8fa30054 	lw	v1,84(sp)
     420&#58;	0460010d 	bltz	v1,858 <main+0x4ac>
     424&#58;	8fa20054 	lw	v0,84&#40;sp&#41;
     428&#58;	44830000 	mtc1	v1,$f0
     42c&#58;	00000000 	nop
     430&#58;	46800520 	cvt.s.w	$f20,$f0
     434&#58;	461aa500 	add.s	$f20,$f20,$f26
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c&#58;68
     438&#58;	afa00050 	sw	zero,80&#40;sp&#41;
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c&#58;75
     43c&#58;	4618a502 	mul.s	$f20,$f20,$f24
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c&#58;68
     440&#58;	0c000a5f 	jal	297c <cosf>
     444&#58;	4600a306 	mov.s	$f12,$f20
     448&#58;	4600a306 	mov.s	$f12,$f20
     44c&#58;	0c000aa1 	jal	2a84 <sinf>
     450&#58;	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: Select all

sh-3.2$ psp-addr2line.exe -e  sprite.elf 440
/cygdrive/e/Programme/psptoolchain/build/pspsdk/src/samples/gu/sprite/sprite.c&#58;68
Read on the wiki that you also need that information:

Code: Select all

sh-3.2$ psp-gcc.exe -v
Using built-in specs.
Target&#58; psp
Configured with&#58; ../configure --prefix=/usr/local/pspdev --target=psp --enable-l
anguages=c,c++ --with-newlib --with-gmp --with-mpfr --enable-cxx-flags=-G0
Thread model&#58; single
gcc version 4.3.2 &#40;GCC&#41;

sh-3.2$ psp-objdump.exe -v
GNU objdump 2.16.1 &#40;PSPDEV 20060116&#41;
Copyright 2005 Free Software Foundation, Inc.
Last edited by CrazyT on Tue Jan 06, 2009 3:06 am, edited 1 time in total.
User avatar
jbit
Site Admin
Posts: 293
Joined: Sat May 28, 2005 3:11 am
Location: København, Danmark
Contact:

Post by jbit »

Optimized code output will never match up perfectly with C, using -O0 will help (but will produce slower code).
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

Post by CrazyT »

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.
Post Reply