Project

General

Profile

Actions

Feature #8661

closed

Add option to print backtrace in reverse order (stack frames first and error last)

Added by gary4gar (Gaurish Sharma) over 10 years ago. Updated over 2 years ago.

Status:
Closed
Target version:
-
[ruby-core:56096]

Description

Currently, the way ruby prints backtrace is that the error comes first and then the stack frames, like this:

  Main Error Message
stack frame 1
stack frame 2
stack frame 3
.....

This is perfectly fine provided:

  1. Backtraces are short, and fits in terminal, hence, there is no need to scroll.
  2. You read it from top to bottom.

But, I am a rails developer where

  1. Backtraces are HUGE, therefore seldom fit in terminal, which means that a LOT of scrolling is needed every time I get an error.
  2. In terminal, I tend to read backtraces from bottom to top, especially when tailing (tail -f) production logs.
  3. I practice test-driven development, and spend most of my time scrolling to read backtraces, and ended up buying a larger display.

Proposed Solution:
Please add a way to configure backtraces to be printed in reverse order so that if I am reading from the bottom, say from the terminal, I can get to the main error message without scrolling, like this:

stack frame 3
stack frame 2
stack frame 1
 Main Error Message
..... 

This would save a lot of time because when the error message is printed at the bottom, there would be no need to scroll to read it. I am not sure if this can be done today. I tried overriding Exception#backtrace, but it caused a stack level too deep and illegal hardware instruction error.

Attached is a comparison of how a backtrace currently looks like and how I want the option to make it look.


Files

current.log (5.13 KB) current.log here is currently backtraces are printed gary4gar (Gaurish Sharma), 07/21/2013 05:20 AM
proposed.log (4.9 KB) proposed.log here is how I wish they could printed, so its easier read in terminal gary4gar (Gaurish Sharma), 07/21/2013 05:20 AM

Related issues 2 (1 open1 closed)

Related to Ruby master - Feature #16684: Use the word "to" instead of "from" in backtraceOpenActions
Related to Ruby master - Bug #17413: --backtrace-limit: wrong level counterClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like1Like0Like1Like1Like1Like0Like1Like1Like0Like0Like1Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0