[SOLVED] Strange VLF crash

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

Moderators: cheriff, TyRaNiD

Post Reply
ab5000
Posts: 74
Joined: Tue May 06, 2008 2:37 am

[SOLVED] Strange VLF crash

Post by ab5000 »

Hi.
I ported moonlight's psppacker to PSP. The application uses VLF, but there's a strange crash. Here's the code:

Code: Select all

while&#40;prxSearch&#91;++i&#93; && pathnum < MAXPATHS&#41; &#123;
that's the line causing the crash. prxSearch is an array of paths to search for PRX on the MemoryStick (so then the user can select what prx to compress). pathnum is the number of found PRXs.
prxSearch[0] and prxSearch[1] are valid paths, prxSearch[2] is NULL, to make the loop break. when it reach the NULL, boom, crash. i start from -1 (I do that to make the loop a bit more compact). the VERY strange thing is that the program also search PBPs, and it's done before PRX search. this line:

Code: Select all

while&#40;gameSearch&#91;++i&#93; && pathnum < MAXPATHS&#41; &#123;
doesn't crash!

here's prxSearch and gameSearch:

Code: Select all

char *gameSearch&#91;&#93; = &#123;
    "ms0&#58;/PSP/GAME/",
    "ms0&#58;/PSP/GAME150/",
    "ms0&#58;/PSP/GAME3XX/",
    "ms0&#58;/PSP/GAME4XX/",
    "ms0&#58;/PSP/GAME5XX/",
    "ms0&#58;/CGAME/",
    NULL
&#125;;

char *prxSearch&#91;&#93; = &#123;
    "ms0&#58;/seplugins/",
    "ms0&#58;/CPRX/",
    NULL
&#125;;
crash details:

Code: Select all

Exception - Bus error &#40;data&#41;
Thread ID - 0x044B665D
Th Name   - user_main
Module ID - 0x044BEB51
Mod Name  - VLF_Module
EPC       - 0x08869C90
Cause     - 0x1000001C
BadVAddr  - 0x00000000
Status    - 0x20088613
zr&#58;0x00000000 at&#58;0xDEADBEEF v0&#58;0x4C505351 v1&#58;0x00000067
a0&#58;0x4C505350 a1&#58;0x00000080 a2&#58;0x4C505350 a3&#58;0x00000000
t0&#58;0x00000086 t1&#58;0x00000000 t2&#58;0x09FB7D00 t3&#58;0x10199999
t4&#58;0xDEADBEEF t5&#58;0x40601999 t6&#58;0x00000000 t7&#58;0xDEADBEEF
s0&#58;0x08B25170 s1&#58;0x4C505350 s2&#58;0x09FB7DB0 s3&#58;0x00000080
s4&#58;0x000000F0 s5&#58;0x08910000 s6&#58;0x00000000 s7&#58;0x000000F0
t8&#58;0xDEADBEEF t9&#58;0x08814F4C k0&#58;0x09FBBF00 k1&#58;0x00000000
gp&#58;0x08893B30 sp&#58;0x09FB7D08 fp&#58;0x08807D94 ra&#58;0x0881CF3C
0x08869C90&#58; 0x90830000 '....' - lbu        $v1, 0&#40;$a0&#41;
the crash is in VLF module. very strange, 'cause when it crash i doesn't call any vlf function...

can somebody help me?
thanks!
Last edited by ab5000 on Wed Aug 12, 2009 6:27 pm, edited 1 time in total.

Code: Select all

%&#58;include<stdio.h>
int _&#40;int __,int ___,int ____,int _____&#41;
<%for&#40;;____<___;_____=_____*__,____++&#41;;
return _____;%>main&#40;&#41;<%printf
&#40;"%d\n",_&#40;2,5,0,1&#41;&#41;;%>
Mon Ouïe
Posts: 36
Joined: Sun Jul 05, 2009 10:22 pm

Post by Mon Ouïe »

I have never used the vlf, but you should use psplink. You'll get a better backtrace (because you'll be able to use gdb).
ab5000
Posts: 74
Joined: Tue May 06, 2008 2:37 am

Post by ab5000 »

Mon Ouïe wrote:I have never used the vlf, but you should use psplink. You'll get a better backtrace (because you'll be able to use gdb).
i use psplink, but i cannot make psp-gdb work. the program start ONLY if it's a prx, and even if i compile with -g no debugging symbol are in prx.

EDIT: i figured out it. psplink only loads prx. to debug a prx just load the prx in pspslink and the elf in psp-gdb
EDIT2: it doesn't work. breakpoints gets detected by psplink, but psp-gdb is still "continuing."... :(

Code: Select all

%&#58;include<stdio.h>
int _&#40;int __,int ___,int ____,int _____&#41;
<%for&#40;;____<___;_____=_____*__,____++&#41;;
return _____;%>main&#40;&#41;<%printf
&#40;"%d\n",_&#40;2,5,0,1&#41;&#41;;%>
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

I use eclipse as graphical GDB ... thing.

here

There is described how to do it.

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
ab5000
Posts: 74
Joined: Tue May 06, 2008 2:37 am

Post by ab5000 »

jojojoris wrote:I use eclipse as graphical GDB ... thing.

here

There is described how to do it.
thanks.

Code: Select all

%&#58;include<stdio.h>
int _&#40;int __,int ___,int ____,int _____&#41;
<%for&#40;;____<___;_____=_____*__,____++&#41;;
return _____;%>main&#40;&#41;<%printf
&#40;"%d\n",_&#40;2,5,0,1&#41;&#41;;%>
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Sure its not something within the loop? Can't say unless you post more code.
ab5000
Posts: 74
Joined: Tue May 06, 2008 2:37 am

Post by ab5000 »

Torch wrote:Sure its not something within the loop? Can't say unless you post more code.
I did more debug, it was an error in a centralMenu ;)

Code: Select all

%&#58;include<stdio.h>
int _&#40;int __,int ___,int ____,int _____&#41;
<%for&#40;;____<___;_____=_____*__,____++&#41;;
return _____;%>main&#40;&#41;<%printf
&#40;"%d\n",_&#40;2,5,0,1&#41;&#41;;%>
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Post by bkc »

this:

Code: Select all

while&#40;prxSearch&#91;++i&#93; && pathnum < MAXPATHS&#41; &#123;
should be:

Code: Select all

while&#40;prxSearch&#91;++i&#93; && &#40;pathnum < MAXPATHS&#41;&#41; &#123;
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

That won't make any difference. < has a higher precedence than &&.

Jim
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Its && not &. There's no other way to evaluate it other than (prxSearch[++i] && (pathnum < MAXPATHS))

Does (prxSearch[++i] && pathnum) even return a value that can be compared with < ?
Post Reply