This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add discriminator support to gas .loc directive


> ?Now that GCC HEAD has begun actually generating this form of directives, we
> are seeing a lot of these errors on Cygwin:
>
> libtool: link: /gnu/gcc/obj-patched3/./gcc/gcj
> -B/gnu/gcc/obj-patched3/i686-pc-cygwin/libjava/ -B/gnu/gcc/obj-patched3/./gcc/
> -B/opt/gcc-tools/i686-pc-cygwin/bin/ -B/opt/gcc-tools/i686-pc-cygwin/lib/
> -isystem /opt/gcc-tools/i686-pc-cygwin/include -isystem
> /opt/gcc-tools/i686-pc-cygwin/sys-include -ffloat-store -fomit-frame-pointer
> -Usun -g -O2 -o .libs/jv-convert.exe --main=gnu.gcj.convert.Convert
> -shared-libgcc ?-L/gnu/gcc/obj-patched3/i686-pc-cygwin/libjava/.libs
> -L/gnu/gcc/obj-patched3/i686-pc-cygwin/libjava ./.libs/libgcj.a -ldl
> -L/opt/gcc-tools/lib/gcc/i686-pc-cygwin/4.5.0
> /opt/gcc-tools/bin/ld: Dwarf Error: mangled line number section.
>
> ?This turns out to be because you overlooked to add support for the new
> DW_LNE_ extended opcode in the decoding loop at
> bfd/dwarf2.c:decode_line_info()#1334.
>
> ?Could you take a quick look at it for us and suggest a fix please?

Sorry about that!

The quickest fix is to have decode_line_info just ignore the
discriminator. A proposed patch for that is below; I ran the binutils
testsuite with a discriminator-generating compiler, but I don't see
any failures with or without this fix -- there don't seem to be any
tests for addr2line. Could you give this patch a try and see if it
works for you?

I could also fix decode_line_info to track the discriminator, but
providing that extra information to the clients of bfd would probably
involve extra interfaces that don't seem to be in demand, so I'll
leave that for a future extension.

It would be nice if the line table reader would silently ignore
opcodes it doesn't understand (as the DWARF spec suggests), but it
seems to be a deliberate decision here to complain, so I'll leave that
as is.

-cary


bfd/ChangeLog:

* dwarf2.c (decode_line_info): Ignore DW_LNE_set_discriminator.


Index: dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.120
diff -u -p -r1.120 dwarf2.c
--- dwarf2.c	16 Mar 2009 12:41:26 -0000	1.120
+++ dwarf2.c	30 Jun 2009 20:19:10 -0000
@@ -1405,6 +1405,10 @@ decode_line_info (struct comp_unit *unit
 		  line_ptr += bytes_read;
 		  table->num_files++;
 		  break;
+		case DW_LNE_set_discriminator:
+		  (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+		  line_ptr += bytes_read;
+		  break;
 		default:
 		  (*_bfd_error_handler) (_("Dwarf Error: mangled line number section."));
 		  bfd_set_error (bfd_error_bad_value);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]