public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Wrong dwarf version does not allow to debug 32bit binary files
@ 2023-04-03 15:55 alexandre schenberg
  0 siblings, 0 replies; only message in thread
From: alexandre schenberg @ 2023-04-03 15:55 UTC (permalink / raw)
  To: gcc-help

Hello. I am currently trying to figure out why my system cannot run 32bit c++ executables (except, perhaps, static ones)

To accomplish that, I tried to run a simple hello word c++ program in gdb, as it was suggested here many months ago to fix another problem.

However, when I run:  "LD_LIBRARY_PATH=/media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/ gdb ./test"

I receive a "Dwarf Error: wrong version in compilation unit header (is 4, should be 2)"

Looking for a fix, I tried to add a "-gdwarf-2" to my compilation command, which became: "g++ -m32 -gdwarf-2 -o test test.cpp -Wl,--dynamic-link=/usr/lib32/ld-2.17.so"

However, running the resulting binary under gdb, still generated the same error:

Executing: "readelf --debug-dump=info binary_name | grep -A 2 'Compilation Unit @'" shows that there still exists two compilation units with dwarf 4. In fact, the gdwarf parameter didn't change anything. There were such two compilation units with before using -gdwarf2 and they are still remain there after using such option.

There are also these messages:

readelf: Warning: CU at offset 7d contains corrupt or unsupported version number: 4.
readelf: Warning: CU at offset 210 contains corrupt or unsupported version number: 4.

So, I need a way to make the final binary file to have all its CUs with the same dwarf version. Since the gdwarf parameter failed to force dwarf 2 use across all of them, the only option I can think of is to build a new gdb that would support dwarf4.

If there is another way, I am all hears.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-03 15:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03 15:55 Wrong dwarf version does not allow to debug 32bit binary files alexandre schenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).