flat assembler
Message board for the users of flat assembler.

Index > Windows > Debugging

Author
Thread Post new topic Reply to topic
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 13 Oct 2004, 08:22
Is there a way for application to debug itself?
Post 13 Oct 2004, 08:22
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Torrey



Joined: 12 Oct 2003
Posts: 78
Torrey 15 Oct 2004, 07:51
This has to be possible. I can think out a few ideas in my mind right now, but it's kind of hard to word them out without confusing people. The first api that I'd try for this is CreateProcess with the debug creation flag set. Your app could do a IsDebuggerPresent to detect that the app is debugging itself and continue on with the real code.

There are also disassembler engines availabe that you could use to disasm your code on the fly in memory. Create a thread disasm a section of your code, copy over line by line, but inbetween the lines insert a call to your debug function to grab the registers and things.
Post 15 Oct 2004, 07:51
View user's profile Send private message Visit poster's website Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 15 Oct 2004, 09:25
Maybe you didn't understand me. I need e.g. to create 2 threads in my application to first thread debug second thread. Without any other running copy of my application or any debuggers. Maybe i need to go deeper to the problem? In my application the code executed may do things that aren't allowed by windows e.g. accessing memory not belonging to my application or trying to interrupt (int ...). And to catch all this operations (well, exactly - all instructions that operate with memory) i want to use debugging. Any other suggestions?
Post 15 Oct 2004, 09:25
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 15 Oct 2004, 12:13
IMHO, you need so called "structured exception handling". There was some tutorials out there...search for them.

Regards.
Post 15 Oct 2004, 12:13
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Torrey



Joined: 12 Oct 2003
Posts: 78
Torrey 15 Oct 2004, 12:32
I always used the api, SetUnhandledExceptionFilter for possible errors like that.
Post 15 Oct 2004, 12:32
View user's profile Send private message Visit poster's website Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 15 Oct 2004, 15:04
Post 15 Oct 2004, 15:04
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.