Skip to content

Instantly share code, notes, and snippets.

@wayneeseguin
Created April 28, 2011 23:01
Show Gist options
  • Save wayneeseguin/947529 to your computer and use it in GitHub Desktop.
Save wayneeseguin/947529 to your computer and use it in GitHub Desktop.
Which stack trace option yields the most useful information best?
Note: This part of the discussion is now over, #1 was the "winner" :)
See the other file for Part II of the discussion and the end result.
# Option 1 - Tabular
5. fail() 266 /usr/local/bdsm/modules/bash/logging/dsl
4. module_dsl() 236 /usr/local/bdsm/modules/bash/modules/dsl
3. source() 3 /usr/local/bdsm/extensions/mod/bin/dsl
2. extension_action() 152 /usr/local/bdsm/modules/bash/extensions/dsl
1. main() 76 /usr/local/bin/bdsm
# Option 2 - Nested, by function
main() 76 /usr/local/bin/bdsm
extension_action() 152 /usr/local/bdsm/modules/bash/extensions/dsl
source() 3 /usr/local/bdsm/extensions/mod/bin/dsl
module_dsl() 236 /usr/local/bdsm/modules/bash/modules/dsl
fail() 266 /usr/local/bdsm/modules/bash/logging/dsl
# Option 3 - Nested, by function, reversed order
fail() 266 /usr/local/bdsm/modules/bash/logging/dsl
module_dsl() 236 /usr/local/bdsm/modules/bash/modules/dsl
source() 3 /usr/local/bdsm/extensions/mod/bin/dsl
extension_action() 152 /usr/local/bdsm/modules/bash/extensions/dsl
main() 76 /usr/local/bin/bdsm
# Option 4 - Nested, by function, reversed order, reversed nesting
fail() 266 /usr/local/bdsm/modules/bash/logging/dsl
module_dsl() 236 /usr/local/bdsm/modules/bash/modules/dsl
source() 3 /usr/local/bdsm/extensions/mod/bin/dsl
extension_action() 152 /usr/local/bdsm/modules/bash/extensions/dsl
main() 76 /usr/local/bin/bdsm
# Option 6 - Tabular, Reversed
1. main() 76 /usr/local/bin/bdsm
2. extension_action() 152 /usr/local/bdsm/modules/bash/extensions/dsl
3. source() 3 /usr/local/bdsm/extensions/mod/bin/dsl
4. module_dsl() 236 /usr/local/bdsm/modules/bash/modules/dsl
5. fail() 266 /usr/local/bdsm/modules/bash/logging/dsl
# BDSM Framework Backtraces (bash)
∴ for editor in ' ' less nano vi vim emacs mvim mate; do export EDITOR="${editor:-}"; printf "\n\nEDITOR: ${EDITOR:-}\n"; bdsm module dingus; done
EDITOR:
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() $ +# source file
===============================================================================================
fail() $ +265 /usr/local/bdsm/modules/bash/logging/dsl
extension_action() $ +84 /usr/local/bdsm/modules/bash/extensions/dsl
main() $ +76 /usr/local/bin/bdsm
===============================================================================================
EDITOR: less
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() $ +# source file
===============================================================================================
fail() $ less +265 /usr/local/bdsm/modules/bash/logging/dsl
extension_action() $ less +84 /usr/local/bdsm/modules/bash/extensions/dsl
main() $ less +76 /usr/local/bin/bdsm
===============================================================================================
EDITOR: nano
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() $ +# source file
===============================================================================================
fail() $ nano +265 /usr/local/bdsm/modules/bash/logging/dsl
extension_action() $ nano +84 /usr/local/bdsm/modules/bash/extensions/dsl
main() $ nano +76 /usr/local/bin/bdsm
===============================================================================================
EDITOR: vi
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() $ +# source file
===============================================================================================
fail() $ vi +265 /usr/local/bdsm/modules/bash/logging/dsl
extension_action() $ vi +84 /usr/local/bdsm/modules/bash/extensions/dsl
main() $ vi +76 /usr/local/bin/bdsm
===============================================================================================
EDITOR: vim
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() $ +# source file
===============================================================================================
fail() $ vim +265 /usr/local/bdsm/modules/bash/logging/dsl
extension_action() $ vim +84 /usr/local/bdsm/modules/bash/extensions/dsl
main() $ vim +76 /usr/local/bin/bdsm
===============================================================================================
EDITOR: emacs
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() $ +# source file
===============================================================================================
fail() $ emacs +265 /usr/local/bdsm/modules/bash/logging/dsl
extension_action() $ emacs +84 /usr/local/bdsm/modules/bash/extensions/dsl
main() $ emacs +76 /usr/local/bin/bdsm
===============================================================================================
EDITOR: mvim
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() Source
===============================================================================================
fail() mvim://open?url=file:///usr/local/bdsm/modules/bash/logging/dsl&line=265
extension_action() mvim://open?url=file:///usr/local/bdsm/modules/bash/extensions/dsl&line=84
main() mvim://open?url=file:///usr/local/bin/bdsm&line=76
===============================================================================================
EDITOR: mate
Action binary/file dingus missing for extension mod
(/usr/local/bdsm/extensions/mod/bin/dingus)
function() Source
===============================================================================================
fail() mate://open?url=file:///usr/local/bdsm/modules/bash/logging/dsl&line=265
extension_action() mate://open?url=file:///usr/local/bdsm/modules/bash/extensions/dsl&line=84
main() mate://open?url=file:///usr/local/bin/bdsm&line=76
===============================================================================================
@omarqureshi
Copy link

1 or 4 - both equally good imo

@ajsharp
Copy link

ajsharp commented Apr 28, 2011

@dominikh
Copy link

--> 2. (reasons, copied from twitter): #4 is plain confusing because of the reversed order, #3 is hard to follow, #1 is not very clear on the eyes

Edit of edit: god damn markup.

@nuclearsandwich
Copy link

I like 4 but wonder if it won't get hard to fit after a deeply nested error. Second choice is 1.

Edit: rebuttal of @dominikh's comment. The reversed order is helpful because you see the immediate context of the error first and can follow downward to see how you got there.

@dominikh
Copy link

@nuclearsandwich the problem is that from most tools, and even non-computer fields, we're used to that nesting in the form of "first fail() happened, then/inside that module_dsl() happened and so on", which obviously is the wrong order.

@dominikh
Copy link

And regarding those who say that the most recent info should be on top: that's not the way terminal output works unless you default to a pager (like git does)

@postmodern
Copy link

Option 2, since your usually looking at the bottom of the screen where the shell prompt is located.

@postmodern
Copy link

Also could you provide a reverse-ordering of Option 1? The indentation thing is kind of annoying.

@zobar
Copy link

zobar commented Apr 28, 2011

  1. Don't bother with the indentation. As the stack trace gets longer it will also get wider and more likely to wrap; with the diagonal left margin it'll be even more difficult to visually distinguish the function name once that starts happening. Failing function first has precedent in almost every other language I've seen, but failing function last would be easier to find scrolling backwards through a logfile. I don't think you need to number the lines.

@postmodern
Copy link

Option 6 way better.

@ryanb
Copy link

ryanb commented Apr 29, 2011

I like option 1 because it presents the (likely) most important information at the top which is where it failed.

I don't see the value of indenting since it is consistent and predictable. Every item will be indented after the next. It also looks like a very deeply nested set of lists where each list is only one item long.

@sudara
Copy link

sudara commented Apr 29, 2011

I like Option 6, with numbering removed. Having the relevant info as close to the bottom makes sense to me, it will prevent having to visually hunt for the most useful information.

Also, there can be a limited nest. This gets rid of the "OMG, it'll indent 4eva" problem while maybe highlighting/increasing readability for the last 4 levels (for example): https://gist.github.com/947599

@jeffrydegrande
Copy link

I prefer option 1, but without the linenumbers ... also, how about displaying line numbers as path:nnn ?

@qmx
Copy link

qmx commented Apr 29, 2011

option 1, as is the (mostly common) standard, IMHO

@lusis
Copy link

lusis commented Apr 29, 2011

Option 1, please. Indentation is hella bad as nesting gets deep and it's honestly the way I've grown accustomed to reading stack traces. It's ingrained to work back up the stack.

@zobar
Copy link

zobar commented Apr 29, 2011

It would be easiest to read if the error message were at the same end of the stack trace as the failing function. [ie, at the top for option 1, or at the bottom for option 6.]

Opinions are like assholes.

@jmitchener
Copy link

Option 6 because it presents the most useful information at the bottom, which is the first thing I will see in my console. Scrolling up sucks.

@postmodern
Copy link

You should change the line number syntax to +30 path/to/file. This will allow one to copy/paste it into a vim / emacsclient command:

vim +30 path/to/script.sh

@wayneeseguin
Copy link
Author

Now that I LOVE :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment