I am debugging a source code that has a lot of big #define'd MACRO routines. I am interesting in stepping into them, but I guess, VC++ does not allow step-in functionality ... so,
Is there a way to step into MACRO routines? especially in VC++?
PS: I can port the whole code into gcc, if gcc compiler supports stepping into MACRO
In addition to all correct answers above: what I usually do is to show mixed display (C+assembly). This shows what really happens. Even if you are no expert in the underlying assembly, it gives an idea what happens (i.e. is it a trivial replacement or a complex loop). Also it will provide additional opportunities to step into functions. For instance, if your macro is
#define foo(a) i++;foo_func(a,i)
your debugger will show something like looping and what kind of variables are used). You can use the macro definition as a reference to understand it.
00411454 mov dword ptr [j],eax
00411457 cmp dword ptr [j],0Ah
0041145B jge wmain+58h (411478h)
{
foo(j);
0041145D mov eax,dword ptr [i]
00411460 add eax,1
00411463 mov dword ptr [i],eax
00411466 mov eax,dword ptr [i]
00411469 push eax
0041146A mov ecx,dword ptr [j]
0041146D push ecx
0041146E call foo_func (411028h)
00411473 add esp,8
}
This gives a clue that variables i and j are used to call function foo_func.
If you use Visual C++, it will allow you to step into functions called from a macro (F11); not individual statements though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With