C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 08-08-2009, 06:58 PM   #1
Registered User
 
Join Date: Aug 2009
Posts: 17
Question Debugging in Win32 Enivornment

Hi all, Lonnie here.

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!!!
lonnieh is offline   Reply With Quote
Old 08-08-2009, 08:10 PM   #2
Registered User
 
Join Date: Dec 2006
Posts: 1,780
How about reading the GDB source?
cyberfish is offline   Reply With Quote
Old 08-08-2009, 09:11 PM   #3
Registered User
 
Join Date: Aug 2009
Posts: 17
Assuming there is a windows port of GDB... cause from what I see its mainly a GNU/Linux application.

Besides that, anything?
lonnieh is offline   Reply With Quote
Old 08-08-2009, 09:51 PM   #4
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,944
Quote:
Originally Posted by lonnieh View Post
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.

It only took me ONE google to get this:

GDB on Windows

Altho I doubt this works quite the way you are hoping!

Anyway, keep in mind that this

Quote:
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
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS
MK27 is offline   Reply With Quote
Old 08-09-2009, 10:46 AM   #5
Registered User
 
Join Date: Aug 2009
Posts: 17
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.
lonnieh is offline   Reply With Quote
Old 08-09-2009, 10:54 AM   #6
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
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.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Old 08-09-2009, 12:05 PM   #7
Registered User
 
Join Date: Aug 2009
Posts: 17
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!
lonnieh is offline   Reply With Quote
Reply

Tags
debug, debugger, debugging, win32, windows

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dev-C++: Problems with Breakpoint Debugging Thileepan_Bala C Programming 1 01-17-2008 10:48 AM
Debugging book recommendation dagans Projects and Job Recruitment 1 09-13-2005 07:35 PM
Win32 API or Win32 SDK? jverkoey General Discussions 2 07-20-2005 03:26 PM
tools for debugging win32 underthesun Windows Programming 4 02-03-2005 06:52 AM
OLE Clipboard :: Win32 API vs. MFC kuphryn Windows Programming 3 08-11-2002 05:57 PM


All times are GMT -6. The time now is 05:04 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22