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
15
votes
3 answers

Does calling setTimeout clear the callstack?

Can a stack overflow be avoided in javascript by using the setTimeout method to call a function instead of calling it directly? My understanding of setTimeout is that it should start a new callstack. When i look in the callstack of both chrome and…
Aran Mulholland
  • 23,555
  • 29
  • 141
  • 228
15
votes
5 answers

For C# logging, how do I obtain the call stack depth with minimal overhead?

I have created a wrapper for Log4net (which I may be dropping in favor of NLog; I haven't decided yet), and I indent the logged messages result to give an idea of calling structure. For example: 2011-04-03 00:20:30,271 [CT] DEBUG - …
RenniePet
  • 11,420
  • 7
  • 80
  • 106
15
votes
3 answers

How to dump or search in call stacks of ALL threads in Visual Studio

How to dump or search in call stacks of ALL threads in Visual Studio? We have a server process to debug and it has hundreds of threads running, so it should be hard to manually check each threads. I know "thread apply" in gdb can do this kind of…
superb
  • 963
  • 1
  • 10
  • 21
15
votes
4 answers

How do I debug a difficult-to-reproduce crash with no useful call stack?

I am encountering an odd crash in our software and I'm having a lot of trouble debugging it, and so I am seeking SO's advice on how to tackle it. The crash is an access violation reading a NULL pointer: First chance exception at $00CF0041. …
David
  • 13,360
  • 7
  • 66
  • 130
15
votes
2 answers

Is there a way to filter noisy stack frames from Intellij's debugger?

I'm trying to debug some code using Intellij's debugger, and the call stack is filled with AOP and proxy-related stack frames. It makes it really hard to locate relevant stack frames. Is there a way to filter these besides filtering out all…
w.brian
  • 16,296
  • 14
  • 69
  • 118
15
votes
3 answers

Split stacks unneccesary on amd64

There seems to be an opinion out there that using a "split stack" runtime model is unnecessary on 64-bit architectures. I say seems to be, because I haven't seen anyone actually say that, only dance around it: The memory usage of a typical…
brooks94
  • 3,836
  • 4
  • 30
  • 57
14
votes
2 answers

Why are function parameters pushed earlier on call stack than the return address?

From http://en.wikipedia.org/wiki/Stack_pointer#Structure I am wondering why the return address for a function is placed above the parameters for that function? It makes more sense to have Return Address pushed onto the stack before the Parameters…
Lazer
  • 90,700
  • 113
  • 281
  • 364
14
votes
2 answers

Recursion - Call stack fails to pop when testing the maximum stack size

Basically call stack will start to pop out the function calls one by one when the last-in function call returns. But when ever I try to create a call stack nearer to the size of its maximum, An uncaught expression is getting raised. //Code for…
Rajaprabhu Aravindasamy
  • 66,513
  • 17
  • 101
  • 130
14
votes
1 answer

How to Determine Which Shared Library a Function Belongs to in gdb?

When I get the callstack from gdb, I only get function names and source file information. (gdb) f #0 main (argc=1, argv=0xbffff1d4) at main.c:5 I don't get which Shared Library or Application the function belongs to. On Windows, Windbg or Visual…
jonathan_ou
  • 756
  • 1
  • 7
  • 17
14
votes
2 answers

What does each entry in the Jmp_buf structure hold?

I am running Ubuntu 9.10 (Karmic Koala), and I took a look at the jmp_buf structure which is simply an array of 12 ints. When I use setjmp, and pass in a jmp_buf structure—4 out of 12 entries are saved off. These 4 entries are the stack pointer,…
Setzer
  • 739
  • 4
  • 10
  • 18
14
votes
6 answers

Why can I "fake" the stack trace of an exception in Java?

If I run the following test, it fails: public class CrazyExceptions { private Exception exception; @Before public void setUp(){ exception = new Exception(); } @Test public void…
R. Martinho Fernandes
  • 228,013
  • 71
  • 433
  • 510
14
votes
5 answers

Is it possible to retrieve the call stack programmatically in VB6?

When an error occurs in a function, I'd like to know the sequence of events that lead up to it, especially when that function is called from a dozen different places. Is there any way to retrieve the call stack in VB6, or do I have to do it the…
raven
  • 18,004
  • 16
  • 81
  • 112
13
votes
1 answer

x86 assembly: Pop a value without storing it

In x86 assembly, is it possible to remove a value from the stack without storing it? Something along the lines of pop word null? I could obviously use add esp,4, but maybe there's a nice and clean cisc mnemonic i'm missing?
NeoTheThird
  • 360
  • 3
  • 16
13
votes
2 answers

Is it possible to wrap log.Logger functions without losing the line number prefix?

When using the log.Lshortfile flag, the logger prefixes all log lines with the file name and line number of the logger function call, for example: myfile.go:14: Hello, world! If I wrap the log function like this, for instance: func info(pattern…
Hubro
  • 56,214
  • 69
  • 228
  • 381
13
votes
1 answer

WinDBG View Passed Arguments to Any Function

I'm using windbg to debug an Windows executable. I want to know how I can see arguments passed to any function using WinDBG. For example If I wanna know the parameters passed to function Kernel32!CreatefileA using Immunity Debugger or Olly debugger…
Dev.K.
  • 2,428
  • 5
  • 35
  • 49