Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/gocore: find new names of runtime._type and runtime.itab
This change makes (e.g.) `viewcore histogram` run without crashing cores produced by current toolchains again. The output is still partially wrong, in the sense that it outputs a mixture of named and unnamed types: runtime.g size=448 []*runtime.moduledata size=24 [1+1?]*runtime.moduledata size=16 [10+6?]uint8 size=16 [1+3?]uint32 size=16 Still it's an improvement over the status quo. In Go 1.21, runtime._type was converted from its own type into an alias of internal/abi.Type. In the process, its fields became public too. For an overview of the history: - https://go.dev/cl/462995 (internal/abi: refactor (basic) type struct into one definition) - https://go.dev/cl/484856 (internal/reflectlite, runtime: move more constants and types into internal/abi) - https://go.dev/cl/488435 (runtime: redefine _type to abi.Type; add rtype for methods) In https://go.dev/cl/608475 (internal/gocore: support Go 1.22 allocation headers), this was partially reflected in viewcore, but only just enough to get basic tests for the current toolchain working. There were still references to the old `runtime._type` and `runtime.itab` (renamed `abi.ITab`), causing crashes for certain operations, like `viewcore histogram` as well as the nascent dominator tree code: panic: can't find type runtime._type [recovered] panic: can't find type runtime._type golang.org/x/debug/internal/gocore.(*Process).findType(...) /home/aktau/go/debug/internal/gocore/process.go:112 golang.org/x/debug/internal/gocore.(*Process).runtimeType2Type(0xc00026a000, 0x46d8a0, 0x4ee3a8) /home/aktau/go/debug/internal/gocore/type.go:153 +0x14d9 golang.org/x/debug/internal/gocore.(*Process).typeObject(0xc00026a000, 0x4ee3a0, 0xc000392460, {0x7b9e40, 0xc0001f4000}, 0xc00052d960) /home/aktau/go/debug/internal/gocore/type.go:636 +0xd45 golang.org/x/debug/internal/gocore.(*Process).typeHeap.func1.2(0xc000582a08?) /home/aktau/go/debug/internal/gocore/type.go:514 +0x79 golang.org/x/debug/internal/gocore.(*Process).ForEachRoot(0xc00026a000, 0xc00052db20) /home/aktau/go/debug/internal/gocore/object.go:220 +0x6a golang.org/x/debug/internal/gocore.(*Process).typeHeap.func1() /home/aktau/go/debug/internal/gocore/type.go:509 +0x179 sync.(*Once).doSlow(0x6fe760?, 0xc00026a000?) /usr/lib/google-golang/src/sync/once.go:76 +0xb4 sync.(*Once).Do(...) /usr/lib/google-golang/src/sync/once.go:67 golang.org/x/debug/internal/gocore.(*Process).typeHeap(0x3?) /home/aktau/go/debug/internal/gocore/type.go:383 +0x3b golang.org/x/debug/internal/gocore.runLT(0xc00026a000) /home/aktau/go/debug/internal/gocore/dominator.go:89 +0x58 golang.org/x/debug/internal/gocore.TestVersions.func2.1(0xc00012c680) /home/aktau/go/debug/internal/gocore/gocore_test.go:513 +0x5e Change-Id: I8559c86f03d52b114f92756caf4487df75237983 Reviewed-on: https://go-review.googlesource.com/c/debug/+/634755 Auto-Submit: Nicolas Hillegeer <aktau@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Commit-Queue: Nicolas Hillegeer <aktau@google.com>
- Loading branch information