Create/load core dump for debugging

  • Thread starter Thread starter Chris Stankevitz
  • Start date Start date
C

Chris Stankevitz

My app reliably dies after a long time. I would like to dump core before it
dies, and use that core as a starting point in debugging to save me from
having to spend so much time waiting.

Is this possible? I suppose I could run my entire IDE inside a vmware
virtual machine?

Thanks for your help,

Chris
 
Chris Stankevitz said:
My app reliably dies after a long time. I would like to dump core before
it dies, and use that core as a starting point in debugging to save me
from having to spend so much time waiting.

Is this possible? I suppose I could run my entire IDE inside a vmware
virtual machine?

I guess you could do that.

Alternatively, you can create a minidump of your application's space and
then start the debugger from there.

There is an article by one of the developers on the topic here:

http://www.codeproject.com/debug/po...1.asp?df=100&forumid=3419&exp=0&select=924608

and another one by a "cilvilian" <g> here:

http://www.codeproject.com/tools/minidump.asp

Just by the way, one of the reasons for a slient application death is a
trashed or exhausted stack. I think there are case in which the stack is so
messed up that exception handlers and whatnot can simply not run.

Regards,
Will
 
William DePalo said:
Just by the way, one of the reasons for a slient application death is a
trashed or exhausted stack. I think there are case in which the stack is
so


Thanks Will. In my case I want to "dump" before the crash (when everything
is okay).

Chris
 
Chris Stankevitz said:
Thanks Will.

You are welcome.
In my case I want to "dump" before the crash (when everything is okay).

Then you call MiniDumpWriteDump() when you need to.

There's a bit of Heisenberg uncertainty <g> here in that the call stack for
the calling thread is not preserved.

So, at first I was tempted to say that what you'd need to do is have a
background thread in your application periodically writing the dump. But
then I fear that reading the dump for problem resolution would also restore
the thread that writes the dump, gumming up the works.

Regards,
Will
 
Then you call MiniDumpWriteDump() when you need to.

There's a bit of Heisenberg uncertainty <g> here in that the call stack for
the calling thread is not preserved.

It is possible to preserve the call stack of the calling thread with the help
of an exception (use a filter to catch it and write the minidump with
exception information). For example, as shown here:
http://www.codeproject.com/debug/XCrashReportPt3.asp

Also it is of course possible to create minidumps using another application,
e.g. as here:
http://www.debuginfo.com/articles/easywindbg2.html#savedumps
So, at first I was tempted to say that what you'd need to do is have a
background thread in your application periodically writing the dump. But
then I fear that reading the dump for problem resolution would also restore
the thread that writes the dump, gumming up the works.

That still would work, since minidumps save information about all threads
in the process (unless you explicitly ask MiniDumpWriteDump not to save it).

Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]
 
Back
Top