Archived

This topic is now archived and is closed to further replies.

debuging

This topic is 6085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, htere is s problem somewhere in my app, i would like to be able to just debug like i would if it were an app, but there are calls to getDC and other functions that make debuging impossible. What can i do to track down my bug. thanks

Share this post


Link to post
Share on other sites
I''m confused as to why a call to GetDC() would cause problems for your debugging session. Running graphics in exlusive mode would, but...

What compiler are you using?

If you are running in exclusive mode, I usually use PlaySound to find where I''m crashing (if it beeps before it fatals, I know that the crash is somewhere after that... makes it easy to narrow down the bug''s location.)

-fel

Share this post


Link to post
Share on other sites
the reason that GetDC is screwing up debugging is that while i''m debugging it, it gets the DC of MSVC and it stops redrawing the screen because ReleaseDC has not been called. I cannot see what is happening, so i can''t debug.

The PlaySound is a really good idea, don''t know why i didn''t think of it, i used to use AfxMessageBox, when i programmed apps for the same purose.

thanks

Share this post


Link to post
Share on other sites
They say you can debug fullscreen exclusive apps with either two monitors or over an ipx network connection. Since I dont have any, I can only dream

Anyways, this is what I''m using for my project. I dont really understand exceptions, but when they happen the program doesnt just exit, it exits exclusive mode (DebugKillDDraw ()) and gives me the exception address. I throw the address in the exception wizard (http://members.aol.com/ExceptWiz/index.html) and voila : the exact place where the code crashed

And I can always put a breakpoint in that __except block and see my data.

I also use lots of asserts that on failure call DebugKillDDraw and then go into a breakpoint and let me look at the data.

Maybe you could use a similar approach with your DC problems, only instead of DebugKillDDraw, you might have a DebugReleaseBuggyDC function.

I can guess this is pretty obsolette stuff, but it helped me alot..


//global vars
int EXaddress;
int EXcode;
BOOL MyFilter(LPEXCEPTION_POINTERS expepo)
{
EXcode=expepo->ExceptionRecord->ExceptionCode;
EXaddress=(int)expepo->ExceptionRecord->ExceptionAddress;
return TRUE;
}


int PASCAL
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{

// ...............
__try {

// main game loop

}


__except (MyFilter(GetExceptionInformation()))
{
DebugKillDDraw(); // stops exclusive mode
char buf[550];
sprintf(buf,"code = %d address = 0x%Xh",EXcode,EXaddress);
MessageBox(NULL,buf,"exception",MB_YESNO);
return 0;
}

}

Share this post


Link to post
Share on other sites