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 

Routine works on PC, crashes on PSP.. Why?

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



Joined: 09 Nov 2005
Posts: 647

PostPosted: Wed Sep 23, 2009 4:58 pm    Post subject: Routine works on PC, crashes on PSP.. Why? Reply with quote

Hi Guys,
I spent a lot of time debugging a routine that runs through files and converts
strings to floats, sorting, indexing, and other things.

The PSP version runs well for a while on some particular files, and crashes
in the same place every time.

The same routine running on my PC with identical array sizes, endian-ness, etc. processes the entire files fine.

I'm stumped as to why a very standard and straight forward operation would
work on one platform and not another.

The only difference is the PC version writes to another RAM buffer, and the PSP writes direct to MS.
Many files do work on the PSP version though, and give expected results.

Would the potential time spent in while loops crash the PSP?
Any other ideas?
Cheers, Art.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Wed Sep 23, 2009 5:52 pm    Post subject: Reply with quote

Stack overflow?
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Wed Sep 23, 2009 8:08 pm    Post subject: Reply with quote

That or memory corruption.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
jbit
Site Admin


Joined: 28 May 2005
Posts: 293
Location: København, Danmark

PostPosted: Wed Sep 23, 2009 8:49 pm    Post subject: Reply with quote

Alignment?
Back to top
View user's profile Send private message Visit poster's website
Coldbird



Joined: 08 Feb 2007
Posts: 155

PostPosted: Thu Sep 24, 2009 10:13 am    Post subject: Re: Routine works on PC, crashes on PSP.. Why? Reply with quote

Art wrote:
Would the potential time spent in while loops crash the PSP?

Yup... the PSP loves to nuke itself if a loop is repeating itself too fast. Mostly becaue of CPU hogging...

Try to place a sceKernelDelayThread(100); inside your loop somewhere and see if that fixes your problems.
_________________
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
Back to top
View user's profile Send private message MSN Messenger
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Sep 24, 2009 1:51 pm    Post subject: Reply with quote

Thanks for the replies guys.
I have a feeling the length of time spent in a while loop is causing it
because it's crashing when the array is larger, and execution is hanging
around in a while loop longer.

I'll try the delay first up since it seems to fit.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Thu Sep 24, 2009 5:18 pm    Post subject: Reply with quote

You haven't mentioned the kind of crash at all. If you are sure that the program was executing all the while until the second it powered off then its because the loop is too long. You need to delay thread. If it crashed ten seconds before powering off then its another error.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Sep 24, 2009 10:39 pm    Post subject: Reply with quote

Well the delay didn't help. It crashes in the same place.
Yes it stops ten seconds or so before powering off.

I don't think alignment is a problem since it's only dealing with an array of bytes
where floats expressed in ascii text are converted to floats expressed as four bytes
(using a few float variables to do the conversions).
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Coldbird



Joined: 08 Feb 2007
Posts: 155

PostPosted: Fri Sep 25, 2009 1:19 am    Post subject: Reply with quote

Would you be so kind and pastebin the code?
Theory is nice and good but... actual code would be better.
_________________
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
Back to top
View user's profile Send private message MSN Messenger
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Fri Sep 25, 2009 1:32 am    Post subject: Reply with quote

Does it crash when running under gdb & psplink debugger ?
If not try to seek for unitialize variable ;) . Under your pc and under the debugger
normaly all memory zone are set to 0x00.

Pointer's are good candiate for this type of behavior's
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri Sep 25, 2009 3:15 am    Post subject: Reply with quote

On the PC, run it under valgrind to find memory corruption bugs.
Back to top
View user's profile Send private message
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