Questions tagged [callstack]

A stack that stores details of the functions called by a program in sequence, so that each function can return on completion to the code that called it.

A call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, control stack, run-time stack, or machine stack, and is often shortened to just "the stack".

A call stack is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing. An active subroutine is one that has been called but is yet to complete execution after which control should be handed back to the point of call. Such activations of subroutines may be nested to any level (recursive as a special case), hence the stack structure.

Source: Wikipedia (Call Stack)

For errors relating to overflowing the call stack use .

1119 questions
21
votes
9 answers

Why doesn't my program crash when I write past the end of an array?

Why does the code below work without any crash @ runtime ? And also the size is completely dependent on machine/platform/compiler!!. I can even give upto 200 in a 64-bit machine. how would a segmentation fault in main function get detected in the…
vprajan
  • 1,147
  • 1
  • 11
  • 19
21
votes
4 answers

Stack overflow exception in C# setter

This works: using System; using ConstraintSet = System.Collections.Generic.Dictionary; namespace ConsoleApplication2 { class test { public ConstraintSet a { get; set; } public test() { …
Patrik
  • 845
  • 2
  • 8
  • 20
21
votes
5 answers

Why don't Minidumps give good call stacks?

I've used minidumps on many game projects over the years and they seem to have about a 50% chance of having a valid call stack. What can I do to make them have better call stacks? I've tried putting the latest dbghelp.dll in the exe directory. That…
Tod
  • 4,618
  • 4
  • 32
  • 23
20
votes
1 answer

Obtain a callstack in Clojure

When I run my Clojure programs and get an error during execution, I notice that the message printed by the REPL only contains the top level line number from the script I executed. Can I get it to dump a call stack (which references the various line…
pauldoo
  • 18,087
  • 20
  • 94
  • 116
20
votes
2 answers

Does java have any mechanism for a VM to trace method calls on itself, without using javaagent, etc?

I want to build call graphs on the fly, starting at an arbitrary method call or with a new thread, which ever is easier, from within the running JVM itself. (this piece of software is going to be a test fixture for load testing another piece of…
marathon
  • 7,881
  • 17
  • 74
  • 137
19
votes
4 answers

Why does gcc use movl instead of push to pass function args?

pay attention to this code : #include void a(int a, int b, int c) { char buffer1[5]; char buffer2[10]; } int main() { a(1,2,3); } after that : gcc -S a.c that command shows our source code in assembly. now we can see in…
Pooya
  • 992
  • 2
  • 10
  • 31
19
votes
3 answers

Treating Warnings as Errors

I have a php application that I have just re-factored. Unfortunately it spewing out warnings like: Warning: preg_match() expects parameter 2 to be string, object given in /home/yacoby/dev/netbeans/php/Zend/Db/Select.php on line 776 Which is…
Yacoby
  • 54,544
  • 15
  • 116
  • 120
18
votes
3 answers

Javascript backtrace

How to I get a backtrace in Javascript? Ideal features: entry function name, or some meaningful identifier for anonymous functions, argument list at each level, line numbers. Can this be done in standard ECMAScript? If not, can it be done in the…
spraff
  • 32,570
  • 22
  • 121
  • 229
17
votes
1 answer

Keep call stack closed on breakpoint

Is there a way to keep the call stack panel collapsed in chrome dev tools? It expands every time i hit a breakpoint forcing me to scroll down to the scope. This makes debugging very slow and at times infuriating. Thanks /Eric
HorseFace
  • 385
  • 3
  • 12
17
votes
11 answers

Can a C compiler rearrange stack variables?

I have worked on projects for embedded systems in the past where we have rearranged the order of declaration of stack variables to decrease the size of the resulting executable. For instance, if we had: void func() { char c; int i; …
ryan_s
  • 7,826
  • 3
  • 27
  • 28
17
votes
7 answers

How to get Java Call Stack of a running application

I am working on very huge java web based application. As there is no proper logging done while development so its very difficult for me to put break point and debug the app as i dont know execution order. Is there any mechanism to get complete Call…
naeemgik
  • 2,232
  • 4
  • 25
  • 47
17
votes
3 answers

Array to pointer decay and passing multidimensional arrays to functions

I know that an array decays to a pointer, such that if one declared char things[8]; and then later on used things somewhere else, things is a pointer to the first element in the array. Also, from my understanding, if one declares char…
llakais
  • 1,577
  • 1
  • 12
  • 18
17
votes
1 answer

General query about Callback functions and Threads

I have a general question about a threads and callbacks. Say for example we have a thread running continuously along with the main program. The main program has registered a callback function with the thread. So the thread can call the callback…
16
votes
5 answers

The call stack does not say "where you came from", but "where you are going next"?

In a previous question (Get object call hierarchy), I got this interesting answer: The call stack is not there to tell you where you came from. It is to tell you where you are going next. As far as I know, when arriving at a function call, a…
Yochai Timmer
  • 48,127
  • 24
  • 147
  • 185
16
votes
5 answers

Need a way to periodically log the call stack/stack trace for EVERY method/procedure/function called

I'm working on a very large application where periodically I'd like to log the ENTIRE call stack up until the current execution point (not on an exception). The idea here is that I want a map of the exact code path that led me to the point that I…