5
votes

I was hoping someone could explain to me one small detail of Golang's stack trace, that was mostly disregarded by tutorials I've read. Example of a stack trace I got:


    goroutine 6 [running]:
    net/http.(*conn).serve.func1(0xc42005ad00)
        /usr/local/go/src/net/http/server.go:1491 +0x12a
    panic(0x8079e0, 0xc42000c0c0)
        /usr/local/go/src/runtime/panic.go:458 +0x243
    usos-shop-back/usosapi.GetJson(0x0, 0x7d7820, 0xc4202f6d00, 0x0, 0x0)
        /root/go/src/usos-shop-back/usosapi/usos-hackery.go:20 +0x38
    ...
    ...
    ...

So I'm really curious about what is the meaning of +0x12a, +0x243, +0x38 after the number of a line in code where error occurred.

Thanks, R.C.

P.S.: the panic was caused by a null pointer to func GetJson(*http.Response, interface{}) error

1
It's the difference between the stack frame PC and the function entry PC. (the implementation specific stack trace format probably isn't a good question topic for StackOverflow) - JimB
@JimB, thank you, I've got some wiki articles to read then. However I'd like to know why isn't that a good question topic for SO? Does it lead to flame wars? There is some other XYZexchange for that? - Radosław Cymer
This topic is more of a gray area, mostly because implementation details may not apply to all popular implementations, can change and sometimes change quite quickly, leaving the questions or answers out of date and/or misleading. Not that the stack trace format is likely to change at this point for go1, but for example other GODEBUG output has changed significantly between versions, because it needs to reflect the implementation. - JimB

1 Answers

1
votes

It's the difference between the stack frame PC and the function entry PC.
JimB