cmd/viewcore: print correct argument when parsing fails This can result in an out-of-bounds failure instead of a parsing error as one expects. Change-Id: Iad88f5688d3967bcbe92bf4c91923a3b975e9e07 Reviewed-on: https://go-review.googlesource.com/c/debug/+/699976 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Nicolas Hillegeer <aktau@google.com> Reviewed-by: Annie Poláková <annieplkv@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/cmd/viewcore/main.go b/cmd/viewcore/main.go index f1106de..8386507 100644 --- a/cmd/viewcore/main.go +++ b/cmd/viewcore/main.go
@@ -622,12 +622,12 @@ } n, err := strconv.ParseInt(args[0], 16, 64) if err != nil { - exitf("can't parse %q as an object address\n", args[1]) + exitf("can't parse %q as an object address\n", args[0]) } a := core.Address(n) obj, _ := c.FindObject(a) if obj == 0 { - exitf("can't find object at address %s\n", args[1]) + exitf("can't find object at address %s\n", args[0]) } // Breadth-first search backwards until we reach a root. @@ -734,7 +734,7 @@ } n, err := strconv.ParseInt(args[0], 16, 64) if err != nil { - exitf("can't parse %q as an object address\n", args[1]) + exitf("can't parse %q as an object address\n", args[0]) } a := core.Address(n) if len(args) < 2 { @@ -742,7 +742,7 @@ } else { n, err = strconv.ParseInt(args[1], 10, 64) if err != nil { - exitf("can't parse %q as a byte count\n", args[2]) + exitf("can't parse %q as a byte count\n", args[1]) } } if !p.ReadableN(a, n) {