Game Engine Architecture

(Ben Green) #1
83

z Select “New Data Breakpoint.”
z Type in the raw address or an address-valued expression, such as
“&myVariable” (Figure 2.16).
The “Byte count” fi eld should almost always contain the value 4. This is
because 32-bit Pentium CPUs can really only inspect 4-byte (32-bit) values na-
tively. Specifying any other data size requires the debugger to do some trickery
which tends to slow your program’s execution to a crawl (if it works at all).


2.2.5.7. Conditional Break Points


You’ll also notice in the “Break Points” window that you can set conditions
and hit counts on any type break point—data break points or regular line-of-
code break points.
A conditional break point causes the debugger to evaluate the C/C++ expres-
sion you provide every time the break point is hit. If the expression is true, the
debugger stops your program and gives you a chance to see what’s going on.
If the expression is false, the break point is ignored and the program contin-
ues. This is very useful for sett ing break points that only trip when a function
is called on a particular instance of a class. For example, let’s say you have
a game level with 20 tanks on-screen, and you want to stop your program


Figure 2.16. Defi ning a data break point.


Figure 2.15. The Visual Studio break points window.


2.2. Microsoft Visual Studio

Free download pdf