Author Topic: Call stack window  (Read 606 times)

Offline Vadim

  • Single posting newcomer
  • *
  • Posts: 5
Call stack window
« on: December 14, 2018, 02:28:08 pm »
Can anyone please tell what does the second column in Call stack window named "Address" show?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2327
Re: Call stack window
« Reply #1 on: December 14, 2018, 02:47:27 pm »
The address of the function?

Offline Vadim

  • Single posting newcomer
  • *
  • Posts: 5
Re: Call stack window
« Reply #2 on: December 14, 2018, 03:38:06 pm »
I really hoped so :),
but then in code I wrote printf("%p\n", main); and it showed different address (of main()) from that that was shown in Call stack window. I may be wrong but I just cant understand why. May you please explain it?
« Last Edit: December 14, 2018, 04:57:24 pm by Vadim »

Offline blauzahn

  • Multiple posting newcomer
  • *
  • Posts: 93
Re: Call stack window
« Reply #3 on: December 14, 2018, 06:45:32 pm »
os, cb-version, compiler, debugger, c or c++?

On my computer the address within the call-stack window shows e.g. 0x40065b depending on the instruction where you stopped whereas watch and printed value is 0x400652
(ubuntu 18.04, cb svn 11511, g++-trunk (GCC) 9.0.0 20181210, gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2, c++).

Please try debugging "step into instruction" and you see what I mean.

Please be aware that main is a somewhat special function. Some programmer even say that main is not really a function at all since it is
the designated entry point to a program. You are not supposed to call it.

https://en.cppreference.com/w/cpp/language/main_function

Offline Vadim

  • Single posting newcomer
  • *
  • Posts: 5
Re: Call stack window
« Reply #4 on: December 14, 2018, 07:55:49 pm »
Ive attached the picture of the source code and all.
Windows 8, Code::Blocks 17.12, mingw32-g++ Compiler, gdb32 Debugger, C++.

May you, please, explain why there is a difference between addresses shown in the Call stack window and the Console?
Shouldn't they be the same?
« Last Edit: December 14, 2018, 08:13:03 pm by Vadim »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11716
    • Travis build status
Re: Call stack window
« Reply #5 on: December 15, 2018, 12:19:10 am »
You'll have to ask in a forum/mailing list which supports gdb for the exact answer.

Most probably gdb prints the stack frame which is not the same as the function address. Also it seems The FirstFunction have been inlinded.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Vadim

  • Single posting newcomer
  • *
  • Posts: 5
Re: Call stack window
« Reply #6 on: December 15, 2018, 12:10:53 pm »
Thank you!