I can trying to figure out how to write a simple debugger for windows. The goal would be to execute a program using CreateProcess() (or if there is something better please let me know), if the program has any bugs which allow us to make it crash (don't all applications have bugs, hence we need debuggers haha) then it would catch the crash and output debugging info such as first chance/second chance, all extended registers values (ebx=, esi for pointers, etc), and if the crash was an access violation, stack overflow, things of that nature. Then, for a bonus, kill the process.

Understand?

I have been scouring the internet for a simple example of a this FOREVER and haven't found anything that would get me running and working code.. I found this but I can't seem to put it together and make it do all that I would like.

Anybody got any shiny, bright ideas? :)

Thanks!!!

08-08-2009

cyberfish

How about reading the GDB source?

08-08-2009

lonnieh

Assuming there is a windows port of GDB... cause from what I see its mainly a GNU/Linux application.

Besides that, anything?

08-08-2009

MK27

Quote:

Originally Posted by lonnieh

Assuming there is a windows port of GDB...

Of course there is! You are going to have to use your mind and fingers with a little more enthusiasm if you want to pull this off.

if the program has any bugs which allow us to make it crash (don't all applications have bugs, hence we need debuggers haha) then it would catch the crash

is not quite possible; it could only catch bugs which actually cause a crash during execution, not all the ones that could.

Unless you do some interesting and unique work ;)

08-09-2009

lonnieh

I was rather asking of an example of a simple debugger, rather than trying to decipher through GDB's source code and piecing it together from there. But I am looking at it as we speak, but if anyone knows of any simpler codes I can see or how the achieve the aforementioned a goals, please let me know.

08-09-2009

VirtualAce

Quote:

But I am looking at it as we speak, but if anyone knows of any simpler codes I can see or how the achieve the aforementioned a goals, please let me know.

Your task is not all that simple. If you are looking for simple perhaps a different project is in order. Writing a fully functional fully featured debugger for Windows is something that requires a development team with a significant amount of low-level Windows experience. It is definitely not for the faint of heart.

08-09-2009

lonnieh

I am not looking into writing a fully featured debugger. As stated previously, my goals are:

1) Create a process
2) Catch any faults or crashes it may encounter during runtime
2.1) If It encounters a fault or crash, output debugging info
2.2) If operations are normal, goto 3
3) Kill the process

One would think that may be simpler than a fully featured debugger. Thanks!