Jump to content
  • Advertisement

Archived

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

Problem with __asm { int 3 }

This topic is 5807 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

I am using a modified VERIFY macro to check the HRESULT return values of DirectX calls. The macro uses the following to break into the code: __asm { int 3 } However, I am getting an exception error when I run the program. Specifically, "GAME caused an exception 03H in ..." If I comment out the assembly call the program does not crash. If I use the debugger to execute the program to a point in the code well past the assembly call, the program runs fine and stops (as it should) with a "User breakpoint called from code at ..." message when it reaches the inline assembly call. Thanks Todd

Share this post


Link to post
Share on other sites
Advertisement
Here is the source for the function called by the macro:

void ReportDirectXError(const char* title, HRESULT r, const char* file, int line, const char* str )
{
char tstr[1024];
char* fail = FAILED(r) ? "failure" : "(no failure)";
const char* hrStr = DXGetErrorString8( r );
sprintf( tstr, "*** %s %s ***\n%s\nreturn code: ''%s''\n%s (line %d)\n", title, fail, str, hrStr, file, line );
OutputDebugString( tstr );

if (FAILED(r))
{
__asm { int 3 }
}
}

Share this post


Link to post
Share on other sites
I''m still a little confused....

1) I am compiling using a ''Debug'' profile so shouldn''t the breakpoint work even if I am not specifically running it from the debugger?

2) Why would the program execute if I comment out the inline assembly call?

3) Can you explain what you mean by the DirectX call is failing?

Thanks for the all the help.
Todd

Share this post


Link to post
Share on other sites
The breakpoint exception is only caught by the Debugger if it''s attached to your app. If you just run the program you''ll get an unhandled exception.

If you comment it out the code making the breakpoint exception no longer gets run.

For some reason the HRESULT you pass into that function is an error code. You need to check the function that produced the error, and possibly put the HRESULT into the DirectX error lookup utility (comes with the SDK) to find out what happened.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!