gocore: overhaul roots, expand testing

This change overhauls how roots work to prepare for supporting composite
values (roots "de-structured" and broken up into pieces, despite
representing a single type). It also expands testing a little bit to
prevent backsliding from this point.

Roots now do not have an address identity at all, and callers do not
rely on that fact anymore. They have a forged identity which is useful
for some calculations, but otherwise can only be identified by a *Root.

Pointers may now be found in composite roots, which is nice, so all
destructured values work correctly for the sake of iterating over all
pointers.

Finally, this fixes a small, old bug in typeObject where the type
pointer would be interrogated before we filtered out whether a interface
was nil or not. Because we filter dead pointers by making them appear
nil, this means we could end up looking at a bogus, clobbered type
pointer. (This may be a bug in the compiler's DWARF generation, the type
shouldn't be clobbered.)

Change-Id: I09217b2070dc6f4bf4b1dbd28d52f570ba61ca4a
Reviewed-on: https://go-review.googlesource.com/c/debug/+/635857
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 files changed
tree: 5427bdba38d2605b94965fdd44ba5a9103e674f7
  1. cmd/
  2. dwtest/
  3. internal/
  4. third_party/
  5. codereview.cfg
  6. CONTRIBUTING.md
  7. go.mod
  8. go.sum
  9. LICENSE
  10. README.md
README.md

Go Debug

Go Reference

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 Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.

The git repository is https://go.googlesource.com/debug.

The main issue tracker for the debug repository is located at https://go.dev/issues. Prefix your issue with “x/debug:” in the subject line, so it is easy to find.