Changes between Version 8 and Version 9 of AppDebugWin


Ignore:
Timestamp:
Aug 7, 2008, 6:13:54 AM (16 years ago)
Author:
romw
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppDebugWin

    v8 v9  
    231231Starting with Visual Studio 2005, Microsoft re-vamped the whole C Runtime Library.  Part of the re-vamp process was to do parameter checking on each function.  Places that would normally return a NULL value now cause a structured exception to be thrown.
    232232
    233 The nature of this structured exception is different than most as they specifically coded it so that it will not engage the BOINC Runtime Debugger and it'll display a dialog box asking the user if they wish to debug the error. If the user cancels the error code 0xc000000d is returned without any more information.
    234 
    235 To get more information with this error you'll need to create a function like this:
    236 
    237 {{{
    238 #ifdef _WIN32
    239 void AppInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line,     uintptr_t pReserved ) {
    240         fprintf(
    241                 stderr,
    242                 "Invalid parameter detected in function %s. File: %s Line: %d\n",
    243                 function,
    244                 file,
    245                 line
    246         );
    247         fprintf(
    248                 stderr,
    249                 "Expression: %s\n",
    250                 expression
    251         );
    252         // Cause a Debug Breakpoint.
    253         DebugBreak();
    254 }
    255 #endif
    256 }}}
    257 
    258 The following code block should be added after the call to boinc_diagnostics_init():
    259 
    260 {{{
    261 #ifdef _WIN32
    262         // Every once and awhile something looks at a std::vector or some other
    263         // CRT/STL construct that throws an exception when an invalid parameter
    264         // is detected.  In this case we should dump whatever information we
    265         // can and then bail.  When we bail we should dump as much data as
    266         // possible.
    267         _set_invalid_parameter_handler(AppInvalidParameterHandler);
    268 #endif
    269 }}}
    270 
    271233When this issues happens in the future it'll describe which CRT function call was passed an invalid parameter and it should dump out the callstack for all threads.
    272 
    273 The function blocks above overwrite the default behavior of the CRT when an invalid  parameter is detected.
    274234
    275235=== Privileged Instruction (0xc0000096) ===