Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. floating point error handler - how do I get a workable stackframe?

floating point error handler - how do I get a workable stackframe?

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingtutorialquestionc++data-structures
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sysop HAL9K com
    wrote on last edited by
    #1

    Dear folks, We have a perfectly good FP error handler on VC7.1, VC8 and so on. However, none of the stack is visible if we set a breakpoint inside the FP handler. So basically we have no idea where the offending code is that is causing the FP error to fire. Any ideas on how to get a usable stack inside (or outside) the debugger? An example of the stack:

    > MyProgram.exe!IeeeFPHandler(_FPIEEE_RECORD * pieee=0x0012ec10)
    Line 168 C++
    msvcr71.dll!7c3744fa()
    ntdll.dll!7c90e21f()
    kernel32.dll!7c80b9bd()
    kernel32.dll!7c80b9e6()
    msvcr71.dll!7c34d518()
    MyProgram.exe!FPEGuardedExecution(int (void *)* func=0x0012fe20,
    void * d=0x0012edd4) Line 214 + 0x1d C++
    ntdll.dll!7c9037bf()
    ntdll.dll!7c90378b()
    ntdll.dll!7c937860()
    ntdll.dll!7c91b686()

    and our handler :wtf:

    #ifdef _WIN32

    #include #include #include static int fpWarningCount = 0;
    static int
    IeeeFPHandler( _FPIEEE_RECORD *pieee )
    {
    string s = "Unhandled floating point error";

    if (pieee->Cause.InvalidOperation) {
    s = "Invalid floating point operation";
    }

    if (pieee->Cause.ZeroDivide) {
    s = "Floating point zero divide";
    }

    if (pieee->Cause.Overflow) {
    s = "Floating point overflow";
    }

    if (pieee->Cause.Inexact) {
    s = "Floating point Inexact";
    }

    if (fpWarningCount == 8)
    s += "\nSuppressing further floating point errors";

    if (fpWarningCount <= 8)
    MessageDlg::critical(I18n(s));

    fpWarningCount++;
    return EXCEPTION_CONTINUE_EXECUTION;
    }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups