public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: (repeat) Patch for buglet in readelf.c - confused by zero-terminationof the .debug_abbrev section
@ 1999-08-09 10:25 Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 1999-08-09 10:25 UTC (permalink / raw)
  To: hp; +Cc: binutils

Hi Hans-Peter,

  Sorry about the delay in replaying to your patch submission.  (My
email feed has been dead for the last few days...).  Anyway I have
looked over your patch and it is fine.  (Even if the standard is not
completely clear on this point.  It never actually says that debug
abbrevs for multiple compilation units can exist within the same
section (although this is implied), and even the picture in appendix 2
only shows a single set of abbreviations being shared by mutliple
compilation units, rather than multiple sets of abbreviations.

I have applied the patch to the repository.

Cheers
	Nick

: Thu Jul 15 22:44:21 1999  Hans-Peter Nilsson  <hp@bitrange.com>
: 
: 	* readelf.c (process_abbrev_section): Handle standard-conforming
: 	single zero at the end of the section.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* (repeat) Patch for buglet in readelf.c - confused by zero-terminationof the .debug_abbrev section
@ 1999-08-09  9:31 Hans-Peter Nilsson
  0 siblings, 0 replies; 2+ messages in thread
From: Hans-Peter Nilsson @ 1999-08-09  9:31 UTC (permalink / raw)
  To: binutils

I hope I don't offend anyone by re-posting this; it wasn't commented on
and CVS says no such change went in.  It's needed now that gcc CVS has the
patch mentioned below, and will be included in gcc-2.95.1
---------- Forwarded message ----------
Date: Wed, 14 Jul 1999 22:24:36 -0400 (EDT)
From: Hans-Peter Nilsson <hp@bitrange.com>
To: binutils@sourceware.cygnus.com
Cc: krister.walfridsson@precisebiometrics.com,
     lars.malmborg@precisebiometrics.com
Subject: Patch for buglet in readelf.c - confused by zero-termination of the
    .debug_abbrev section

Hi!

There's a bug in readelf.c in handling the standard
zero-termination of the .debug_abbrev section for each
compilation unit (that current releases of gcc do not emit,
thus not triggering the bug).  See the dwarf2 standard,
section 7.5.3, at the end, and it's obvious from the figure
in Appendix 2).
 The buglet signals the caller that there are more abbrevs, but
it will return NULL on the second round, confusing the caller
display_debug_abbrev into displaying the same section twice.
 I believe no problems are introduced by making it also accept
standard-compliant input :-)  I've sent a matching patch for gcc. 
 Note that read_abbrevs in bfd/dwarf2.c and dwarf2_read_abbrevs in
gdb/dwarf2read.c does not have a bug here - that function has a
workaround for the *non*-termination of the .debug_abbrev section.

Thu Jul 15 22:44:21 1999  Hans-Peter Nilsson  <hp@bitrange.com>

	* readelf.c (process_abbrev_section): Handle standard-conforming
	single zero at the end of the section.

RCS file: /cvs/binutils/binutils/binutils/readelf.c,v
retrieving revision 1.18
diff -p -c -r1.18 readelf.c
*** readelf.c	1999/07/11 20:02:26	1.18
--- readelf.c	1999/07/15 01:30:22
*************** process_abbrev_section (start, end)
*** 4787,4794 ****
        entry = read_leb128 (start, & bytes_read, 0);
        start += bytes_read;
  
        if (entry == 0)
! 	return start;
  
        tag = read_leb128 (start, & bytes_read, 0);
        start += bytes_read;
--- 4787,4797 ----
        entry = read_leb128 (start, & bytes_read, 0);
        start += bytes_read;
  
+       /* A single zero is supposed to end the section according
+ 	 to the standard.  If there's more, then signal that to
+ 	 the caller.  */
        if (entry == 0)
! 	return start == end ? NULL : start;
  
        tag = read_leb128 (start, & bytes_read, 0);
        start += bytes_read;

brgds, H-P



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-08-09 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-09 10:25 (repeat) Patch for buglet in readelf.c - confused by zero-terminationof the .debug_abbrev section Nick Clifton
  -- strict thread matches above, loose matches on Subject: below --
1999-08-09  9:31 Hans-Peter Nilsson

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).