在VC ++中进入MACRO [英] stepping into MACRO in VC++

查看:161
本文介绍了在VC ++中进入MACRO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试一个源代码,它有很多大的#define的MACRO例程。
我很感兴趣的进入他们,但我想,VC ++不允许step-in功能...所以,




  • 我将它们转换为函数,但这对我来说变得很难。



有没有办法进入MACRO例程?特别是在VC ++中?



PS:如果gcc编译器支持步进到MACRO,我可以将整个代码移植到gcc中

解决方案

除了上面所有的正确答案:我通常做的是显示混合显示(C +程序集)。这表明真正发生了什么。即使你不是底层程序集的专家,它给出一个想法发生了什么(即它是一个简单的替换或复杂的循环)。它还将提供额外的机会,以便步入功能。例如,如果你的宏是

  #define foo(a)i ++; foo_func(a,i)

您的调试器将显示类似
循环和使用什么类型的变量。您可以使用宏定义作为参考来了解它。

  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调用foo_func(411028h)
00411473添加esp,8
}

这给出了一个线索,变量i和j用于调用函数foo_func。



如果使用Visual C ++,它将允许你从宏(F11)调用函数;不是个别声明。


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,

  • I am converting them into functions, but this is becoming hard for me

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.

这篇关于在VC ++中进入MACRO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆