internal/core: read additional mapping info from the executable

As discussed in https://github.com/derekparker/delve/issues/1121
cores dumped with some versions of GDB are missing LOAD entry mapped to
executables. This change makes viewcore read the mapping info from
the provided executable (with --exe) and stitch the mappings from both
sources. This is how delve works around the issue.

This change also changes how to locate main binary region. Previously
viewcore assumed the first executable region to be the main executable
mapped region. Instead, we use NT_AUXV/AT_ENTRY which exactly specifies
the entry point of the program. This is how GDB and Delve find the entry
point.

Fixes golang/go#28091

Change-Id: I0ccf285592ab02c6cbb1a41b44d1cf7b74ed7d0e
Reviewed-on: https://go-review.googlesource.com/c/142837
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
3 files changed
tree: 964142aaba71805f5486adccdcae7aae9e14bb3d
  1. cmd/
  2. internal/
  3. AUTHORS
  4. codereview.cfg
  5. CONTRIBUTING.md
  6. CONTRIBUTORS
  7. LICENSE
  8. README.md
README.md

Go Debug

This repository holds utilities and libraries for debugging Go programs.

WARNING! Please expect breaking changes and unstable APIs. Most of them are currently are at an early, experimental stage.

Report Issues & Send Changes