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
debug/elf: decoding dwarf section abbrev at offset 0x13: cannot determine class of unknown attribute form #33488
Comments
At first glance it looks like a bug. I'm not sure It would help if you provide a tiny binary that demonstrates the problem, or instructions for how to create one. Thanks. |
Thanks for the reply. You can trigger the issue using Keil uVision and the "Blinky project Silicon Labs 'EFM32 Giant Gecko microcontroller using Silicon Labs 'EFM32GG-STK3700 Starter Kit' Board", available for installation from Here's the debug file compiled on my machine: Blinky.zip With the compiled debug version you can run below go code to get error:
elftest source:
|
I took a look at this as well. As Ian mentioned the problems seem to relate to the handling of FYI, there is some weird DWARF in the binary you posted. Compile units seem to be getting padded with extra null bytes for some reason. Ex: <1><2fa>: Abbrev Number: 80 (DW_TAG_typedef) <2fb> DW_AT_name : uintmax_t <305> DW_AT_type : DW_FORM_ref2 <0xed> <308> DW_AT_decl_file : 1 <309> DW_AT_decl_line : 107 <30a> DW_AT_decl_column : 33 <1><30b>: Abbrev Number: 0 <0><30c>: Abbrev Number: 0 <-1><30d>: Abbrev Number: 0 <-2><30e>: Abbrev Number: 0 <-3><30f>: Abbrev Number: 0 Compilation Unit @ offset 0x310: Note the -2, -3 at the end. |
Writing a regression test for this is proving to be tricky -- neither clang nor gcc seem to emit abbrevs that use DW_FORM_indirect. About all I can think of for a test is to check in the Blinky.axf file, which is about 380k. Let me know if there are any ideas for a smaller/better test. |
Change https://golang.org/cl/190158 mentions this issue: |
Thanks for the fix! I am out office until beginning of September and won't be able to test until then (best case). For testing in general I cannot make better suggestion either (yet), but I'll add anything else I might come across here later. |
Fix a buglet in abbrev processing related to DW_FORM_indirect. When reading an abbrev entry if we encounter an attribute with form DW_FORM_indirect, leave the class as ClassUnknown, then when the abbrev is walked during the reading of the DIE fill in the class based on the value read at that point (code for handling DW_FORM_indirect seems to be already partially in place in the DIE reader). Updates #33488. Change-Id: I9dc89abf5cc8d7ea96824c0011bef979de0540bf Reviewed-on: https://go-review.googlesource.com/c/go/+/190158 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
@g4w Fix submitted. Let me know if I can close this bug out. |
Fix a buglet in abbrev processing related to DW_FORM_indirect. When reading an abbrev entry if we encounter an attribute with form DW_FORM_indirect, leave the class as ClassUnknown, then when the abbrev is walked during the reading of the DIE fill in the class based on the value read at that point (code for handling DW_FORM_indirect seems to be already partially in place in the DIE reader). Updates golang#33488. Change-Id: I9dc89abf5cc8d7ea96824c0011bef979de0540bf Reviewed-on: https://go-review.googlesource.com/c/go/+/190158 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
I am going to close this bug, please re-open if you see fit. Thanks. |
I managed to do a cursory check and it seems to address my issue, thanks. If something else comes up I'll re-open. |
I applied changes fro: https://go-review.googlesource.com/c/go/+/190158/ Now I have dwarf info, but i will check for consistency. |
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?
I am trying to parse debug info of an embedded binary (ARM / Cortex) generated by Keil uVision.
What did you expect to see?
Be able to call
DWARF()
on the file without error.What did you see instead?
Loading the file
_elf, err := elf.Open(os.Args[1])
and calling_elf.DWARF()
on it results in following error:decoding dwarf section abbrev at offset 0x13: cannot determine class of unknown attribute form
This error seems to originated from debug/dwarf/entry.go with (in my case)
form
beingformIndirect
.At somewhat similar issue and change is described here: https://go-review.googlesource.com/c/go/+/14541/2/src/debug/dwarf/entry.go and I can returning
ClassUnknown
forformIndirect
does help get some of the parsing done, but I missing crucial pieces of the dwarf section (i.e. the members of a struct I care for seem to get skipped altogether).As I am new to all of this I'd be thankful any comments on whether I have a funamental misunderstanding of purpose of the elf package (i.e. "was never meant to worked with embedded binariers") or whether there's something else I could besides deep diving into the issue and creating a pull request.
The text was updated successfully, but these errors were encountered: