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
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Feb 23, 2007 11:18 pm
Has thanked: 0
Been thanked: 0

Unhandled exception??

Post by Hiryu »

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?
User avatar
BB Hood
DC Developer
DC Developer
Posts: 189
Joined: Fri Mar 30, 2007 12:09 am
Has thanked: 41 times
Been thanked: 10 times

Re: Unhandled exception??

Post by BB Hood »

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
Has thanked: 0
Been thanked: 0

Re: Unhandled exception??

Post by Hiryu »

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
Has thanked: 0
Been thanked: 0

Re: Unhandled exception??

Post by Hiryu »

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
Has thanked: 0
Been thanked: 0

Re: Unhandled exception??

Post by Hiryu »

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
Has thanked: 0
Been thanked: 0

Re: Unhandled exception??

Post by Hiryu »

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: 5658
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Unhandled exception??

Post by BlueCrab »

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
Has thanked: 0
Been thanked: 0
Contact:

Re: Unhandled exception??

Post by Phantom »

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