Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH RFA] dwarf2read.c: Accommodate older 64-bit DWARF2 format
Date: Sat, 13 Jul 2002 16:53:00 -0000	[thread overview]
Message-ID: <npsn2nnt9y.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <1020713000942.ZM10220@localhost.localdomain>


Approved, if you add discussion like the one included in your post to
the comment above read_initial_length.  (Whenever I'm about to write a
long explanation of a patch, I ask myself whether it wouldn't be
happier as a comment in the code.)

Kevin Buettner <kevinb@redhat.com> writes:

> The patch below corresponds to a similar patch which was committed to
> bfd/dwarf2.c a few weeks back.  See
> 
>     http://sources.redhat.com/ml/binutils/2002-06/msg00702.html
> 
> (and the rest of the thread).
> 
> The older, non-standard 64-bit format in question stores the initial
> length as an 8-byte quantity without an escape value.  (Recall that
> the current draft standard uses the value 0xffffffff in the first 4
> bytes to indicate a 64-bit DWARF2 format.  The subsequent eight bytes
> contain the length.)  For the older format, however, lengths greater
> than 2~32 aren't very common which means that the initial 4 bytes is
> almost always zero.  Since a length value of zero doesn't make sense for
> the 32-bit format, this initial zero can be considered to be an escape
> value which indicates the presence of the older 64-bit format.
> 
> It's true that we can't detect lengths greater than 4GB (for the old
> format), but I don't think this matters much in practice.  If it
> becomes necessary to handle values somewhat larger than 4GB, we could
> allow other small values (such as the non-sensical values of 1, 2, and
> 3) to also be used as escape values which also indicate the presence
> of the old format.  I don't think this will become necessary though
> since the current DWARF 2/3 draft standard will likely be used for files
> requiring larger lengths.
> 
> Okay to commit?
> 
> 	* dwarf2read.c (read_initial_length): Handle older, non-standard,
> 	64-bit DWARF2 format.
> 
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.62
> diff -u -p -r1.62 dwarf2read.c
> --- dwarf2read.c	12 Jul 2002 19:55:10 -0000	1.62
> +++ dwarf2read.c	12 Jul 2002 23:26:27 -0000
> @@ -3907,6 +3907,18 @@ read_initial_length (bfd *abfd, char *bu
>  	  cu_header->offset_size = 8;
>  	}
>      }
> +  else if (retval == 0)
> +    {
> +      /* Handle (non-standard) 64-bit DWARF2 formats such as that used
> +         by IRIX.  */
> +      retval = bfd_get_64 (abfd, (bfd_byte *) buf);
> +      *bytes_read = 8;
> +      if (cu_header != NULL)
> +	{
> +	  cu_header->initial_length_size = 8;
> +	  cu_header->offset_size = 8;
> +	}
> +    }
>    else
>      {
>        *bytes_read = 4;


  reply	other threads:[~2002-07-13 22:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-12 18:15 Kevin Buettner
2002-07-13 16:53 ` Jim Blandy [this message]
2002-07-16 16:30   ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=npsn2nnt9y.fsf@zwingli.cygnus.com \
    --to=jimb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox