Unhandled exception??

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
Hiryu
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 16
Joined: Fri Feb 23, 2007 11:18 pm

Unhandled exception??

Post by Hiryu » Fri Jul 06, 2007 3:04 pm

Adding some more code to my program causes this (I'm using dc-load if it matters):
Unhandled exception: PC 8c015ca4, code 1, evt 0100

This is code that works (it's copy/pasted from elsewhere). Any idea what's going on?
BB Hood
Insane DCEmu
Insane DCEmu
Posts: 166
Joined: Fri Mar 30, 2007 12:09 am

Re: Unhandled exception??

Post by BB Hood » Fri Jul 06, 2007 4:15 pm

Well I read in another thread that you have a BBA. I also have a BBA and I may have encoutered this same problem but im not sure. Do you upload a .bin or a .elf to the dreamcast?

Are you using DC-Tool Gui-2.0?
Hiryu
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 16
Joined: Fri Feb 23, 2007 11:18 pm

Re: Unhandled exception??

Post by Hiryu » Fri Jul 06, 2007 4:41 pm

I'm using "make run", which runs dc-tool -x whatever.bin

I just tried with the .elf, made no difference.
Hiryu
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 16
Joined: Fri Feb 23, 2007 11:18 pm

Re: Unhandled exception??

Post by Hiryu » Fri Jul 06, 2007 4:53 pm

mat_store(&matrix)

That seems to be at the root of it. I have a few calls to this function, but the one that crashes it seems to depend on the alignment of the planets and whether I've sacrificed a goat or a chicken.
Hiryu
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 16
Joined: Fri Feb 23, 2007 11:18 pm

Re: Unhandled exception??

Post by Hiryu » Fri Jul 06, 2007 7:31 pm

Looks like fflush(stdout) wasn't getting my output out before my program crashes.

I seem to crash there.
if(state != NULL && timer < timer_ms_gettime64()) {
Hiryu
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 16
Joined: Fri Feb 23, 2007 11:18 pm

Re: Unhandled exception??

Post by Hiryu » Fri Jul 06, 2007 8:20 pm

I think maybe I figured out the problem.

Is there a limit on the dreamcast/kos stack size? Once I made a few variables global, things weren't breaking for random things.

I remember having a smiliar issue on SPARC last fall.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5335
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Contact:

Re: Unhandled exception??

Post by BlueCrab » Sat Jul 07, 2007 1:35 am

I don't think there's any artificial limit on the stack size, and if it was a problem with your program overrunning the stack, you probably would've gotten something else about it (something to the effect of "About to overrun kernel stack, aborting").

As for what the exception code that it gave you means, a quick check of the SH4 Programming Manual (great thing to have around, by the way) tells me that it is a "Data Address Error (write)".

My guess is that you're trying to write a longword to a non-longword aligned boundary, or a word to a non-word aligned boundary. That's generally what causes problems like that (considering your code isn't running in user mode, there's only one other possibility: writing a quadword to a non-quadword aligned boundary). Check any memory access that is going on, and make sure you're not doing anything completely wrong around that area.
Phantom
DC Developer
DC Developer
Posts: 1753
Joined: Thu Jan 16, 2003 4:01 am
Location: The Netherlands
Contact:

Re: Unhandled exception??

Post by Phantom » Thu Jul 12, 2007 3:52 am

Hiryu wrote:I think maybe I figured out the problem.

Is there a limit on the dreamcast/kos stack size? Once I made a few variables global, things weren't breaking for random things.

I remember having a smiliar issue on SPARC last fall.
The stack size for the main program has no fixed limit. Threads however are limited at 8K.
"Nothing works" - Catweazle
Post Reply