I want to know the exact contents of a program stack.
How is the branching operation done?
What is meant by memory dump while debugging a program using gdb?
Does it give the program stack?
TIA,
Praveen
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The C language itself doesn’t mandate the use of a stack at all – it defines behaviour rather than implementation.
However, in the common case, the program stack is used to store several things:
autostorage duration (ie. ordinary, non-staticlocal variables);return;or the end of the current function is reached);alloca()function;alloca(), the size of variable-length arrays and intermediate values used in calculations.This is not an exhaustive list – other, more exotic things like Trampolines are also sometimes stored on the stack. In general, it is a temporary storage area for working items that will not be needed after the current function returns to its caller.
A “backtrace” in a debugger shows some (but not all) of the contents of the stack.