| View previous topic :: View next topic |
| Author |
Message |
GlennNZ
Joined: 13 Jan 2007 Posts: 25
|
Posted: Tue Aug 05, 2008 9:30 pm Post subject: Trying to solve a game crash (crt0_prx.c) |
|
|
I'm trying to find out why my program has suddenly started to crash on me. As of yet I can't figure out if it is my fault or not but it's happened since implementing vertex arrays using PSPGL. However, it also crashes when I disable all vertex arrays so I'm not sure what it could be. What's worse, as it seems to do it at random. Sometimes I can play for a few minutes, other times it crashes after a few seconds so I have no idea what is triggering it.
What I get with PSP Link is:
| Code: |
Exception - FPU Exception (IUV)
Thread ID - 0x04A7CD05
Th Name - user_main
Module ID - 0x00D97479
EPC - 0x08859A24
Cause - 0x1000003C
BadVAddr - 0x35400244
Status - 0x60088613
zr:0x00000000 at:0x2008FF00 v0:0x40000000 v1:0x1E000000
a0:0x08D359E8 a1:0x1E000001 a2:0x00000001 a3:0x40000000
t0:0x08D35970 t1:0x08D35CEC t2:0x08D35988 t3:0x00000000
t4:0x089CB860 t5:0x00003E0C t6:0x0885F6EC t7:0x20088600
s0:0x09FBFD68 s1:0x09FBFD64 s2:0x089D0000 s3:0x09FBFEE0
s4:0x00000019 s5:0x00000013 s6:0x09FBFD6C s7:0x092A8D64
t8:0x00000004 t9:0x00000000 k0:0x09FBFF00 k1:0x00000000
gp:0x089DE690 sp:0x09FBFD40 fp:0x092A8D50 ra:0x088214C8
0x08859A24: 0x4600783C '<x.F' - c.lt.s $fpr15, $fpr00
Resetting psplink
|
Using psp-addr2line I get
| Code: |
psp-addr2line -f -e Apollonia_PSP.elf 0x0000003C
_main
/home/glennm/psptoolchain/build/pspsdk/src/startup/crt0_prx.c:67
|
I'm of the understanding that I have to change 0x1000003C to 0x0000003C or else I don't get anything meaningful.
Digging into crt0_prx.c shows that line 67 has
which is unfortunately somewhere I don't know where to go next.
Does anyone have any experience with this issue? And is there any other information that I should be able to get from the crash dump? I get a lot of
??
??:0
I hope this isn't a difficult question, but I'm not holding my breath.
Cheers. |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Tue Aug 05, 2008 10:39 pm Post subject: |
|
|
Let's break it down.
| Code: | | Exception - FPU Exception (IUV) |
You're getting an FPU exception.
The FPU exception is a division by zero.
You should be putting the EPC value into psp-addr2line, not the Cause value. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Aug 06, 2008 3:50 am Post subject: |
|
|
| In fact with a PRX you need to put in the relative address, depending on the version of psplink you have you might be able to do 'calc $epc-$mod' to get the address or you have to do it manually. |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Wed Aug 06, 2008 5:28 am Post subject: |
|
|
Oops missed that bit.
I saw the Apollonia_PSP.elf but totally missed the crt0_prx.c reference. |
|
| Back to top |
|
 |
GlennNZ
Joined: 13 Jan 2007 Posts: 25
|
Posted: Wed Aug 06, 2008 8:54 pm Post subject: |
|
|
I'm don't think I'm using the tools properly.
I've read up on some previous posts and going by http://forums.ps2dev.org/viewtopic.php?t=10014&highlight=calc+epc+mod
I used psplink, made the game crash, then ran
This gave
which is the same as the epc value.
I subsequently get the following with psp-addr2line.
| Code: | psp-addr2line -f -e Apollonia_PSP.elf 0x08859A3C
??
??:0
|
A comment was made to try calc $mod-$epc instead. This gives 0xF77A65C4 which is turn provides ??
Using http://forums.ps2dev.org/viewtopic.php?t=9504&highlight=calc+epc+mod as a reference I tried and got the following in psp shell
| Code: | host0:/> !psp-addr2line -e Apollonia_PSP.elf $?
/home/glennm/psptoolchain/build/pspsdk/src/startup/crt0_prx.c:61 |
which, funny enough, takes me back to where I started.
I've noticed that I crash a lot in PSPLink but haven't crashed yet when I copy and use the actual eboot file. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Thu Aug 07, 2008 3:08 am Post subject: |
|
|
| I guess Sony might finally have made it so fpu exceptions are ignored, the PSP fpu sucks badly in certain situations ;) You could just disable the exceptions with pspfpu_set_enable(0); at the start of your code ;) |
|
| Back to top |
|
 |
GlennNZ
Joined: 13 Jan 2007 Posts: 25
|
Posted: Thu Aug 07, 2008 5:57 am Post subject: |
|
|
Insert_witty_name said that an FPU exception is a divide by zero issue. Is that the case or is it from uninitialised floating point numbers? I ask because I know the fp means floating point but I don't know what the 'u' stands for.
Is there a way for me to find out if it is happening in my code or in one of the libraries? Obviously I'd rather not have that situation occuring, but considering that the Linux build appears fine, it might be out of my control; unless Linux is guarding me against my dodgey code.
I have PSPLink v3.0 OE, according to the PSP's menu (if that info is of any use).
I'll try pspfpu_set_enable(0) |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Thu Aug 07, 2008 7:39 am Post subject: |
|
|
| It isn't divide by zero, it is probably uninitialised float as you say. The IUV indicates the "error" flags set. See http://forums.ps2dev.org/viewtopic.php?t=8688 which was exactly the same type of error. |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Thu Aug 07, 2008 10:05 am Post subject: |
|
|
I was informed previously that Cause - 0x1000003C is a division by zero.
Was I mis-informed? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Thu Aug 07, 2008 10:15 am Post subject: |
|
|
0x1000003C
--------------
1 = coprocessor 1 (FPU)
3C = ExcCode of 0xf = FPE (Floating Point Exception)
I don't think the dump you posted above shows the FP status register to see what kind of FPE it is. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Thu Aug 07, 2008 3:13 pm Post subject: |
|
|
| Sigh, hence why I add (IUV) to tell you ;) |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Thu Aug 07, 2008 4:55 pm Post subject: |
|
|
| TyRaNiD wrote: | | Sigh, hence why I add (IUV) to tell you ;) |
AH! I was wondering what that was for. :) |
|
| Back to top |
|
 |
GlennNZ
Joined: 13 Jan 2007 Posts: 25
|
Posted: Wed Aug 13, 2008 7:01 am Post subject: |
|
|
How do I go about getting pspfpu_set_enable(0) to work. The only other post that mentions this method is http://forums.ps2dev.org/viewtopic.php?t=9898&highlight=pspfpusetenable which says to include pspfpu.h
I've done so and put pspfpu_set_enable(0); in my main() method. However, I get
| Code: |
src/main.o: In function `main':
src/main.cpp:68: undefined reference to `pspfpu_set_enable'
collect2: ld returned 1 exit status
make: *** [Apollonia_PSP.elf] Error 1
|
What am I missing? |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Aug 13, 2008 7:30 am Post subject: |
|
|
| Adding -lpspfpu to your LIBS line in your makefile perhaps |
|
| Back to top |
|
 |
GlennNZ
Joined: 13 Jan 2007 Posts: 25
|
Posted: Wed Aug 13, 2008 8:30 pm Post subject: |
|
|
Whoops. I thought I'd already tried that. I must have missed out the l again.
Cheers. |
|
| Back to top |
|
 |
|