-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/debug/cmd/viewcore: NPE in readDebugInfo #44757
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Comments
tbg
changed the title
x/debug/cmd/viewcore: NPE in
x/debug/cmd/viewcore: NPE in readDebugInfo
Mar 3, 2021
CC @hyangah, @randall77 via owners. |
dmitshur
added
the
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
label
Mar 5, 2021
seankhliao
changed the title
x/debug/cmd/viewcore: NPE in readDebugInfo
x/debug/cmd/viewcore: NPE in readDebugInfo
Jun 18, 2021
Change https://go.dev/cl/506558 mentions this issue: |
gopherbot
pushed a commit
to golang/debug
that referenced
this issue
Jun 30, 2023
Loading a new core.Process in core.Core is a rather long, complex process. Currently, this function creates a stub Process with very few fields set, and then subsequent method calls initially the remaining fields. The problem with this approach is that the inputs/requirements and outputs of these initialization methods is poorly documented. These methods (e.g., readCore) usually have some prerequisite fields in Process that must be set on entry, and some fields that they set prior to return. Neither of these are well documented, and many are far from obvious. For example, Process.mainExecName is initialized in readCore -> readNote -> readNTFile -> openMappedFile. This is made more of a mess by the fact that Process tries to do most initialization with a single pass, resulting in fields getting initialized in unintuitive locations (such as mainExecName). These combine to make refactoring to support new functionality difficult, as changing ordering breaks implicit dependencies between methods. This CL addresses these issues by eliminating the iterative initialization of Process. Instead, Process is only instantiated once all fields are ready. During loading, all work is done by free functions/types, where inputs and outputs are explicit via function arguments/returns. This may inadvertently improve golang/go#44757, as it makes main binary lookup more explicit. This CL intends to keep behavior the same, but there are a few changes: * If the entry point is unknown, We no longer apply the heuristic of assuming that first executable mapping is the main binary. This could be added back, but it is probably better to ensure that the entry point is available on all architectures. * Failure to ELF parse a file for symbols isn't a hard error (as the mapped file might not even be an ELF). For golang/go#57447. Change-Id: I7c3712ccb99ceddddc6adbae57d477c25ff4e5ba Reviewed-on: https://go-review.googlesource.com/c/debug/+/506558 Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Use
viewcore
as of golang/debug@6a9ae25 on these filesI instrumented
readDebugInfo
and basically it was looking up the empty string in the map here and then crashing:It works with this invocation:
(I got that string from
fmt.Println(p.files)
above.What did you expect to see?
I would've either expected an error asking me to set
--exe
or, better, it auto-inferring the executable name correctly.What did you see instead?
An opaque NPE.
The text was updated successfully, but these errors were encountered: