|
|
 | | From: | Deane Yang | | Subject: | Floating point error | | Date: | Mon, 06 Dec 2004 03:55:07 GMT |
|
|
 | Is there any way to get the debugger to break if a floating point error (overflow, division by zero, etc.) occurs?
|
|
 | | From: | MW Ron | | Subject: | Re: Floating point error | | Date: | Mon, 06 Dec 2004 22:47:00 -0500 |
|
|
 | In article , Deane Yang wrote:
>Is there any way to get the debugger to break >if a floating point error (overflow, division by zero, etc.) >occurs?
I'm Don't have my windows tools but it seems to me that if you have MS Exceptions enabled and break on exceptions that it will stop for these.
Give it a try and let me know.
Ron
-- Metrowerks Community Forum is a free online resource for developers to discuss CodeWarrior topics with other users and Metrowerks' staff -- http://www.metrowerks.com/community --
Ron Liechty - MWRon@metrowerks.com - http://www.metrowerks.com
|
|
 | | From: | Deane Yang | | Subject: | Re: Floating point error | | Date: | Tue, 07 Dec 2004 23:54:26 GMT |
|
|
 | MW Ron wrote: > In article , > Deane Yang wrote: > > >>Is there any way to get the debugger to break >>if a floating point error (overflow, division by zero, etc.) >>occurs? > > > I'm Don't have my windows tools but it seems to me that if you have MS > Exceptions enabled and break on exceptions that it will stop for these. > > Give it a try and let me know. >
I'm not sure if I have the right settings, but in the project settings, under Debugger, there is a panel for x86 Exceptions. I've tried checking the floating point errors, but this did not seem to halt the debugger when the error occurred.
In any case, I somehow managed to fix the error anyway, so the issue has gone away for the moment. I'd still like to know about this, if anyone has an answer.
|
|
 | | From: | Darrin Cardani | | Subject: | Re: Floating point error | | Date: | Sun, 12 Dec 2004 11:04:46 -0600 |
|
|
 | In article , Deane Yang wrote:
> I'm not sure if I have the right settings, but in the project settings, > under Debugger, there is a panel for x86 Exceptions. I've tried checking > the floating point errors, but this did not seem to halt the debugger > when the error occurred. > > In any case, I somehow managed to fix the error anyway, so > the issue has gone away for the moment. I'd still like to know > about this, if anyone has an answer.
That should be how you do it. However, I have found that when writing plugins, for example, the host app will sometimes change the exception handling after the debugger has set it and it will no longer stop on the exceptions you've checked. What I did in that situation was to set the exception handling myself. For example, here's how you unmask the divide by zero and denormal exceptions (I think that's what it was, anyway):
short int status; __asm { fstcw word ptr [status]; // Get the current mask fclex; // Have to clear the current exceptions because we're changing them }
status = status & 0xFFFC; // set the denormal and divide by zero // exceptions to be unmasked
__asm { fldcw word ptr [ status ]; }
Intel's CPU manuals list the flags for each exception.
Darrin
|
|
|