Game Development Reference
In-Depth Information
'
Luckily, you don
t have to worry about the stack pointer as long as you do all your
jumping around within one function. Local scopes are creations of the compiler; they
don
s a good thing, because setting the next state-
ment to a completely different function is sure to cause havoc with the stack. If you
want to skip the rest of the current function and keep it from executing, just right-
click on the last closing brace of the function and set the next statement to that point.
The stack frame will be kept intact.
'
t actually have stack frames. That
'
Assembly Level Debugging
Inevitably, you
'
'
t have source
code or even symbols for every component of your application, so you should under-
stand a little about the assembly window. Here
ll get to debug through some assembly code. You won
'
s the assembly for the SetTheIP()
function we just talked about. Let
'
s look at the debug version of this code:
void SetTheIP()
{
00411A10 55
push
ebp
00411A11 8B EC
mov
ebp,esp
00411A13 81 EC E8 08 00 00
sub
esp,8E8h
00411A19 53
push
ebx
00411A1A 56
push
esi
00411A1B 57
push
edi
00411A1C 8D BD 18 F7 FF FF
lea
edi,[ebp-8E8h]
00411A22 B9 3A 02 00 00
mov
ecx,23Ah
00411A27 B8 CC CC CC CC
mov
eax,0CCCCCCCCh
00411A2C F3 AB
rep stos dword ptr [edi]
char buffer[2048];
buffer[0] = 0;
00411A2E C6 85 F8 F7 FF FF 00
mov
byte ptr [buffer],0
for (int a=0; a<128; ++a)
00411A35 C7 85 EC F7 FF FF 00 00 00 00 mov
dword ptr [a],0
00411A3F EB 0F
jmp
SetTheIP+40h (411A50h)
00411A41 8B 85 EC F7 FF FF
mov
eax,dword ptr [a]
00411A47 83 C0 01
add
eax,1
00411A4A 89 85 EC F7 FF FF
mov
dword ptr [a],eax
00411A50 81 BD EC F7 FF FF 80 00 00 00 cmp
dword ptr [a],80h
00411A5A 7D 35
jge
SetTheIP+81h (411A91h)
{
MyClass m(a);
00411A5C 8B 85 EC F7 FF FF
mov
eax,dword ptr [a]
00411A62 50
push
eax
 
 
Search WWH ::




Custom Search