none
Random Floating Point Exceptions in Visual Studio 2013 Debugger after Applying Fix 'n Continue RRS feed

  • Question

  • Since upgrading to Visual Studio 2013, I find that after applying Fix 'n Continue in the debugger I often get a random floating point exception elsewhere in my code when I resume execution.  I have update 3, but earlier versions did the same.

    This is disruptive as the debugging session has to be restarted.  Does anyone know anything about this?  I was using VS 2005 before, and this was fine in this regard.  I am debugging native C++.  Thanks.


    Paul Sanders


    • Edited by Paul Sanders Thursday, September 4, 2014 4:05 PM
    Thursday, September 4, 2014 4:03 PM

All replies

  • Hi Paul,

    Thank you for posting in the MSDN forum.

    >> I find that after applying Fix 'n Continue in the debugger I often get a random floating point exception elsewhere in my code when I resume execution.

    Do you mean that you use “Edit and Continue” in debugging? What real exception did you get? Could you share us a screen shot about it?

    You know that VS2005 was a really old version, actually we didn’t support it, and maybe you could use other VS version like VS2010/VS2012 to test it.

    As you said that it worked well in VS2005, but it has this issue in VS2013, am I right?

    If so, my understanding is that you update the same VS2005 old project using VS2013, before you debug it, please clean and rebuild your project in VS2013, we need to make sure that it updated successfully. You know that sometimes it would generate the compiled error or warnings in Error List/Output Window. We need to resolve them one by one.

    If I have misunderstood this issue, please make free feel to let me know.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Friday, September 5, 2014 8:35 AM
    Moderator
  • Hi,

    Thanks for getting back to me.  Yes, I mean Edit and Continue, sorry (Fix 'n Continue is Mac-speak, although they no longer support it).

    The project was indeed migrated from VS 2005 to VS 2013, although I don't think that's relevant.  Any build issues are long-since resolved and the project has been cleaned and rebuilt several times.

    The exact nature of the exception seems to vary, although it always pertains to floating point.  'Multiple floating point exceptions' is one I remember.  Next time it happens, I will post a screenshot.


    Paul Sanders

    Friday, September 5, 2014 12:59 PM
  • OK, here's your screenshot:

    And here's the corresponding disassembly:

    As you can see, the instruction which has faulted is inside the runtime library's ftol (floating point-to-long) routine.  The calling source code looks like this:

    void CallVolumeChangeNotify (float vol)
    {
        if (this->vcn)
        {
            int ivol = (int) (vol * 1000 + 0.5);  << Failing instruction
            this->vcn (this->context, ivol);
        }
    }

    And the value of 'vol' is 1, so there's no reason for the code to fault.  Indeed, it doesn't, except after applying Edit and Continue.  Something inside the debugger or execution state (of the floating point unit, one might infer) is messed up.

    I should add that the change I made to the source before applying code changes was far away from the faulting instruction, so the cause of this, whatever it is, is not directly related to the code change I made.

    Hope this helps.


    Paul Sanders





    Friday, September 5, 2014 5:41 PM
  • Hi Paul,

    Maybe you could check whether it would be related to the different settings in your two VS version.

    Please check the Exception option in your debug menu and then debug settings in TOOLS->Options->Debugging, and then compare them in two VS versions.

    http://stackoverflow.com/questions/16970642/visual-studio-not-breaking-on-user-unhandled-exceptions

    In addition, as far as I know, sometimes the Edit and Continue is not available for the type of code changes you have made.

    Reference:

    http://msdn.microsoft.com/en-us/library/vstudio/038k33cz(v=vs.100).aspx

    Not the real VC++ exception, but to resolve this unhandled exception, I suggest you post this issue to the VC++ forum like this thread:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/effd3c4a-725c-4096-9998-e0692b1bf071/how-to-solve-unhandled-exception-error-when-using-visual-c-2008?forum=vcgeneral , and there you would get dedicated support. Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Monday, September 8, 2014 2:23 AM
    Moderator
  • Hi Jack,

    Thanks, but I have checked all of that and it's none of those things.  The problem runs deeper than that, and I have now reproduced it on a small sample project which you can download from here:

    http://www.alpinesoft.co.uk/private/EandCblues.zip

    To reproduce the problem, proceed as follows:

    1.  Rebuild the project (to recreate the .pdb file).

    2.  Put a breakpoint on line 19 'float f = 1;' in file source.cpp

    3.  Start debugging.

    4.  When the breakpoint is hit, go to the disassembly window and single step one instruction.

    5.  Go back to source.cpp and edit line 21 'f = sqrt (f);' to read f = sqrt (f + 1);

    6.  Apply code changes.

    7.  Resume execution.

    As often as not, you get a floating point stack check exception and if you look at the floating point registers in the registers window, they appear scrambled.

    I realise this is very artificial, but the same sequence of operations in VS 2005 works correctly.   Perhaps this has some bearing on the errors I see when debugging my application.  It's my guess that the VS 2013 debugger doesn't always save and restore the state of the floating point unit correctly when applying code changes.

    I hope this is helpful.


    Paul Sanders

    Monday, September 8, 2014 4:00 PM
  • Hi Paul,

    I got the result like the following screen shot.

    It seems that it need to locate the specific source file.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Tuesday, September 9, 2014 11:59 AM
    Moderator
  • Hi,

    No, that's not relevant.  That source file is not supplied with VS, so you have to work with the disassembly.  But the problem I am reporting occurs outside that file anyway.


    Paul Sanders

    Tuesday, September 9, 2014 12:11 PM
  • Hi Paul,

    >>

    1.  Rebuild the project (to recreate the .pdb file).

    2.  Put a breakpoint on line 19 'float f = 1;' in file source.cpp

    3.  Start debugging.

    4.  When the breakpoint is hit, go to the disassembly window and single step one instruction.

    5.  Go back to source.cpp and edit line 21 'f = sqrt (f);' to read f = sqrt (f + 1);

    6.  Apply code changes.

    7.  Resume execution.

    <<

    I debug it in my side as your steps.

    I got the message box like this screen shot.

    If I click Ok, and then debug it with Step Into, I couldn’t get the exception windows as yours.

    If you debug this app in other VS2013 machine, whether it has the same issue?

    Please reset your VS settings, debug it again. So we could use the default settings of the VS IDE.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Wednesday, September 10, 2014 6:45 AM
    Moderator
  • Hi Jack,

    Thanks for getting back to me.  From the message, it looks like you didn't rebuild the project.  If I rebuild it, I don't get that.  Or it could be that you have the source file that I am missing (ftol.asm) and it is newer than the run time library I linked with.  But that doesn't matter, you don't need that file.

    Going by your disassembly window screenshot, I don't think you breakpointed / single stepped in the same place i did.  The breakpoint should be here:

    Then go to disassembly mode and single step one machine instruction to get to here:

    Now go back to source.cpp and edit 'f = sqrt (f)'  to read 'f = sqrt (f + 1)', apply code changes and resume execution.  Hopefully, you will then see the same problem ('floating point stack check') that I saw.

    I don't have another machine to test on, unfortunately.  Sorry about that.  And I don't understand what you mean by 'reset your VS settings'.  How would I do that (not that I want to)?


    Paul Sanders

    Wednesday, September 10, 2014 11:02 AM
  • Hi Paul,

    (1)I could get the result like the following screen shot:

    (2) I edit 'f = sqrt (f)'  to read 'f = sqrt (f + 1)', apply code changes,  resume execution(It means that I use the "step Into" to debug it in the disassembly windows

    Reset VS settings:

    http://msdn.microsoft.com/en-us/library/ms247075(v=vs.90).aspx

    Maybe you could run your VS in safe mode, or you could repair your VS, test it again.

    If still no help, since I couldn't repro this issue in my side, to get the issue confirmed and diagnose by product team, would you please create connect report for it? You will get email notification for update.http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx

    If I have misunderstood this issue, please make free feel to let me know.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Thursday, September 11, 2014 2:11 AM
    Moderator
  • Hi Jack,

    Thanks for this.  When you resume execution, use 'Continue' from the Debug menu (or F5) rather then step into.  Then you should see it.  Note that you might not get exactly the same error I did - it seems to vary, with no rhyme or reason to it.

    I reset my VS settings - no change, even after rebuilding the project.


    Paul Sanders

    Thursday, September 11, 2014 8:52 AM
  • Hi Paul,

    Thanks for your friendly response.

    I also test it again, but really sorry for that I couldn't repro this issue in my side, if I click "Continue", I would get "Disassembly cannot be displayed in run mode" message.

    Since I couldn't repro this issue, as my previous reply, to really help you resolve this issue, would you mind submitting a report? I think we could get better response from the product team experts directly.

    http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx

    You could share this project in your connect report, so it would be helpful for the product team experts to repro/troubleshoot this issue.

    If there's any concern, please feel free to let me know.

    Sincerely,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Sunday, September 14, 2014 5:13 AM
    Moderator
  • OK, I will do that.  Thanks for all your efforts.

    Paul Sanders

    Monday, September 15, 2014 11:50 AM
  • OK, I will do that.  Thanks for all your efforts.

    Paul Sanders

    Thanks for supporting my work, if you submit it, please share us the report link here, so we could also get the latest information from the product team expert directly.

    Have a nice day,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, September 16, 2014 2:48 AM
    Moderator
  • was there ever a resolution to this?  I get pretty much the same thing. Random VS2013 floating point exceptions because I stop at a breakpoint that may or may not have code using floats.  
    Wednesday, September 11, 2019 5:03 PM
  • was there ever a resolution to this?  I get pretty much the same thing. Random VS2013 floating point exceptions because I stop at a breakpoint that may or may not have code using floats.  
    Not that I know of, no.  I have long since moved on to Visual Studio 2017 and the probelm is resolved there.

    Paul Sanders

    Wednesday, September 11, 2019 6:36 PM