public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
* Frame pointer Vs Stack Pointer
@ 2004-11-23  9:24 Ankit Jain
  2004-11-23 10:22 ` Jagadeesh Bhaskar P
  2004-11-25 20:10 ` lindax newbie
  0 siblings, 2 replies; 3+ messages in thread
From: Ankit Jain @ 2004-11-23  9:24 UTC (permalink / raw)
  To: newbie

Frame pointer, Stack Pointer....i want to understand
this concept w.r.t stack in a program

how a program stores and understand by this

thanks

ankit

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Frame pointer Vs Stack Pointer
  2004-11-23  9:24 Frame pointer Vs Stack Pointer Ankit Jain
@ 2004-11-23 10:22 ` Jagadeesh Bhaskar P
  2004-11-25 20:10 ` lindax newbie
  1 sibling, 0 replies; 3+ messages in thread
From: Jagadeesh Bhaskar P @ 2004-11-23 10:22 UTC (permalink / raw)
  To: Ankit Jain; +Cc: Linux Newbie

AFAIK, frame pointer points to the current activation record. Activation
records, for example, are created when a function is called, or the
program enters a different block of code. It can have details of the
return address, local variables etc. Now for getting the variables under
the current scope, a frame pointer is used.

A program will have an associated stack, to store values related to the
program. At times even the activtion records are stored in the stack.
The stack pointer points to the top of this stack.


On Tue, 2004-11-23 at 14:54, Ankit Jain wrote:
> Frame pointer, Stack Pointer....i want to understand
> this concept w.r.t stack in a program
> 
> how a program stores and understand by this
> 
> thanks
> 
> ankit
> 
> ________________________________________________________________________
> Yahoo! Messenger - Communicate instantly..."Ping" 
> your friends today! Download Messenger Now 
> http://uk.messenger.yahoo.com/download/index.html
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
-- 
Jagadeesh Bhaskar P <jbhaskar@hclinsys.com>

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Frame pointer Vs Stack Pointer
  2004-11-23  9:24 Frame pointer Vs Stack Pointer Ankit Jain
  2004-11-23 10:22 ` Jagadeesh Bhaskar P
@ 2004-11-25 20:10 ` lindax newbie
  1 sibling, 0 replies; 3+ messages in thread
From: lindax newbie @ 2004-11-25 20:10 UTC (permalink / raw)
  To: Ankit Jain; +Cc: newbie

Frame pointer is a convenience for referencing local variables in a
subrouting, usually all the args are pushed onto the stack then BP
(the frame, or Base pointer) is pushed , then SP
(the stack pointer) is copied to BP, so all variables can easily be
referenced via BP+x, BP+y, etc.  It is especially useful if you are
debugging since BP will give you an idea of where the parameters to
the current subroutine are located.  It is also useful if you are doing
a stack traceback since the values of BP have been pushed onto the stack
for each stack frame.

On the otherhand, there are otherways of accessing those variables by
referencing off of "SP" and using BP as a general purpose register
to do other things -- this can result in faster code that is less
easy to debug.

If you aren't doing kernel debugging and/or are not expecting to be
generating stack traces, allowing the compiler to use BP (Base/Frame
 Pointer) is usually a good thing for optimizing memory and CPU
execution time.

-linda

Ankit Jain wrote:

>Frame pointer, Stack Pointer....i want to understand
>this concept w.r.t stack in a program
>
>how a program stores and understand by this
>
>thanks
>
>
>  
>
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-25 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-23  9:24 Frame pointer Vs Stack Pointer Ankit Jain
2004-11-23 10:22 ` Jagadeesh Bhaskar P
2004-11-25 20:10 ` lindax newbie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox