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

How to do tail call optimisation in Scala3?

I am trying to write a program that is 100% iterative, that is, the functions never need to return, because nothing must happen after such a return. In other words, the program is 100% in tail position. Consider the following toy program: def…
0
votes
0 answers

Understand the stack (variables, parameters, IP, BP, SP) at each step of the program with GDB?

My problem is that I don't understand some things in the GDB output by debugging the program. Here are the following lines of Intel assembly code on Arch Linux. segment .text global main main: push rbp mov rbp, rsp Here is the…
kilerin
  • 1
  • 1
0
votes
0 answers

Where is the base in an empty ascending stack in ARM Assembly?

I am working on an assignment right now for ARM 7 (Big Endian) Assembly. We are using LDMDB and STMIA for this problem where we have an empty ascending stack, where I am asked to push the frame pointer value to the top of the stack. Then I am asked…
acornTime
  • 278
  • 1
  • 15
0
votes
0 answers

How can I access arguments 7+ using inline assembly?

I'd like to create a variadic function that sums its inputs. I've managed to write inline assembly for capturing arguments 2-6, but I'm struggling to retrieve the other arguments from the stack frame. I'm trying to solve a coding exercise that…
Connor
  • 867
  • 7
  • 18
0
votes
1 answer

The x86 assembly code run successfully but vscode show error without more information

I am new to assmbly, and I have some problem. I compiled the following code with GCC: .intel_syntax noprefix .section .data number: .int 65 message: .ascii "The number is %d %d.\n\0" .section .text .globl _main _main: push ebp …
5y9uodh8
  • 3
  • 5
0
votes
1 answer

What is the frame pointer in the stack? What exactly is the frame? (stack in assembly)

So, heres how I interpet the stack, let me know what is wrong/right. This is for any sort of assembly. So it goes: Directives Bytecode with instructions A 'stack' of added bytes added to the end of the instructions (these are set to 0 if I recall…
0
votes
3 answers

Get source file / line from MethodInfo

Say I have a method PrintSourceCode(Action action) that accepts an Action delegate and is executed this way: PrintSourceCode(() => { // need this line number DoSomething(); }) Within PrintSourceCode I would like to print the source code of the…
Alec Bryte
  • 580
  • 1
  • 6
  • 18
0
votes
2 answers

C# get caller class type (Not in Static)

How do I get the caller class type in the base? this is the parent, here I want to print the child type without sending it public abstract class Parent: ISomeInterface { public void printChildType() { Type…
SexyMF
  • 10,657
  • 33
  • 102
  • 206
0
votes
0 answers

Need an explanation about stack frames - why value of this local variable isn't removed?

I've got a question about this code: #include void bar(void) { int a = 22; } void foo(void) { int a; printf("%d\n", a); } int main(void) { bar(); foo(); } Why is it displaying 22 like it was assigned in bar…
0
votes
1 answer

Get functions from python generator

I'm trying to learn more about generator functions in Python. To my knowledge, generator functions don't fully return until there are no more yield calls, so a stack frame exists in the generator returned by the function. Stack frames should have…
Michael M.
  • 10,486
  • 9
  • 18
  • 34
0
votes
1 answer

Addressing stack variables

As far as I understand, stack variables are stored using an absolute offset to the stack frame pointer. But how are those variables addressed later? Consider the following code: #include int main() { int a = 0; int b = 1; int…
Anna
  • 97
  • 5
0
votes
1 answer

Stackframe of function with pointer as paramter

Consider the following scenario in the programming language C: void f(char* name, int age){ } int main(int argc, char* argv[]){ char* name = argv[1]; int x = 1 f(name, x); } How would the stackframe of f() look like in this situation?…
ZPlaya7
  • 31
  • 1
  • 4
0
votes
0 answers

What is a thread in relevance to the call stack and stack frame(s)?

After reading the following excerpts from C# documentation StackFrame Class, I still don't understand what the term "thread" means. What is a thread??? what does it mean in regards to a C# program in relevance to the call stack and stack…
MVPyro
  • 43
  • 5
0
votes
1 answer

Is there a way to use popa/pusha without SP? (for procedures with BP)

for example: var1 dw 8 var2 dw 1 res dw ? CODESEG proc plus pusha mov bp,sp mov ax, [bp+6];var1 mov bx, [bp+4];var2 add ax, bx mov [res], ax popa ret 4 endp plus start : mov ax, @data mov ds, ax push…
maya
  • 51
  • 2
0
votes
1 answer

about esp stack balance

I saw a piece of code like this in asm: .text:787924E0 testcall proc near .text:787924E0 .text:787924E0 var_F0 = dword ptr -0F0h .text:787924E0 var_34 = byte ptr -34h .text:787924E0 retValue =…
Tony
  • 35
  • 1
  • 6