开发者

What tool can I use to catch all the inputs that cause an application to crash?

I need a Windows tool that records inputs and debugging information that cause program's crashing. I don't mean a fuzzing software tool! For example, let me describe a scenario to explain what I'm talking about.

Sometimes while using a program, it will crash without a known reason, and when I want to debug it, I can't find helpful informations to know how the crash happened because the data that caused开发者_StackOverflow中文版 the crash no longer exists anywhere.

So I need a tool records all the inputs and debugging information to be able to reuse the input data and reproduce the crash under a debugger like Immunity Debugger and OllyDbg in order to understand how the crash happened.

EDIT: I need to be able to do this for a program that I did not write. Assume that I do not have access to view or modify its source code.


What compiler/IDE are you using?

Chances are, it includes a debugger that you can attach to any running process (like your application), whether you started it from within the IDE or not. This will allow you to see the current values of variables and present you with a stack trace (or helpful diagnostic information) whenever your program crashes unexpectedly. The debugger that comes with Visual Studio is particularly good, if you're developing a C++ or .NET application.

Another option is to implement extensive logging functionality in your application. You can write out detailed information about the program's current state at periodic intervals to a file or into the Windows Event Log, and then examine this information after a crash. This is particularly helpful if you're trying to debug errors that occur at a client's site because they can just send you the log file to analyze.

If you're talking about recording a particular set of user input that is causing your application to crash, logging is probably the best option.

There are some logging libraries you can use to make this job easier. Without knowing what language you're working in, however, it's difficult to make specific recommendations. For example, if you're developing a .NET application, Log4Net is an excellent choice. I've heard good things about Log4j for Java development. log4cxx is an option for C++ apps. Also see this question concerning best practices.


I guess the stack trace must help you to debug the issue. You can use

windbg

or

Debugdiag

tool to get the crash dumps. I have found that really useful


You told that you have to debug a code that you didn't write having no code to see.
In my experience it's not so easy but...
You can configure drwtsn32, if still present on you S.O., to write output files when the program crashes.

Old styled output is drtwsn32.log (Windows Version from NT 4.0 to actual Windows 7 places that file in different location on disk, just look around for that file) that gives you the stack trace, registries and a small amout of memory dump. Acutally you should have the .map file of the original program in order to identify the function that crashes and even the line of code in which the crashes occur (there's a handy method I started using a long time ago... but you need a full MAP file).

More recent version of drwtsn32 produce a set o files. They ar

  • appcompat.txt
  • manifest.txt
  • program.exe.hdmp
  • program.exe.mdmp

They are memory and process dump. Open it with a Microsoft IDE/Debugger as Visual Studio 2008/2010 and see.
It shows the full call stack, memory status, all registries and so on. If you also have the .pdb file of the program that crashes, you should be able to know which is the funcion and the code line but... without source file you're running in darkness, I guess.

So... MAP file or PDB file should be present or I think you'll face a very hard work.

HTH

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜