{"id":2754,"date":"2022-08-30T15:27:30","date_gmt":"2022-08-30T15:27:30","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/02\/08\/how-do-i-automate-mini-dump-creation-when-a-c-assertion-fails-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:27:30","modified_gmt":"2022-08-30T15:27:30","slug":"how-do-i-automate-mini-dump-creation-when-a-c-assertion-fails-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-do-i-automate-mini-dump-creation-when-a-c-assertion-fails-collection-of-common-programming-errors\/","title":{"rendered":"How do I automate mini dump creation when a c++ assertion fails?-Collection of common programming errors"},"content":{"rendered":"<p>Create DebugDiag crash rule for your application, add breakpoint with the expression<\/p>\n<pre><code>MSVCR90D!_wassert\n<\/code><\/pre>\n<p>to catch plain assert macro defined in cassert and<\/p>\n<pre><code>MSVCR90D!_CrtDbgReport\n<\/code><\/pre>\n<p>to catch Microsoft debug CRT _ASSERT, _ASSERTE macros,<\/p>\n<pre><code>MSVCR90D!_CrtDbgReportW\n<\/code><\/pre>\n<p>if you are compiling with unicode enabled.<\/p>\n<p>You can find out the needed expression by adding breakpoint for Ntdll!ZwTerminateProcess, pressing abort in assertion failure dialog and looking at stack trace in the generated log (c:\\Program Files\\DebugDiag\\Logs\\).<\/p>\n<p>To get rid of &#8220;Abort, Retry or Ignore&#8221; dialog call<\/p>\n<pre><code>_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);\n<\/code><\/pre>\n<p>somewhere at the application startup (see the detailed _CrtSetReportMode description on MSDN). Unfortunately this works for _ASSERT, _ASSERTE macros only, the _wassert function skips these _Crt mode settings and custom hooks completely.<\/p>\n<p><em>Notes:<\/em><\/p>\n<ol>\n<li>\n<p>MSVCR90D is the library name for CRT that comes with Visual Studio 2008 (for VS2010 it will be MSVCR100D).<\/p>\n<\/li>\n<li>\n<p>You should run the application directly (from Explorer or &#8220;Start Without Debugging&#8221; from Visual Studio) for DebugDiag to have a change to attach to it.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-02-08 15:59:36. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Create DebugDiag crash rule for your application, add breakpoint with the expression MSVCR90D!_wassert to catch plain assert macro defined in cassert and MSVCR90D!_CrtDbgReport to catch Microsoft debug CRT _ASSERT, _ASSERTE macros, MSVCR90D!_CrtDbgReportW if you are compiling with unicode enabled. You can find out the needed expression by adding breakpoint for Ntdll!ZwTerminateProcess, pressing abort in assertion [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2754","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2754"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2754\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}