Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/DWARF] constant class of DW_AT_high_pc is offset for version >=4 only.
Date: Tue, 18 Feb 2014 16:03:00 -0000	[thread overview]
Message-ID: <1392739369.21975.145.camel@bordewijk.wildebeest.org> (raw)
In-Reply-To: <20140218133000.GA15835@adacore.com>

On Tue, 2014-02-18 at 14:30 +0100, Joel Brobecker wrote:
>   1. The introduction of attr_value_as_address, to be used
>      in place of DW_ADDR when dealing with address attributes.
>      I left a few uses of this macro in the situations where
>      we actually know that the form is an address form.

This accepts any form as address/unsigned. I would at least check that
it is either DW_FORM_data4 or DW_FORM_data8 (even better would be to
check the CU address width too, although that would require to pass
around cu too, which might not be practical). Also I would add a comment
that this is really to work around buggy producers.

>   2. Instead of duplicating everywhere the conditions for
>      non-address forms in the handling of DW_AT_high_pc
>      attributes, I used the attr_form_is_constant function
>      instead.  It's not stricly the same, but I think it is
>      closer to the DWARF reference.

It is closer when used like you do, combined with a check for
cu->header.version >= 4.

> @@ -4201,7 +4217,7 @@ dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu)
>    attr = dwarf2_attr (die, DW_AT_entry_pc, cu);
>    if (attr)
>      {
> -      cu->base_address = DW_ADDR (attr);
> +      cu->base_address = attr_value_as_address (attr);
>        cu->base_known = 1;
>      }

Note that this might break for DWARF5. See http://dwarfstd.org/ShowIssue.php?issue=120719.1

In general I would only use attr_value_as_address for attributes (low_pc
and high_pc) which you know a buggy producer might encode with
DW_FORM_data[48].

Cheers,

Mark.


  reply	other threads:[~2014-02-18 16:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-15 15:40 Joel Brobecker
2014-02-16 19:19 ` Mark Wielaard
2014-02-17  9:19   ` Joel Brobecker
2014-02-18 13:30 ` Joel Brobecker
2014-02-18 16:03   ` Mark Wielaard [this message]
2014-02-18 18:49     ` Joel Brobecker
2014-02-18 20:29       ` Doug Evans
2014-02-18 21:52       ` Mark Wielaard
2014-02-19  7:23         ` Joel Brobecker
2014-02-19 13:44           ` Mark Wielaard
2014-02-21 18:42             ` Joel Brobecker
2014-02-26 10:53               ` Mark Wielaard
2014-02-26 19:45               ` pushed: " Joel Brobecker

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=1392739369.21975.145.camel@bordewijk.wildebeest.org \
    --to=mjw@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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