internal/core: change how to determine the main binary

Previously, viewcore assumed that the first executable ELF
binary is the main binary and tried to get symbols and DWARF
out of it. We found the assumption can be wrong for the binary
compiled with pie or has mix of other languages.

Here we change the heuristic to determine the main binary:
the first executable mappings found from the note section.
This is consistent with the assumption we used to determine
when to utilize the --exe flag value while processing NT_FILE
records.

Also, this CL eliminates the file not found error type but utilizes
os.IsNotExist.

Change-Id: I0a41ffa7c81808d278a27f3d55a1fba204e39508
Reviewed-on: https://go-review.googlesource.com/c/137375
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2 files changed
tree: c766c1f8b8ccad3cad874b642fb28685a5d2bdb1
  1. AUTHORS
  2. CONTRIBUTING.md
  3. CONTRIBUTORS
  4. LICENSE
  5. README.md
  6. cmd/
  7. codereview.cfg
  8. internal/
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