forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to debug exception

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Mon Jun 19, 2006 8:27 pm    Post subject: How to debug exception Reply with quote

I still have a nasty bug which prevents me from releasing my PMP VLC player. After playing a wifi streamed video for about 10-20 minutes I get this:

host0:/> Exception - Bus error (data)
Thread ID - 0x04CC4F6D
Th Name - Decode thread
Module ID - 0x039B9F33
Mod Name - PMP VLC Player 0.0.7
EPC - 0x08B1631C
Cause - 0x0000001C
BadVAddr - 0x0082828A
Status - 0x60008613
zr:0x00000000 at:0x08E40000 v0:0x00000001 v1:0x00000000
a0:0x00000000 a1:0x00000000 a2:0x00000000 a3:0x00000000
t0:0x000FF1B0 t1:0x00000080 t2:0x08BE9EA0 t3:0x08BEA290
t4:0x08BE9E98 t5:0x00001E04 t6:0x08901694 t7:0x00008600
s0:0x00000000 s1:0x091671B8 s2:0x00001096 s3:0x00000001
s4:0x091660D0 s5:0x00005DB8 s6:0x091660C0 s7:0x00000016
t8:0x00000001 t9:0x089A5CA8 k0:0x088E7F00 k1:0x00000000
gp:0x08BF2540 sp:0x088E7560 fp:0x09167040 ra:0x089A5694
reset
Resetting psplink

I can't do much with it. Does anyone know how to debug it? And does the error report give any clues? (apart from that the error occurs in the decode thread)
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Mon Jun 19, 2006 8:51 pm    Post subject: Reply with quote

compile your code with -g (which will add debug info to the elf), then use psp-addr2line with the elf and the badvaddr and it will spit out the sourceline with the error. (bus error/data usually indicates some kind of problem with accessing misaligned data)
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Mon Jun 19, 2006 10:40 pm    Post subject: Reply with quote

It's compiled with -g, but I only get
Code:

$ psp-addr2line -e PMPVLC007.elf 0x0082828A
??:0


Am I missing something?

PS: JiniCho had a similar problem, see http://forums.ps2dev.org/viewtopic.php?t=3376&highlight=addr2line
Unfortunately I can't apply the solution given there
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Mon Jun 19, 2006 11:32 pm    Post subject: Reply with quote

Maybe the error occurs inside one of the libs (most likely libavcodec, since the thread in question is the Decode thread), but if this lib isn't compiled with the -g switch, line information for the code there won't be available.

Look out for misaligned data accesses like groepaz said, or also for unallocated mem accesses inside the decoding thread. I'm not sure what you changed from the original source, but unless you completely rewrote it, you should be able to find it by searching your additions.
Back to top
View user's profile Send private message Visit poster's website
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Mon Jun 19, 2006 11:36 pm    Post subject: Reply with quote

also try 0x8082828A instead of 0x0082828A. and yes, if the crash is in a lib that has been compiled without -g, you wont get a lot of useful info :)

err that said, isnt 0x0082828A a kernel address ? :=P (so you are passing bad arguments to some kernel routine) try passing the address in RA to addr2line, it will give you a hint from where that bad call was done.

edit: bla, i'm confused. :=D

EPC - 0x08B1631C

thats the address you want to use. and badvaddr=0x0082828A pretty much shows the problem too, i bet you are trying to load a 32bit value from a non 32bit aligned address :=) (0x0082828A is not 32bit aligned)
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Tue Jun 20, 2006 12:06 am    Post subject: Reply with quote

groepaz wrote:
EPC - 0x08B1631C

thats the address you want to use. and badvaddr=0x0082828A pretty much shows the problem too, i bet you are trying to load a 32bit value from a non 32bit aligned address :=) (0x0082828A is not 32bit aligned)

Yep this looks better :)
Code:

$ psp-addr2line -f  -e PMPVLC007_JockyW.elf 0x08B1631C
memset
../../../../../../newlib/libc/machine/mips/memset.c:118

There are only 7 memset occurances in my code so it shouldn't be a too big problem to track the bug. That is assuming that the bug is not in one of the ffmpeg libs.

Thx a lot guys!
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Tue Jun 20, 2006 12:14 am    Post subject: Reply with quote

like i said, the value in RA should lead you to the line where memset was called (the line after that to be exact)
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Tue Jun 20, 2006 12:21 am    Post subject: Reply with quote

groepaz wrote:
like i said, the value in RA should lead you to the line where memset was called (the line after that to be exact)

Bingo!
Code:

$ psp-addr2line -f  -e PMPVLC007_JockyW.elf 0x089A5694
ogg_read_page
/home/KP/projects/PMPVLC007/libavformat/ogg2.c:293


It's the damn ogg container code which is part of ffmpeg libs.
Cool Groepaz, thanks a lot for your help!!!

Maybe I can now watch a full worldchampionship soccer game on my psp :)
Back to top
View user's profile Send private message
looptrooper



Joined: 12 Feb 2006
Posts: 8

PostPosted: Thu Jun 22, 2006 9:42 pm    Post subject: Reply with quote

so you could trace the last bug and fixed it? no more waiting for the ultimative solution called PMP with VLC, you will release soon? canīt wait :)
Back to top
View user's profile Send private message
daurnimator



Joined: 11 Dec 2005
Posts: 38
Location: melbourne, australia

PostPosted: Thu Jun 22, 2006 11:20 pm    Post subject: Reply with quote

so... um... will you release it? :P
Back to top
View user's profile Send private message MSN Messenger
bada



Joined: 27 Apr 2006
Posts: 4

PostPosted: Fri Jun 23, 2006 12:34 am    Post subject: Reply with quote

i debug another way

Code:

psp-objdump -S prog.elf >> prog.s


and find in prog.s by addres a mistake....
Back to top
View user's profile Send private message
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Fri Jun 23, 2006 3:23 am    Post subject: Reply with quote

daurnimator wrote:
so... um... will you release it? :P

Yes I will, in about an hour. Need to write a little manual first.
There are still plenty of issues, but they can wait until the next version.
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Fri Jun 23, 2006 3:48 am    Post subject: Reply with quote

I'm already curious about your VLC version :)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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