Repository: go
Issue: x/debug/cmd/viewcore: cannot read core dump -- nil pointer in (*heapInfo).IsPtr()
Labels: NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.15.5 linux/amd64
</pre>

### Does this issue reproduce with the latest release?

I'm going to assume this means viewcore release because I don't think the go release matters here much.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ajwerner/.cache/go-build"
GOENV="/home/ajwerner/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ajwerner/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ajwerner"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ajwerner/src/golang.org/x/debug/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build014276699=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

Tried to load up viewcore on a coredump file and it just would not load.

### What did you expect to see?

The prompt.

### What did you see instead?

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x72d4c9]

goroutine 1 [running]:
golang.org/x/debug/internal/gocore.(*heapInfo).IsPtr(...)
	/home/ajwerner/src/golang.org/x/debug/internal/gocore/object.go:344
golang.org/x/debug/internal/gocore.(*Process).isPtrFromHeap(0xc000314160, 0xc000ef6000, 0x0)
	/home/ajwerner/src/golang.org/x/debug/internal/gocore/object.go:134 +0xa9
golang.org/x/debug/internal/gocore.(*Process).markObjects(0xc000314160)
	/home/ajwerner/src/golang.org/x/debug/internal/gocore/object.go:101 +0x87b
golang.org/x/debug/internal/gocore.Core(0xc000184000, 0x17, 0x0, 0x0)
	/home/ajwerner/src/golang.org/x/debug/internal/gocore/process.go:160 +0x305
main.readCore(0xc00017dc90, 0x767e46, 0x817dc0, 0xc000114f30)
	/home/ajwerner/src/golang.org/x/debug/cmd/viewcore/main.go:266 +0xd8
main.runRoot(0xb49920, 0xc000122300, 0x0, 0x2)
	/home/ajwerner/src/golang.org/x/debug/cmd/viewcore/main.go:288 +0x55
github.com/spf13/cobra.(*Command).execute(0xb49920, 0xc000132020, 0x2, 0x2, 0xb49920, 0xc000132020)
	/home/ajwerner/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:766 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xb49920, 0x887ca2, 0x1, 0xc00017df00)
	/home/ajwerner/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852 +0x2fe
github.com/spf13/cobra.(*Command).Execute(...)
	/home/ajwerner/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:800
main.main()
	/home/ajwerner/src/golang.org/x/debug/cmd/viewcore/main.go:244 +0x11f
```

The core file can be found here: https://drive.google.com/file/d/1079KQRkl1tfBV1eRXGfTYORYMejGMgFB/view?usp=sharing
The binary can be found here: https://drive.google.com/file/d/1K0TRmVtihkfNSn3icE2bh9C8S2sMQ--I/view?usp=sharing
The os image on GCP was: `ubuntu-2004-focal-v20210119a`