Skip to content
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

gccgo: objdump -DlS on gccgo-built program fails with: Dwarf Error: found dwarf version '25106', this reader only handles version 2, 3, 4 and 5 information. #44091

Closed
laboger opened this issue Feb 3, 2021 · 3 comments

Comments

@laboger
Copy link
Contributor

@laboger laboger commented Feb 3, 2021

What version of Go are you using (go version)?

$ go version
./go version
go version go1.16beta1 gccgo (GCC) 11.0.0 20210126 (experimental) linux/ppc64le

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
linux/ppc64le power8
Also happens on linux/amd64

What did you do?

Trying to debug a failure in gccgo, did objdump -DlS on the program built by latest gccgo. The objdump spits out lots of errors like this:

objdump: Dwarf Error: found dwarf version '13056', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '6144', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '11520', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '16144', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '40464', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '22544', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '29456', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '28691', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '18296', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '23832', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '18588', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '25106', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '10775', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '61975', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '26899', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '39965', this reader only handles version 2, 3, 4 and 5 information.
objdump: Dwarf Error: found dwarf version '17437', this reader only handles version 2, 3, 4 and 5 information.
....

What did you expect to see?

No such Dwarf Error messages and a meaningful objdump with source code information included.

What did you see instead?

Above errors and no source line information. objdump -D works fine.
gdb is not able to provide source information either during debug.
Building with gcc-10 works as expected.

@gopherbot gopherbot added this to the Gccgo milestone Feb 3, 2021
@thanm
Copy link
Member

@thanm thanm commented Feb 3, 2021

My recent experience has been that "objdump" DWARF support is pretty much not there for DWARF 5. Not sure why, but what's there just doesn't seem to do the job. Example:

$ clang++-10 -gdwarf-5 exampleprogram.cpp
$ objdump --dwarf=info a.out > /dev/null
objdump: Warning: Unrecognized form: 37
objdump: Warning: Unrecognized form: 37
objdump: Warning: Unrecognized form: 37
objdump: Warning: Unrecognized form: 35
objdump: Warning: Unable to resolve ref form: uvalue 360302 + cu_offset 0 > section size 1822
objdump: Warning: Offset 360302 used as value for DW_AT_import attribute of DIE at offset 0x2b is too big.
objdump: Warning: Bogus end-of-siblings marker detected at offset 38 in .debug_info section
objdump: Warning: Further warnings about bogus end-of-sibling markers suppressed
objdump: Warning: Unrecognized form: 37
objdump: Warning: Unrecognized form: 27
objdump: Warning: Unrecognized form: 38
objdump: Warning: DIE at offset 0x67 refers to abbreviation number 64 which does not exist
...
$ llvm-dwarfdump-10 --debug-info --verify a.out > /dev/null
$ 

Better to use llvm-dwarfdump -- it can handle DWARF 5 without any issues.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Feb 3, 2021

Note that GCC recently changed to generate DWARF 5 by default. Try using -gdwarf-4.

@laboger
Copy link
Contributor Author

@laboger laboger commented Feb 4, 2021

Thanks, using -gdwarf-4 allowed me to get the objdump I needed.

@laboger laboger closed this May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants