News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Call stack window

Started by Vadim, December 14, 2018, 02:28:08 PM

Previous topic - Next topic

Vadim

Can anyone please tell what does the second column in Call stack window named "Address" show?

BlueHazzard

The address of the function?

Vadim

#2
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?

blauzahn

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

Vadim

#4
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?

oBFusCATed

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!]

Vadim