https://sourceware.org/bugzilla/show_bug.cgi?id=24270
Bug ID: 24270 Summary: dwarf error wrong version in compilation unit header Product: binutils Version: 2.31 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: justin at yackoski dot name Target Milestone: --- Created attachment 11647 --> https://sourceware.org/bugzilla/attachment.cgi?id=11647&action=edit original .c file I'm seeing strange behavior in the assembler being invoked by gcc. Hopefully this is the right place to report this, please let me know if not. I have a .s file that when assembled is getting an error when read by gdb. The .s file was generated by gcc, and I've modified it slightly to change the stack offsets used for some variables (the reason for these modifications I can't really get into, but it is important for my use and I believe a valid .s file) The issue occurs when I also update the debug info to match these offsets. I've attached 4 files: - lemon_simple.c, the original .c file - lemon_simple.s, the pristine .s file generated by gcc -ggdb lemon_simple.c -S This file is read w/o errors by gdb - lemon_simple.broken.s, a .s file that gdb reports an error on but I believe has correct info - lemon_simple.partial.s, a .s file w/o two of the debug info changes that gdb loads successfully (but which has incorrect stack offsets) I'm using the following versions on Ubuntu 18.04 as: GNU assembler (GNU Binutils) 2.31.51.20181203 gcc: 8.2.0 <-- built from source by me gdb: 8.2, also tried Ubuntu version 8.1-0ubuntu3 I don't believe the exact versions of gcc/gdb matter here. Not sure if it is supposed to happen, but these small changes between lemon_simple.s.broken and lemon_simple.s.partial produce vastly different executable files. Below is the output I get, I've omitted the gcc output, the .c compiles w/o warnings, and the .s also goes fine. You can see in the first gdb run that just loading a.out has a error. $ gcc -ggdb lemon_simple.c -S <output omitted> <fiddle with the lemon_simple.s file to produce lemon_simple.broken.s and lemon_simple.partial.s> $ gcc -ggdb lemon_simple.broken.s <output omitted> $ gdb ./a.out GNU gdb (GDB) 8.2 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./a.out...Dwarf Error: wrong version in compilation unit header (is 110, should be 2, 3, 4 or 5) [in module <snip>/a.out] (no debugging symbols found)...done. >>> quit $ gcc -ggdb lemon_simple.partial.s <output omitted> $ gdb ./a.out GNU gdb (GDB) 8.2 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./a.out...done. >>> quit $ gcc -ggdb lemon_simple.s <output omitted> $ gdb ./a.out GNU gdb (GDB) 8.2 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./a.out...done. >>> quit -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils