views:

115

answers:

7

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 process?

A: 

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

the_mandrill
A: 

Do you want to be able to crash any process or do you want a crashing process. It trivial to write some c code that will crash. What information are you tiring to get.

rerun
+2  A: 

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.

jrbjazz
A: 

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
nick
A: 

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.

Paul Betts
A: 

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.

Samrat Patil
A: 

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

nikie