Print stack trace
Closed this issue · 7 comments
It would be helpful to print the function stack in times I forget where I am in the current goroutine.
implementation note: debug.PrintStack() prints the stack for you.
http://stackoverflow.com/questions/19094099/how-to-dump-goroutine-stacktraces
Also I see the docs for debug.Stack() say it is deprecated in favor of runtime.Stack(). Not sure which is called by debug.PrintStack() these days.
The full default stack trace with arg values is probably too noisy. Perhaps even just the function names are enough, but I could see how file/line could be helpful too.
If there's ever a feature to examine other stack frames (move up/down the stack), this feature could be reused for that navigation.
Perhaps the goroutine number would be useful too.
Here's the stack trace you get from runtime.Stack(): http://play.golang.org/p/TzttmeRRD0
The runtime package also exports a Func type that we could use to build a cleaner trace.
Here's an example of using runtime.Func to make a cleaner stack trace: http://play.golang.org/p/3BiuMP_ocl
I assume that additional information is to allow those debugging the generated assembly to do so. Hence it is valuable (perhaps essential) to some. I don't find it distracting; I would leave it "uncleaned".