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
cmd/compile: missing types in debug_info #17830
Comments
@crawshaw is this related to your recent changes? |
The only change I've made recently to type information is exporting more symbols when building plugins, which shouldn't have anything to do with this. Maybe you mean someone else's changes? |
Looks like this is a side-effect of 9c066ba |
CL https://golang.org/cl/33233 mentions this issue. |
If I understand correctly, the issue isn't actually that you need DWARF type info for temporary variables, but you need the DWARF type info for map-related struct types, and we used to only emit those because they were referenced in temporary variables? I.e., reverting to the previous behavior where we emit DWARF type info for temporary variables fixes the issue, but really we just need to ensure that we emit info for all of those map-related struct types regardless of whether they're used as temporaries? |
It isn't just map types, if you look at the example type info for main.astruct isn't emitted either. |
@aarzilli Ah, thanks. I misread the type name in the bug report and thought you were talking about map.bucket or something. |
@aarzilli I was re-reviewing the fix for this issue, and I'm wondering: what does delve do with types that are constructed at runtime using reflect APIs? E.g., how does it handle:
|
@mdempsky they are not supported. I have considered writing code to read the runtime._type and turn it directly into a dwarf.Type (without going through debug_info) but: a) I would need the specialized versions of runtime._type (i.e. runtime.slicetype, runtime.maptype, etc) to be exported to debug_info. For (a) I was hoping to propose this change during 1.9 since they are useful for other stuff, (b) is somewhat more fundamental. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
Compiled this with
go build -gcflags='-N -l'
What did you expect to see?
I expected
.debug_info
to have entries for the anonymous typesmap[string]main.astruct
,[]main.astruct
and for the named typemain.astruct
.What did you see instead?
None of those.
I presume this is deliberate and types that are not referenced by any variable are pruned from debug_info. In delve to print the value of an interface variable we used to parse the value of their
tab._type
field to reconstruct the name of the type and then look that up in debug_info, how should we do this now? If the answer is "you should use runtime._type directly" then at leastruntime.slicetype
,runtime.arraytype
,runtime.maptype
, etc... should always be included in debug_info so that we don't have to hardcode them into the debugger for every version of go.The text was updated successfully, but these errors were encountered: