<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Mini Dump erstellen will nicht so richtig klappen]]></title><description><![CDATA[<p>Ich möchte mit Hilfe der dbghelp.dll ein Mini Dump erstellen, allerdings nicht nur wenn eine Ausnahme auftritt sondern jederzeit (also auch wenn eine c++ Ausnahme auftritt, oder einfach so)</p>
<p>Meine Funktion(en) die das tun sehen so aus:</p>
<pre><code class="language-cpp">void MiniDumpWriteHelper( HANDLE fh, EXCEPTION_POINTERS* excepPtrs )
{
	if( !excepPtrs ) //If we have no exception information we have to raise
	{				 //an exception to get proper exception information for
		__try		 //our dump
		{
			RaiseException( EXCEPTION_BREAKPOINT, 0, 0, NULL );
		}
		__except( MiniDumpWriteHelper( fh, GetExceptionInformation() ),
				EXCEPTION_CONTINUE_EXECUTION )
		{
		}
	}
	else
	{
		MINIDUMP_EXCEPTION_INFORMATION exInfo;
		exInfo.ThreadId = GetCurrentThreadId();
		exInfo.ExceptionPointers = excepPtrs;
		exInfo.ClientPointers = false;

		if( !MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(),
								fh,	MiniDumpNormal, &amp;exInfo, NULL, NULL ) )
		{
			assert( 0 &amp;&amp; &quot;Could not write the mini dump.&quot; );
		}
	}
}

void WriteMiniDump( const std::string&amp; path, _EXCEPTION_POINTERS* excepPtrs = NULL )
{
	string fileName( path );
	fileName += &quot;\\dump.dmp&quot;;

	HANDLE fh = CreateFile( fileName.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE,
							NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );

	if( fh == INVALID_HANDLE_VALUE )
	{
		assert( 0 &amp;&amp; &quot;Could not create the file for the mini dump.&quot; );

		return;
	}

	MiniDumpWriteHelper( fh,  excepPtrs );

	CloseHandle( fh );
}
</code></pre>
<p>Ich rufe die Funktion, dann einfach mit Default-Parameter auf und möchte selber eine Ausnahme auslösen um an die exception pointers zu kommen, allerdings klappt das nicht so ganz, wenn der Debugger mitläuft passiert nichts und ohne bekomme ich ne Fehlermeldung, dass der Wert im ESP-Register nicht richtig gespeichert werden konnte über einen Funktionsaufruf hinweg (kommt nachdem bei RaiseException weitergemacht wird).</p>
<p>Wie kann ich nen Mini Dump &quot;richtig&quot; bzw. erfolgreich erstellen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/154131/mini-dump-erstellen-will-nicht-so-richtig-klappen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 09:34:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/154131.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Jul 2006 17:12:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mini Dump erstellen will nicht so richtig klappen on Mon, 24 Jul 2006 17:12:12 GMT]]></title><description><![CDATA[<p>Ich möchte mit Hilfe der dbghelp.dll ein Mini Dump erstellen, allerdings nicht nur wenn eine Ausnahme auftritt sondern jederzeit (also auch wenn eine c++ Ausnahme auftritt, oder einfach so)</p>
<p>Meine Funktion(en) die das tun sehen so aus:</p>
<pre><code class="language-cpp">void MiniDumpWriteHelper( HANDLE fh, EXCEPTION_POINTERS* excepPtrs )
{
	if( !excepPtrs ) //If we have no exception information we have to raise
	{				 //an exception to get proper exception information for
		__try		 //our dump
		{
			RaiseException( EXCEPTION_BREAKPOINT, 0, 0, NULL );
		}
		__except( MiniDumpWriteHelper( fh, GetExceptionInformation() ),
				EXCEPTION_CONTINUE_EXECUTION )
		{
		}
	}
	else
	{
		MINIDUMP_EXCEPTION_INFORMATION exInfo;
		exInfo.ThreadId = GetCurrentThreadId();
		exInfo.ExceptionPointers = excepPtrs;
		exInfo.ClientPointers = false;

		if( !MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(),
								fh,	MiniDumpNormal, &amp;exInfo, NULL, NULL ) )
		{
			assert( 0 &amp;&amp; &quot;Could not write the mini dump.&quot; );
		}
	}
}

void WriteMiniDump( const std::string&amp; path, _EXCEPTION_POINTERS* excepPtrs = NULL )
{
	string fileName( path );
	fileName += &quot;\\dump.dmp&quot;;

	HANDLE fh = CreateFile( fileName.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE,
							NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );

	if( fh == INVALID_HANDLE_VALUE )
	{
		assert( 0 &amp;&amp; &quot;Could not create the file for the mini dump.&quot; );

		return;
	}

	MiniDumpWriteHelper( fh,  excepPtrs );

	CloseHandle( fh );
}
</code></pre>
<p>Ich rufe die Funktion, dann einfach mit Default-Parameter auf und möchte selber eine Ausnahme auslösen um an die exception pointers zu kommen, allerdings klappt das nicht so ganz, wenn der Debugger mitläuft passiert nichts und ohne bekomme ich ne Fehlermeldung, dass der Wert im ESP-Register nicht richtig gespeichert werden konnte über einen Funktionsaufruf hinweg (kommt nachdem bei RaiseException weitergemacht wird).</p>
<p>Wie kann ich nen Mini Dump &quot;richtig&quot; bzw. erfolgreich erstellen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1103336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1103336</guid><dc:creator><![CDATA[thomas r.]]></dc:creator><pubDate>Mon, 24 Jul 2006 17:12:12 GMT</pubDate></item><item><title><![CDATA[Reply to Mini Dump erstellen will nicht so richtig klappen on Mon, 24 Jul 2006 17:56:00 GMT]]></title><description><![CDATA[<p>Hab es jetzt so weit, dass es läuft wenn ich ne &quot;echte&quot; Ausnahme habe und, wenn ich als Parameter für MiniDumpWriteDump NULL übergebe als INIDUMP_EXCEPTION_INFORMATION läuft es jetzt auch ohne Fehler aber da ist das Dump irgendwie nicht richtig, also ich habe da im Callstack nur Informationen über RaiseException und sonst nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1103359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1103359</guid><dc:creator><![CDATA[thomas r.]]></dc:creator><pubDate>Mon, 24 Jul 2006 17:56:00 GMT</pubDate></item></channel></rss>