Skip to main content
gamedev.net
🔒 Locked

[debug] breakpoints

Started by foofightr Aug 3, 2002 at 12:57 PM 5 replies 450+ views
Original Post
foofightr
foofightr
I heard this was possible but I can''t find out how. With MSVC++ 6, how do you set a breakpoint that''s dependant on a variable? For example, if you want it to break when "myInteger" is over 50?
RobTheBloke
RobTheBloke
quote:
Original post by foofightr
I heard this was possible but I can''t find out how. With MSVC++ 6, how do you set a breakpoint that''s dependant on a variable? For example, if you want it to break when "myInteger" is over 50?



   
if( myVariable > 50 )
int iBreak = 0;


put a breakpoint on the "int iBreak" line.
mentat
mentat
I know what u mean foofightr,

in fact, two years ago I had found out how to do that (by the way, now I can''t remember how to do that). All I remember is that everytime I gave it a try, it took ages to stop in my value. RobTheBloke''s solution is much more faster...
-----------my quote is under construction
Arild Fines
Arild Fines
Right click on the break point in the Breakpoints window. Go to Properties, then Condition. Write the condition there.
But yes, it is slow, since the debugger has to evaluate the expression every time the breakpointed statement is executed.


"I would defend the liberty of concenting adult creationists to practice whatever intellectual perversions they like in the privacy of their own homes; but it is also necessary to protect the young and innocent."
Arthur C Clarke
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
SuperMike
SuperMike
If you have the default keys set up:

Set a breakpoint (F9)
press alt-F9.

Select your break point in the list box.
Press the "Condition" button.
type: myInteger > 50

If you want to set a memory break point, press the data tab, and type in the memory address in the space labeled:
"Enter the expression to be evaluated:"

Do not set a very large number in the "number of elements" box or you app may chug.
foofightr
foofightr
Hey thanks for the advice all, and yes you are right it''s ungodly slow when you do this... to give you an example, when run at full speed the actual condition is reached about 1/500th of a second after the program (main loop) starts, but when I entered the conditional breakpoint it took at least 3 seconds for it to break. Granted these are under extreme conditions (hardware emulation code) where the condition is checked constantly (v-blank status), but it''s still funny
Evil Bill
Evil Bill
try:

  
if(myInt > 50)
{
__asm
{
int 3;
}
}


"int 3" is a breakboint.

Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)

Topic Locked

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

Sign in to reply to this topic.