Questions tagged [stack-trace]

A report of the active stack frames at a certain point in time during the execution of a program.

A stack trace is a report of the active stack frames at a certain point in time during the execution of a program and is often referred to as a stack backtrace.

A stack trace is commonly used during interactive and post-mortem debugging. It typically lists all the functions awaiting return values on the stack at the time of the error. By examining what is on the stack and comparing it to what you expect, you can often determine how the error occurred. By inspecting the function containing the error, you may be able to edit and correct the problem.

A stack trace allows to track the sequence of nested functions called up to the point where the stack trace is generated. In a post-mortem scenario this is up to function where the failure occurred (but not necessarily is caused there). Sibling function calls are not visible in a stack trace.

Before you start

Please browse the list of frequently asked questions to see if your question is similar to one that has already been answered.

The tag should be used to mark questions related to generating, interpreting, debugging, or otherwise understanding stack traces.

2320 questions
54
votes
5 answers

Getting stacktrace in logger

I am using log4j to log my exceptions. I want to log whatever I get in e.printStackTrace(); My code looks like this: try { } catch(Exception e) { log.error("Exception is:::" + e); } But the content I get logged looks like this: 2012-02-02…
Geek
  • 3,187
  • 15
  • 70
  • 115
53
votes
1 answer

How can I force Ruby to show a full stack trace?

I just got this error message: ... from c:/ruby/lib/ruby/gems/1.8/gems/... ... 10 levels... from c:/ruby/lib/ruby/gems/1.8/gems/... ... and the bug (of course) is hidden somewhere in ... 10 levels.... How can I force Ruby to show a full stack…
Željko Filipin
  • 56,372
  • 28
  • 94
  • 125
52
votes
5 answers

Print stack trace information from C#

As part of some error handling in our product, we'd like to dump some stack trace information. However, we experience that many users will simply take a screenshot of the error message dialog instead of sending us a copy of the full report available…
Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
52
votes
2 answers

What is PurpleEventCallback?

In the stack trace of my iPhone application, I see a call to something called PurpleEventCallback. I wasn't able to find any documentation for it. What is this?
Manav
  • 10,094
  • 6
  • 44
  • 51
49
votes
3 answers

Print full call stack on printStackTrace()?

I need to write small a log analyzer application to process some log files generated by a 3rd party closed source library (having custom logger inside) used in my project. In case of an exception entry in the log I need to collect aggregated…
akarnokd
  • 69,132
  • 14
  • 157
  • 192
48
votes
3 answers

What's Dead & Exploded in Swift's exception stack?

In the exception stack for runtime crashes, Swift often says arguments are Dead or Exploded. What does it mean, and does it matter for debugging purposes? For example: -> 0x100209cf0
DenverCoder9
  • 3,635
  • 3
  • 31
  • 57
46
votes
3 answers

Programmatically get C# Stack Trace

Possible Duplicate: How to print the current Stack Trace in .NET without any exception? When an exception is thrown, its text contains the stack trace. Can I somehow obtain the stack trace text(including file and line) without exceptions? public…
Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
45
votes
4 answers

What is the difference between Call Stack and Stack Trace?

What is the difference between the terms "Call Stack" and "Stack Trace" ?
pencilCake
  • 51,323
  • 85
  • 226
  • 363
44
votes
4 answers

How to map function address to function in *.so files

backtrace function give set of backtrace how to map it with function name/file name/line number? for ex:- backtrace() returned 8 addresses ./libtst.so(myfunc5+0x2b) [0xb7767767] ./libtst.so(fun4+0x4a) [0xb7767831] ./libtst.so(fun3+0x48)…
Thangaraj
  • 3,038
  • 7
  • 40
  • 43
43
votes
12 answers

Incorrect stacktrace by rethrow

I rethrow an exception with "throw;", but the stacktrace is incorrect: static void Main(string[] args) { try { try { throw new Exception("Test"); //Line 12 } catch (Exception ex) { throw; //Line…
Floyd
  • 1,898
  • 12
  • 20
42
votes
21 answers

Java logger that automatically determines caller's class name

public static Logger getLogger() { final Throwable t = new Throwable(); final StackTraceElement methodCaller = t.getStackTrace()[1]; final Logger logger = Logger.getLogger(methodCaller.getClassName()); …
yanchenko
  • 56,576
  • 33
  • 147
  • 165
41
votes
2 answers

When will proper stack traces be provided on window.onError function?

Exceptions/Errors in many other programming languages (say java, ruby) always provide stacktrace/backtrace information. In JavaScript unhandled Errors get caught by window.onError. Although that function does not get the Error object, so we have no…
Dimitris Zorbas
  • 5,187
  • 3
  • 27
  • 33
40
votes
6 answers

How to get line number(s) in the StackTrace of an exception thrown in .NET to show up

MSDN says this about the StackTrace property of the Exception class: The StackTrace property holds a stack trace, which you can use to determine where in the code the error occurred. StackTrace lists all the called methods that preceded the…
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187
39
votes
5 answers

Log4j formatting: Is it possible to truncate stacktraces?

I want to log only the first few lines of Exceptions in my program. I know, I can do something like this to print only the first 5 lines of a stacktrace: Throwable e = ...; StackTraceElement[] stack = e.getStackTrace(); int maxLines = (stack.length…
rompetroll
  • 4,781
  • 2
  • 37
  • 50
39
votes
5 answers

How do I get a stack trace in OCaml?

The Objective Caml language will only produce stack traces if you ask for them just right - what are the requirements for both bytecode and native code?
Thelema
  • 14,257
  • 6
  • 27
  • 35