What do these numbers in a stack trace mean?

Viewed 190
goroutine 1 [running]:
runtime/debug.Stack(0x467a05, 0xc000000180, 0x200000003)
        /usr/lib/golang/src/runtime/debug/stack.go:24 +0x80
runtime/debug.PrintStack()
        /usr/lib/golang/src/runtime/debug/stack.go:16 +0x18
main.test3()
        /tmp/test_stacktrace.go:18 +0x101

How do you understand these words as follow?

0x467a05, 0xc000000180, 0x200000003 +0x80 +0x18 +0x101

1 Answers

Those are the raw (computer-instruction-level) values of various arguments passed to various functions. Well, that is, the ones in parentheses—the +0x101 is the program counter offset in the machine code.

To make sense of them, you must look at the raw computer code, or use a debugger. Debuggers use trace information that the compiler leaves behind to translate from "computer register %rax holds 0x467a05" (or whatever) into "variable x holds value ..." (for some value, maybe a string for instance).

If you're not sure what they represent, concentrate instead just on the names and line numbers in the stack trace. You were in function main.test3 at line 18 when you called function PrintStack in the runtime code.

Related