开发者

Deliberately crashing an external process under Windows

开发者 https://www.devze.com 2022-12-11 12:08 出处:网络
I would like to synthesise a native code fault. This is so that we can see where in particular some debugging output gets put when that occurrs.

I would like to synthesise a native code fault. This is so that we can see where in particular some debugging output gets put when that occurrs.

Pskill (from Sys-Internals) causes a graceful exit. DotCrash.exe doesn't seem to be available anymore from Microsoft directly.

Is there any way to externally cause a crash in a proc开发者_StackOverflow社区ess?


I've done this before using windbg by:

  1. Starting the process
  2. Attaching to the process with windbg
  3. Setting a breakpoint on one of my app's functions
  4. Running the app until I hit the breakpoint
  5. In windbg setting a local variable to something that will cause an Access Violation (e.g. set a pointer to 0xFFFFFFFF or muck with the register values)
  6. hit f5 and the app should hopefully crash


If what you want is the equivalent of a coredump, drwtsn32 -p ProcessId generates a dump of the current state of a running process. If you have the appropriate debug symbols you can get valuable information.

HTH.


As Nick mentions, this can easily be done via Debugging Tools for Windows - I'd go one step further though, and use cdb (the command-line WinDbg) to script the whole interaction.


If you need dumps at any desired time, you can use Microsoft's free debug diagnostic tool which has a nice UI to do that or on command line drwtsn32 -p processid as recommended by jrbjazz.


You could try using CreateRemoteThread. Using it correctly isn't easy, but making the other process crash should be pretty easy ;-)


Could you install some kind of hook function, or use something like the detours library?

0

精彩评论

暂无评论...
验证码 换一张
取 消