Skip to content

x/debug/cmd/viewcore: missing executable shows as panic #27322

Closed
@rhysh

Description

@rhysh

What version of Go are you using (go version)?

$ go1.10 version
go version go1.10.4 darwin/amd64
$ (cd $(go list -f '{{.Dir}}' golang.org/x/debug/cmd/viewcore) && git rev-parse HEAD)
1ff449a1b670fb60da59e170803373318549b845

Does this issue reproduce with the latest release?

This is the latest revision of golang.org/x/debug/cmd/viewcore, golang/debug@1ff449a. It fails with go1.10.4 and also with go1.11.

What operating system and processor architecture are you using (go env)?

I'm using a darwin/amd64 machine to load a linux/amd64 core dump.

$ go1.10 env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rhys/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/rhys/go"
GORACE=""
GOROOT="/Users/rhys/go/version/go1.10"
GOTMPDIR=""
GOTOOLDIR="/Users/rhys/go/version/go1.10/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/49/zmds5zsn75z1283vtzxyfr5hj7yjq4/T/go-build447726636=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I ran viewcore with a core file. I did not specify an executable. The executable is not available on my machine at the path described in the core file.

What did you expect to see?

I expected an error message reminding me to specify the location of the executable with the --exe argument.

What did you see instead?

$ viewcore /path/to/core-file
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xf0 pc=0x128f9a6]

goroutine 1 [running]:
debug/dwarf.(*Reader).Seek(0xc42190c000, 0xc400000000)
	/usr/local/go/src/debug/dwarf/entry.go:543 +0x76
debug/dwarf.(*Data).Reader(0x0, 0x0)
	/usr/local/go/src/debug/dwarf/entry.go:526 +0x5f
golang.org/x/debug/internal/gocore.(*Process).readDWARFTypes(0xc42190a000)
	/Users/rhys/go/src/golang.org/x/debug/internal/gocore/dwarf.go:22 +0x55
golang.org/x/debug/internal/gocore.Core(0xc420144000, 0x70, 0x0, 0x0)
	/Users/rhys/go/src/golang.org/x/debug/internal/gocore/process.go:141 +0xca
main.readCore(0x4, 0x4, 0x4, 0x3)
	/Users/rhys/go/src/golang.org/x/debug/cmd/viewcore/main.go:260 +0xd1
main.runRoot(0x169dde0, 0x16c1f38, 0x0, 0x0)
	/Users/rhys/go/src/golang.org/x/debug/cmd/viewcore/main.go:279 +0x47
golang.org/x/debug/cmd/viewcore/vendor/github.com/spf13/cobra.(*Command).execute(0x169dde0, 0xc42000c070, 0x0, 0x0, 0x169dde0, 0xc42000c070)
	/Users/rhys/go/src/golang.org/x/debug/cmd/viewcore/vendor/github.com/spf13/cobra/command.go:766 +0x2c1
golang.org/x/debug/cmd/viewcore/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x169dde0, 0xc420022580, 0x169e040, 0x169e2a0)
	/Users/rhys/go/src/golang.org/x/debug/cmd/viewcore/vendor/github.com/spf13/cobra/command.go:852 +0x30a
golang.org/x/debug/cmd/viewcore/vendor/github.com/spf13/cobra.(*Command).Execute(0x169dde0, 0x1447cf3, 0x1)
	/Users/rhys/go/src/golang.org/x/debug/cmd/viewcore/vendor/github.com/spf13/cobra/command.go:800 +0x2b
main.main()
	/Users/rhys/go/src/golang.org/x/debug/cmd/viewcore/main.go:238 +0xbf

CC @heschik

Activity

added this to the Unreleased milestone on Aug 28, 2018
randall77

randall77 commented on Aug 28, 2018

@randall77
Contributor
added
NeedsFixThe path to resolution is known, but the work has not been done.
on Aug 30, 2018
gopherbot

gopherbot commented on Sep 20, 2018

@gopherbot
Contributor

Change https://golang.org/cl/136516 mentions this issue: cmd/viewcore: don't panic because of missing executable

locked and limited conversation to collaborators on Sep 21, 2019
added a commit that references this issue on May 6, 2025
547453c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rhysh@FiloSottile@randall77@gopherbot

        Issue actions

          x/debug/cmd/viewcore: missing executable shows as panic · Issue #27322 · golang/go