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

291 questions
0
votes
1 answer

C# stack frames, curly brackets and performance

Do curly brackets always imply a stack frame. Example 1: { int b; } Obviously a stack frame will be created. So then example 2: { int a; } I'd assume there will be a stack frame to reflect…
Mark Roworth
  • 409
  • 2
  • 15
0
votes
0 answers

How does the EBP register get saved?

I couldn't find much information or specification that suits me, so I have no choice but to ask here. When we call some function with the call instruction and then save the previous stack frame with push ebp, how is EBP saved just before it? Does it…
Balora
  • 31
  • 1
  • 4
0
votes
1 answer

I got a error ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1

i am learning to implement a simple Stack base machine using Linklist with c++. There are constant.h, Stackframe.h, StackFrame,cpp, main.cpp. I code on MacOs 10.14.6 with Visual Studio Code. I am getting some trouble when i run main.cpp file. Here…
Lang Ung
  • 5
  • 2
0
votes
1 answer

How do programs know how much space to allocate for local variables on the stack?

In this simple function, space is allocated for local variables. Then, variables are initialized and printf is called to output them. 000000000040056a : 40056a: 55 push rbp ; function…
Happy Jerry
  • 164
  • 1
  • 8
0
votes
1 answer

Tail call stack

I'm having trouble understanding the Stack manipulation needed in order to implement Tail call in assembly language. When we have a Tail call to function We basically want to override the current Activation Frame with the Activation Frame of the…
0
votes
0 answers

how to draw the stack after analysing the assembly code

pleasse i need someone to assit me with my assighnment. q1. Examine the code below and Draw the stack frame after analysing the assembly code when function1, function2 and function3 are called by the main program for a 32-bit system. Figure 2 shows…
0
votes
0 answers

How do draw stack frame for a c function

please, need assistance on my assignment which is due soon. 1a: Examine the code below and draw stack frames when function1, function2 and function3 are called by the main program for a 32-bit system. Use objdumb and GDB debugger to analysis the…
0
votes
0 answers

Stack: how is esp sub x calculated

I am trying to understand how the amount of bytes to substract from esp is calculated in a 32 bit machine. I understand that it is done in order to create a stack frame and that the bytes are multiples of 8, but I can't figure out why a specific…
D.Joe
  • 1
  • 1
  • 2
0
votes
0 answers

Why does unoptimized compiler output sub/add RSP in some functions but not others?

With reference to the following code: #include void func() { return; } void funcparent() { uint64_t h = 99; func(); } void funcparent2() { func(); } void funcparent3() { func(); int h = 99; } And assembly, from…
PYA
  • 8,096
  • 3
  • 21
  • 38
0
votes
2 answers

Prematurely resetting the stack pointer? Confusing assembly code

Im trying to make sense of a small bit of assembly. pushl %ebp movl %esp,%ebp movl 8(%ebp),%edx movl 12(%ebp),%eax movl %ebp,%esp movl (%edx),%edx addl %edx,(%eax) movl %edx,%eax popl %ebp ret Why is the sp being reset to the base pointer before…
Dank_Hill
  • 19
  • 2
0
votes
0 answers

Stack in x86_64 in C program on linux

I thought the stack in x86_64 would grow down hence from the max. address of the processes virtuell memory till the end of the stack size…
Simon Rechermann
  • 467
  • 3
  • 18
0
votes
0 answers

ESP pointer in relation to when the return address is popped off the stack

I am taking a class right now and as part of the research project there is a question on how the ESP/RSP pointer is used in relation to popping the return address on a stack frame into the register. Now looking up the leave instruction I found the…
0
votes
0 answers

Will values under the stack pointer vanish

if i move a value to a memory under the stack pointer, will it vanish? Like: mov [rsp-8], 9 will 9 gone even if i don't use call or push or any other instruction that affects the stack?
0
votes
0 answers

Return Address and stack layout

I'm trying to understand better how the stack works and I wrote this program. #include #include #include #define SIZE 0 void proof(){ unsigned int buf[SIZE]; unsigned int i = 0; printf("buf is at %X\n",…
ccragusa
  • 17
  • 1
0
votes
2 answers

"mov rbp, rsp" in function prologue

push rbp mov rbp, rsp mov DWORD PTR [rbp-0x4],edi In assembly function prologue, isn't push rbp already moves its value to rsp ? Why did mov rbp, rsp instruction move the same rsp values to rbp again? Is it necessary or redundant?
idep
  • 1
  • 1
  • 2