0

I need to read the binary file CrashDump.dmp from C#. If I use WinDbg I can read the file and see the content but I don't want to use the GUI because we want to automatically analyze several files.

I want to be able to do the same from C#. It would be good if there is some API for the case.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
tony
  • 127
  • 1
  • 1
  • 7
  • apart from the answer if you want to use pure c# and dont want to use any mdbg or whatever you can refer to this hack i wrote some time back https://github.com/blabberer/chashdbg – blabb Jun 02 '16 at 07:07

1 Answers1

2

You can use cdb instead of WinDbg and run a WinDbg script. In this script, you can use extensions like SOS or PyKd (Python) to get the task done. Such a solution would not even require C# code. This works quite well for kernel dumps or dump files of native applications.

It's also possible to build a debugger in C# using the CLR managed debugger engine, which is also available as a Nuget package. Note that this focuses on .NET applications. You'll probably not get as good results for native applications or kernel dumps.

I found the following tutorial: Writing an automatic debugger in 15 minutes, which might be a good starting point for you.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • FYI: See here for a potential problem analyzing memory: http://stackoverflow.com/questions/37624824/reading-objects-from-memory-with-mdbgeng – Thomas Weller Jun 03 '16 at 23:40