0

System info: Windows 7, MSVS 2010

The following is a simple program, in which I am testing how Call Stack option in debug works

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


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

When I debug the control hits the break point and the Call Stack is:

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()    

How do I interpret this result? Ad what is __tmainCRTStartup()?

Update

Just checked, the same output in Call Stack even if I am having .c file instead of .cpp file.

gpuguy
  • 4,607
  • 17
  • 67
  • 125
  • possible duplicate of [What is the difference between main and mainCRTStartup?](http://stackoverflow.com/questions/22934206/what-is-the-difference-between-main-and-maincrtstartup) – demoncodemonkey Sep 29 '14 at 11:02
  • @demoncodemonkey Thanks for the link. But how do I interpret the output of the Call Stack? – gpuguy Sep 29 '14 at 11:04

1 Answers1

0

The call stack is used to figure out which line of code the debugger is currently at. The top one is the current location.

In your example the relevant line is testapp.exe!main() Line 10 C++ which means it's stopped at a function called main() which is at Line 10 in your file. Normally this contains the filename too.

Paste this code into your file and see if the call stack makes more sense for you when you break:

int main()
{
    apple();
}

void apple()
{
    banana();
}

void banana()
{
    printf("hello"); //breakpoint
}
demoncodemonkey
  • 11,730
  • 10
  • 61
  • 103