diff options
author | Shenghou Ma <minux.ma@gmail.com> | 2014-05-10 13:35:40 -0400 |
---|---|---|
committer | Shenghou Ma <minux.ma@gmail.com> | 2014-05-10 13:35:40 -0400 |
commit | 8dfd5184abb7d363741cb1a71045a5bea3cd4271 (patch) | |
tree | bdcf64851979acbbfbd23ff8b52939bb78fa1beb /src/cmd/addr2line | |
parent | b600de755d0c6fd01d8168654e5d77d13ee5596e (diff) | |
download | go-8dfd5184abb7d363741cb1a71045a5bea3cd4271.tar.gz go-8dfd5184abb7d363741cb1a71045a5bea3cd4271.zip |
cmd/addr2line: accept optional "0x" prefix for addresses.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/91250043
Diffstat (limited to 'src/cmd/addr2line')
-rw-r--r-- | src/cmd/addr2line/main.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/addr2line/main.go b/src/cmd/addr2line/main.go index 23d02442b1..d6d14a7330 100644 --- a/src/cmd/addr2line/main.go +++ b/src/cmd/addr2line/main.go @@ -8,7 +8,7 @@ // Usage: // go tool addr2line binary // -// Addr2line reads hexadecimal addresses, one per line and without a 0x prefix, +// Addr2line reads hexadecimal addresses, one per line and with optional 0x prefix, // from standard input. For each input address, addr2line prints two output lines, // first the name of the function containing the address and second the file:line // of the source code corresponding to that address. @@ -88,7 +88,7 @@ func main() { fmt.Fprintf(stdout, "!reverse translation not implemented\n") continue } - pc, _ := strconv.ParseUint(p, 16, 64) + pc, _ := strconv.ParseUint(strings.TrimPrefix(p, "0x"), 16, 64) file, line, fn := tab.PCToLine(pc) name := "?" if fn != nil { |