Skip to main content
gamedev.net
🔒 Locked

Problem with MSVC

Started by Austrian Coder Jul 17, 2003 at 5:26 PM 6 replies 500+ views
Original Post
Austrian Coder
Austrian Coder
Hi! I have written sume huge code. Now when i test it in debug mode this comes: "Userdefined breakpoint form source called at 0x77897704" (translated from german) and in the disasambling window i see an int 3. But i havent set any breakpoint. How can i fix this?
S1CA
S1CA
1) Look at the debug output window when you get the breakpoint to see if there is any information on there. When there''s a debugger the NT kernel (if you have Windows 2000, Windows XP or Windows NT) will cause a breakpoint for things like memory trashes and writing to memory that has been marked as read only. Before it causes the breakpoint it produces a message.


2) Look at the callstack (often a list box labelled "Callstack") when the breakpoint occurs. That:

a. lets you see which module the code has stopped in such as KERNEL32!, NTDLL! etc to see which component has triggered the error (most system components WILL tell you why in the debug output).

b. lets you find the line in YOUR code that is responsible for calling the module that caused the breakpoint.


3) Make sure F12 isn''t being used for anything in your app. With a debugger connected, F12 is reserved in the kernel as a "cause breakpoint" key.


4) Press CTRL+B to make sure there aren''t any breakpoints set that aren''t being shown in the IDE window. Check for "Break On Watch" breaks too.


5) Try a Clean and Rebuild All - if one of the intermediate project files got out of sync the breakpoint might not be shown but may still trigger in some circumstances.



--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Austrian Coder
Austrian Coder
Also ich verwende kein OpenGL oder Directx. Es ist ein faches Konsolenprogramm. Die Stl wird von mir verwendet und boost::filesystem.

It is an console app, uses stl and boost::filesystem.

quote:

1) Look at the debug output window when you get the breakpoint to see if there is any information on there. When there''s a debugger the NT kernel (if you have Windows 2000, Windows XP or Windows NT) will cause a breakpoint for things like memory trashes and writing to memory that has been marked as read only. Before it causes the breakpoint it produces a message.



I am working on Win2000 and it produces a message.

quote:

2) Look at the callstack (often a list box labelled "Callstack") when the breakpoint occurs. That:

a. lets you see which module the code has stopped in such as KERNEL32!, NTDLL! etc to see which component has triggered the error (most system components WILL tell you why in the debug output).

b. lets you find the line in YOUR code that is responsible for calling the module that caused the breakpoint.




Take a look at this screenshot
http://www.visual-page.de/msvc_prob.gif

quote:

3) Make sure F12 isn''t being used for anything in your app. With a debugger connected, F12 is reserved in the kernel as a "cause breakpoint" key.



If i press F12 nothing happens.

quote:

4) Press CTRL+B to make sure there aren''t any breakpoints set that aren''t being shown in the IDE window. Check for "Break On Watch" breaks too.



checked... i have removed all breakpoints, but the problem is still there.

quote:

5) Try a Clean and Rebuild All - if one of the intermediate project files got out of sync the breakpoint might not be shown but may still trigger in some circumstances.



done... problem is still there
Sneftel
Sneftel
The stack trace would be the most useful thing here. Other things than your own code can cause breakpoints. I''m guessing this is a CRT function, and the offending function is one or two frames down.
Austrian Coder
Austrian Coder
quote:

The stack trace would be the most useful thing here.



Whats that... how to use it?


[edited by - Austrian Coder on July 17, 2003 8:38:01 PM]
S1CA
S1CA
quote:
Original post by Austrian Coder
[qoute]
The stack trace would be the most useful thing here.
[/qoute]

Whats that... how to use it?



#1)

As I menioned ("2) Look at the callstack (often a list box labelled "Callstack") when the breakpoint occurs...." ).

It''s the context list-box, or "Kontext:" on the screenshot you posted.

The "Kontext:" is a list box, which currently shows NTDLL! 77897704() in your shot, see what the other entries in that list box are.

Each function the program has been through to get to the code that caused the breakpoint will be listed there. If you work your way down that list, see if any of your programs functions caused the problem.

For example running for a stopped D3D application looks like:
NTDLL! 77f9180c()
KERNEL32! 77e8b693()
CMyD3DApplication::FrameMove()
CD3DApplication::Render3DEnvironment()
CD3DApplication::Run()
WinMain(HINSTANCE__ *, HINSTANCE__ *, HINSTANCE__ *, HINSTANCE__ *)
WinMainCRTStartup()
KERNEL32! 77ea847c()


What the above tells me is:
The code in the KERNEL32 module (part of the OS) made a call to WinMainCRTStartup() in my app, WinMainCRTStartup() then called WinMain().
WinMain() then called CD3DApplication::Run() which then called CD3DApplication::Render3DEnvironment() which in turn called CMyD3DApplication::FrameMove().

i.e. I can tell that the program has done something like

WinMain()
{
...stuff
D3DApplication.Run();
...stuff
}

CD3DApplication::Run()
{
...stuff
D3DApplication.Render3DEnvironment();
...stuff
}

CD3DApplication::Render3DEnvironment()
{
...stuff
myD3DApplication.FrameMove();
...stuff
}

CMyD3DApplication::FrameMove()
{
...
pow! - something that called a KERNEL32 function that in turn crashed
...
}


Since FrameMove is the last part of my code before the OS is called, I can see what happens in there.


#2)

When you''re in the debugger right click on the toolbar of MSVC and tick "Output" from the menu that appears. This will open the debug output window. Scroll to the bottom of the output window to see if the code that caused the breakpoint displayed any more information. Quite often it does (as per point 1 in my original reply).

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Austrian Coder
Austrian Coder
Thanks S1CA: By scrolling down the contect box i found the function, which generates this funky error. To be concrete it is an other dll of me, which is in development.

Now everything works perfekt!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.