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
0 answers

How to work with FP in C

I am trying to learn and better understand FP(BP), which according to my textbook is "FP(BP): point to the stack frame of current active function". I have learned that the stack frame link list ends in 0. Therefore, in order to print out the stack…
Birdman
  • 1,404
  • 5
  • 22
  • 49
0
votes
0 answers

Print the stack frame link list and Hex contents of stack from FP to stack frame

I'm given the following code: #include #include int A(int x, int y); int B(int x, int y); int *FP; int main(int argc, char *argv[], char *env[]){ int a, b, c; printf("enter main\n"); A(a,b); printf("exit main\n"); …
chacha
  • 99
  • 1
  • 8
0
votes
0 answers

What is the callee token, actual argc and descriptor (on the stack)?

Often see the picture of stack like this (it can be another forms but the essence is like): ... args ... thisv actual argc callee token descriptor return address What is the callee token, descriptor and actual argc?
Mano
  • 99
  • 9
0
votes
1 answer

gdb corefile not see function parameters

My application crashed due to uncaught exception (my c++ code throws uncaught exception under certain condition). I am trying to gdb the corefile. The binary library is "not striped". And the stack trace shows the function (my code) from which an…
0
votes
1 answer

mips frame pointer ($fp) global pointer

in this C to MIPS example MIPS frame pointer ($fp) takes one word (4 bytes ) , but what is the use of the other 4 bytes that gcc decided to allocate in the stack frame of main function, is it global pointer $gp thing ?
loko
  • 1
  • 2
0
votes
0 answers

Why is char size 8 bytes in the assembly of this function?

I am using ARM (32-bit). Assume the following function uses a stack frame to store the variables locally. void func() { char ch; //0x8? Shouldn't this be 0x4 with padding? int a, b, c; //each are 0x4 double m, n; //each are 0x8 } The…
w0f
  • 908
  • 9
  • 23
0
votes
1 answer

Reveal stackframe when frame is not on top most?

Seems lldb can only use frame variable to introspect variable whether with debug info or on the start of the method call. But sometimes our code will break on some system or third lib, we may want to introspect the variable or stack. I find a…
Karl
  • 665
  • 4
  • 19
0
votes
0 answers

C call stack uses "ebp" to visit variables, then "esp" seems redundant?

C function uses call stack(stack frame) to push/pop registers before/after function call. If ebp is the frame pointer that's used to visit all variables on stack, then seems esp is redundant? Then why in prolog/epilog of a function call, we operate…
Hind Forsum
  • 9,717
  • 13
  • 63
  • 119
0
votes
1 answer

Get Calling Assembly Project name in MVC5

I have MyAwesomeProject which imports MyAwesomeLogger and calls it: using MyAwesomeLogger; using System.Web.Mvc; public class HomeController : Controller { public ActionResult Index() { var Logger = new LogFactory.GetLogger(); …
Bagzli
  • 6,254
  • 17
  • 80
  • 163
0
votes
1 answer

passing StackFrame Stack trace from derived class

i have a base class that accepts a StackFrame parameter. public ExcpM(string Msg, StackFrame parCallStack = null, bool show = true) { StackFrame LcallStack; if (parCallStack == null) LcallStack= new StackFrame(1, true); else…
Robb_2015
  • 377
  • 1
  • 3
  • 9
0
votes
1 answer

Why does print (absolute value) gives me back ASCII code in gdb

Here is my assambly code: 0x0804841d <+0>: push %ebp 0x0804841e <+1>: mov %esp,%ebp 0x08048420 <+3>: and $0xfffffff0,%esp 0x08048423 <+6>: sub $0x20,%esp 0x08048426 <+9>: movl $0x8,0x1c(%esp) 0x0804842e <+17>: movl …
Ojs
  • 924
  • 1
  • 12
  • 26
0
votes
1 answer

Can I make get a small local array in registers?

I may be forced to write some performance-critical C/C++ code involving several input arrays and a result array (never mind the exact types). For certain reasons I'd like to work on small chunks of my output array, modifying them according to the…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
0
votes
1 answer

What's the return value from a function call if that function doesn't really provide one

Let's say we have following code: int func(char str[], int len) { // Don't return anything here. } int main() { char str[] = "Hello"; int result = func(str, strlen(str)); printf("%d\n", result); } It will print some string value…
Bill Randerson
  • 1,028
  • 1
  • 11
  • 29
0
votes
1 answer

How to disable RBP frame pointer register optimization in GCC when using -O*?

When I use gcc -O2 to optimize my program, gcc changes the value of register RBP. But I want to keep it as FRAME BASE REGISTER, how to do this? Not the same question as: GCC: Prohibit use of some registers
0
votes
0 answers

Assembly Language Stack Frame and Arrays

I'm trying to create a program in assembly language that copies array X to the stack frame and displays the stack frame on the screen before exit from the procedure. This is what I wrote so far, and it is only giving me errors as it is not compiling…