Stack trace

from Wikipedia, the free encyclopedia

In information technology, the output and interpretation of the content of the stack is referred to as a stack trace (“stack (memory) tracing ”) or in .NET Stackwalk . A stack trace is usually created for diagnostic purposes in the event of a program crash, because it can be used to reconstruct the call cascade that led to the error.

Usually the return addresses of the procedures that called the next procedure are stored on the stack . This creates a list of procedure addresses, the tracing of which makes it possible to identify the path of procedure calls from the start of the program to the current status.

This is particularly useful in the event of an error. A function often produces an error if it receives incorrect parameters. Since the programmer does not always know which ( operating system ) function will ultimately be called by his program, he can use the stack trace to determine at which point in his program a function was called that led to the error.

For this reason, for example, a stack trace is output by default under Linux after a kernel panic .

Stack trace in Java

In the Java programming language , the stack trace is an integral part of the language and is linked to the concept of exception handling:

try {
  doSomething();
} catch(Exception exc) {
  exc.printStackTrace();
}

The output of the stack trace looks like this, for example:

java.lang.ArrayIndexOutOfBoundsException: 3
  at example.common.TestTry.execute(TestTry.java:17)
  at example.common.TestTry.main(TestTry.java:11)

No hex dump with register contents is output, but the stack trace as text. This information enables the programmer to localize and correct an error that occurs during program execution more quickly.

Individual evidence

  1. https://technet.microsoft.com/en-us/dd392323(v=vs.85).aspx ?