在Visual Studio中解释调用堆栈输出



系统信息:Windows 7,MSVS 2010

下面是一个简单的程序,我在其中测试调试中的Call Stack选项如何工作

#include<stdio.h>
#include "stdafx.h"

int main()
{
    printf("hello"); //breakpoint 
}

当我调试控件时,控件到达断点,调用堆栈为:

testapp.exe!main()  Line 10 C++
testapp.exe!__tmainCRTStartup()  Line 555 + 0x19 bytes  C
testapp.exe!mainCRTStartup()  Line 371  C
kernel32.dll!75e7ed6c()     
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]  
    ntdll.dll!77a537eb()    
    ntdll.dll!77a537be()    

我该如何解释这个结果?广告什么是__tmainCRTStartup()

更新

刚刚选中,即使我有.c文件而不是.cpp文件,调用堆栈中也有相同的输出。

调用堆栈用于确定调试器当前所在的代码行。最上面的一行是当前位置。

在您的示例中,相关的行是testapp.exe!main() Line 10 C++,这意味着它在文件的第10行的一个名为main()的函数处停止。通常这也包含文件名。

将此代码粘贴到您的文件中,看看当您中断时调用堆栈是否对您更有意义:

int main()
{
    apple();
}
void apple()
{
    banana();
}
void banana()
{
    printf("hello"); //breakpoint
}

最新更新