Questions tagged [stack-frame]

Use stackframe for questions related to debugging unterminated function calls.

A stackframe is a list of functions that have been invoked but have not yet returned a value

References

214 questions
243
votes
7 answers

What is exactly the base pointer and stack pointer? To what do they point?

Using this example coming from wikipedia, in which DrawSquare() calls DrawLine(), (Note that this diagram has high addresses at the bottom and low addresses at the top.) Could anyone explain me what ebp and esp are in this context? From what I see,…
devoured elysium
  • 90,453
  • 117
  • 313
  • 521
107
votes
9 answers

What is the direction of stack growth in most modern systems?

I am preparing some training materials in C and I want my examples to fit the typical stack model. What direction does a C stack grow in Linux, Windows, Mac OSX (PPC and x86), Solaris, and most recent Unixes?
Uri
  • 84,589
  • 46
  • 214
  • 312
85
votes
1 answer

What is the difference between parent.frame() and parent.env() in R; how do they differ in call by reference?

It would be helpful if someone can illustrate this with a simple example? Also, where would it be useful to use parent.frame() instead of parent.env() and vice versa.
suncoolsu
  • 1,334
  • 1
  • 10
  • 12
81
votes
2 answers

Trying to understand gcc option -fomit-frame-pointer

I asked Google to give me the meaning of the gcc option -fomit-frame-pointer, which redirects me to the below statement. -fomit-frame-pointer Don't keep the frame pointer in a register for functions that don't need one. This avoids the instructions…
rashok
  • 10,508
  • 11
  • 76
  • 90
57
votes
1 answer

What is a stack map frame

I've recently been looking at The Java Virtual Machine Specifications (JVMS) to try to better understand the what makes my programs work, but I've found a section that I'm not quite getting... Section 4.7.4 describes the StackMapTable Attribute, and…
Steven
  • 1,495
  • 2
  • 14
  • 23
51
votes
4 answers

GetEntryAssembly for web applications

Assembly.GetEntryAssembly() does not work for web applications. But... I really need something like that. I work with some deeply-nested code that is used in both web and non-web applications. My current solution is to browse the StackTrace to find…
Mose
  • 1,671
  • 3
  • 15
  • 33
51
votes
4 answers

What are the ESP and the EBP registers?

I found that the ESP register is the current stack pointer and EBP is the base pointer for the current stack frame. However, I don't understand these definitions (I am just starting to learn how to code in assembler). What I understand is that ESP…
Lucas Alanis
  • 1,008
  • 2
  • 13
  • 29
47
votes
4 answers

"enter" vs "push ebp; mov ebp, esp; sub esp, imm" and "leave" vs "mov esp, ebp; pop ebp"

What is the difference between the enter and push ebp mov ebp, esp sub esp, imm instructions? Is there a performence difference? If so, which is faster and why do compilers always use the latter? Similarily with the leave and mov esp, ebp pop …
小太郎
  • 4,912
  • 5
  • 31
  • 47
45
votes
2 answers

explanation about push ebp and pop ebp instruction in assembly

i used stack in assembly but i didn't got idea about push ebp and pop ebp. .intel_syntax noprefix .include "console.i" .text askl: .asciz "Enter length: " askb: .asciz "Enter breadth: " ans: .asciz "Perimeter = " _entry: push…
bunty
  • 2,427
  • 7
  • 26
  • 26
26
votes
3 answers

ENTER and LEAVE in Assembly?

I was reading The Art of Assembly Language (Randall Hyde, link to Amazon) and I tried out a console application in that book. It was a program that created a new console for itself using Win32 API functions. The program contains a procedure called…
devjeetroy
  • 1,715
  • 5
  • 22
  • 43
26
votes
1 answer

Does omitting the frame pointers really have a positive effect on performance and a negative effect on debug-ability?

As was advised long time ago, I always build my release executables without frame pointers (which is the default if you compile with /Ox). However, now I read in the paper http://research.microsoft.com/apps/pubs/default.aspx?id=81176, that frame…
Patrick
  • 22,097
  • 9
  • 57
  • 125
20
votes
1 answer

x86_64 : is stack frame pointer almost useless?

Linux x86_64. gcc 5.x I was studying the output of two codes, with -fomit-frame-pointer and without (gcc at "-O3" enables that option by default). pushq %rbp movq %rsp, %rbp ... popq %rbp My question is : If I globally disable that…
Kroma
  • 725
  • 5
  • 14
17
votes
1 answer

exception call stack truncated without any re-throwing

I have an unusual case where I have a very simple Exception getting thrown and caught in the same method. It isn’t re-thrown (the usual kind of problem naïve programmers have). And yet its StackFrame contains only one the current method. Here’s…
Todd
  • 520
  • 4
  • 14
14
votes
1 answer

Why does GCC drop the frame pointer on 64-bit?

What's the rationale behind dropping the frame pointer on 64-bit architectures by default? I'm well aware that it can be enabled but why does GCC disable it in the first place while having it enabled for 32-bit? After all, 64-bit has more registers…
asdf
  • 211
  • 3
  • 10
14
votes
4 answers

Function Prologue and Epilogue in C

I know data in nested function calls go to the Stack.The stack itself implements a step-by-step method for storing and retrieving data from the stack as the functions get called or returns.The name of these methods is most known as Prologue and…
user1843665
  • 193
  • 1
  • 2
  • 7
1
2 3
14 15