Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Vadim on December 14, 2018, 02:28:08 pm
-
Can anyone please tell what does the second column in Call stack window named "Address" show?
-
The address of the function?
-
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?
-
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 (https://en.cppreference.com/w/cpp/language/main_function)
-
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?
-
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.
-
Thank you!