English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 01 March 2022, 18:50   #1
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
EVALEXCEPTION c0000005!

I'm getting this semi-randomly, but frequently, when I'm calling the motorola ffp library fpa code.

I don't know what to do apart from uploading the dmp and log files here.

I don't know how to debug code that causes the emulator to crash.
Attached Files
File Type: txt winuaelog.txt (18.0 KB, 48 views)
File Type: dmp winuae_x64_4.9.0_R_2022.03.01_18.40.18.dmp (118.0 KB, 58 views)
deimos is offline  
Old 01 March 2022, 19:13   #2
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
Try without JIT and/or try the 32-bit version of WinUAE. Code that crashes the Amiga can crash WinUAE as well in JIT mode in pathological cases (e.g. when it happens in supervisor mode). 32-bit versions seems to at least in some cases handle it better. Without JIT it shouldn't crash and you'll probably see it in some kind of HALT state.
paraj is offline  
Old 01 March 2022, 19:14   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Exe is not official winuae.exe which makes dump file useless.
Does it happen without JIT?
Toni Wilen is online now  
Old 01 March 2022, 19:25   #4
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,216
This is a division by zero exception, which happens if you, err, divide by zero. The later versions of mathffp does not create this exception anymore, but return the largest possible value. Note that IEEE math never returns exceptions, it just returns INF in this case. Unfortunately, the mathFFP model does not define INFs.

FFP should really not be used anymore. It is, as far as numerics are concerned, a pretty bad format and not very robust.
Thomas Richter is offline  
Old 01 March 2022, 19:36   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
No, lets not confuse PC and Amiga exceptions.

Cause is read from 0xFFFFFFFFFFFFFFFF, seems to be caused by CPU jumping to that address. Which usually means JIT is getting confused, possibly caused by stack overrun.
Toni Wilen is online now  
Old 01 March 2022, 19:47   #6
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by Toni Wilen View Post
No, lets not confuse PC and Amiga exceptions.

Cause is read from 0xFFFFFFFFFFFFFFFF, seems to be caused by CPU jumping to that address. Which usually means JIT is getting confused, possibly caused by stack overrun.
I am using the Bartman VS Code extension, so it is a non-official binary, but it has to be that way.

I will try and get my code out to run it in a more approved environment, and following the advice from paraj above, but as the code that seems to be triggering the problem is part of my logging/debugging to the VS Code integration I don't know whether the bug will be reproducible, as it's semi-random as it is.
deimos is offline  
Old 02 March 2022, 12:23   #7
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
I now have a clean install of WinUAE 4.9.1 and have created an A500 configuration, adding a directory backed hard drive (so I can copy my executable over) and enabling the log file. And I can see my logging appearing in the log file too, which is nice.

But I don't understand how to disable the JIT. All those options under CPU are greyed out for me.
deimos is offline  
Old 02 March 2022, 18:28   #8
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
Quote:
Originally Posted by deimos View Post
I now have a clean install of WinUAE 4.9.1 and have created an A500 configuration, adding a directory backed hard drive (so I can copy my executable over) and enabling the log file. And I can see my logging appearing in the log file too, which is nice.

But I don't understand how to disable the JIT. All those options under CPU are greyed out for me.
Sorry misread the logs, I now noticed that JIT wasn't enabled. Anyway, run your code in normal WinUAE (with the same configuration) and see if you can reproduce the crash. If you can't it's an issue with the modified build and you can report it to the VS code people.

I don't know how you output the debug information, but if it isn't compatible you probably want to NOP out the fewest possible instructions (i.e. if it involves some detection code, skip that and just don't do the final "debug output" call).
paraj is offline  
Old 02 March 2022, 19:20   #9
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by paraj View Post
Sorry misread the logs, I now noticed that JIT wasn't enabled. Anyway, run your code in normal WinUAE (with the same configuration) and see if you can reproduce the crash. If you can't it's an issue with the modified build and you can report it to the VS code people.

I don't know how you output the debug information, but if it isn't compatible you probably want to NOP out the fewest possible instructions (i.e. if it involves some detection code, skip that and just don't do the final "debug output" call).
Working on it...

I can reproduce the crash, but its frequency seems to depend on things outside of my view, even back in the environment where it was crashing often. This morning it was crashing within seconds, after leaving the house for a couple of hours the code suddenly became almost stable. All with no code changes.

I do have one very questionable bit of code that I'm looking into rewriting (pushing my assembly skills though), to do with copying the results that the fpa function returns on the stack into a permanent location. I think (know, or suspect, depending on my frame of mind) that this whole returning things on the stack just won't work in supervisor mode, which my code is running in, for better or worse, or if I use this function from within an interrupt, is the same, same thing.

But, if I'm not using an experimental JIT mode, and I can write code that crashes the emulator, then I'd love to help find the information needed to fix it. Or, conversely, I'd love to find a way to make code running on my real Amigas exit to a fill Windows 10 desktop.
deimos is offline  
Old 02 March 2022, 19:36   #10
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Do you mean your config is plain 68000?

Then make sure "more compatible" is ticked because otherwise memory accesses are "more direct" and bad accesses are not always detected (prefers speed than accuracy)

Does this "fix" the crash? (and now emulated Amiga most likely crashes)

Do you see "program did something stupid" or other log messages before the crash? (keep log window open by running winuae with -log command line parameter)
Toni Wilen is online now  
Old 02 March 2022, 20:01   #11
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by Toni Wilen View Post
Do you mean your config is plain 68000?
I've tried not to fiddle.

Quote:
Originally Posted by Toni Wilen View Post
Then make sure "more compatible" is ticked because otherwise memory accesses are "more direct" and bad accesses are not always detected (prefers speed than accuracy)
It's ticked, see attached for all the ticks. I'm struggling to understand the JIT enabling, I don't seem to be able to be able to enable it even if you asked me to.

Quote:
Originally Posted by Toni Wilen View Post
Does this "fix" the crash? (and now emulated Amiga most likely crashes)
The crash is so inconsistent (at the moment) that I can't give a good answer to that.

Quote:
Originally Posted by Toni Wilen View Post
Do you see "program did something stupid" or other log messages before the crash? (keep log window open by running winuae with -log command line parameter)
I will look into running winuae like that, at the moment I'm looking at the log after the fact. But no, I don't see anything that looks like useful information in the logs.

Are programs not allowed to do stupid things?
Attached Thumbnails
Click image for larger version

Name:	winuea-cpuandfpu.png
Views:	62
Size:	96.7 KB
ID:	74927  
deimos is offline  
Old 03 March 2022, 07:21   #12
aros-sg
Registered User
 
Join Date: Nov 2015
Location: Italy
Posts: 191
Quote:
Originally Posted by deimos View Post
this whole returning things on the stack

Don't store stuff at negative offset from stackpointer. Otherwise for example preemptive task switches bite you.
aros-sg is offline  
Old 03 March 2022, 08:11   #13
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by deimos View Post
I'm struggling to understand the JIT enabling, I don't seem to be able to be able to enable it even if you asked me to.
JIT does not work with 68000. To activate it you need at least 68020.
meynaf is offline  
Old 03 March 2022, 09:34   #14
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by meynaf View Post
JIT does not work with 68000. To activate it you need at least 68020.
Thank you.
deimos is offline  
Old 03 March 2022, 09:46   #15
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by aros-sg View Post
Don't store stuff at negative offset from stackpointer. Otherwise for example preemptive task switches bite you.
It's more subtle than that. The code returns stuff on the stack correctly, leaving you to fix the stack pointer to remove it. However, the compiled C code that calls it has its destination variables also on the stack, so the SP is wrong to refer to them. Making the SP correct for them leaves the return value on the wrong side of the SP, which I believe is at least one of my problems.

I have multiple options to fix this. Yesterday I tried to go all in and fix the assembly code to write the return value into a buffer pointed to by A0 rather than on the stack, which would be the nicest solution. That code currently doesn't work, but I will try again before giving up and going for one of my other options.
deimos is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:24.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09207 seconds with 15 queries