public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@golang.org>
To: Tom de Vries <tdevries@suse.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 7/9] [libbacktrace] Handle DW_FORM_GNU_ref_alt
Date: Thu, 17 Jan 2019 00:36:00 -0000	[thread overview]
Message-ID: <CAKOQZ8wMHm2f6hZ91C6EhQ2wYk73d-9=VqCGZdPTuiz7QeXXyQ@mail.gmail.com> (raw)
In-Reply-To: <cd6dd389-cdcc-fcc3-983e-5705fd7373ce@suse.de>

On Wed, Jan 16, 2019 at 4:17 PM Tom de Vries <tdevries@suse.de> wrote:
>
> this handles DW_FORM_GNU_ref_alt which references the .debug_info
> section in the .gnu_debugaltlink file.
>
> OK for trunk?
>
> Thanks,
> - Tom
>
> On 11-12-18 11:14, Tom de Vries wrote:
> > 2018-12-10  Tom de Vries  <tdevries@suse.de>
> >
> >       * dwarf.c (enum attr_val_encoding): Add ATTR_VAL_REF_ALT_INFO.
> >       (struct unit): Add low and high fields.
> >       (struct unit_vector): New type.
> >       (struct dwarf_data): Add units and units_counts fields.
> >       (read_attribute): Handle DW_FORM_GNU_ref_alt using
> >       ATTR_VAL_REF_ALT_INFO.
> >       (find_unit): New function.
> >       (find_address_ranges): Add and handle unit_tag parameter.
> >       (build_address_map): Add and handle units_vec parameter.
> >       (read_referenced_name_1): Handle DW_FORM_GNU_ref_alt.
> >       (build_dwarf_data): Pass units_vec to build_address_map.  Store resulting
> >       units vector.


> > @@ -281,6 +283,10 @@ struct unit
> >    /* The offset of UNIT_DATA from the start of the information for
> >       this compilation unit.  */
> >    size_t unit_data_offset;
> > +  /* Start of the compilation unit.  */
> > +  size_t low;
> > +  /* End of the compilation unit.  */
> > +  size_t high;

The comments should say what low and high are measured in, which I
guess is file offset.  Or is it offset from the start of UNIT_DATA?
Either way, If that is right, then the fields should be named
low_offset and high_offset.  Otherwise it seems easy to confuse with
function_addrs, where low and high refer to PC values.

Also if they are offsets from UNIT_DATA then size_t is OK, but if the
are file offsets they should be off_t.


> > @@ -2144,6 +2198,22 @@ read_referenced_name_1 (struct dwarf_data *ddata, struct unit *u,
> >        || val->encoding == ATTR_VAL_REF_UNIT)
> >      return read_referenced_name (ddata, u, val->u.uint, error_callback, data);
> >
> > +  if (val->encoding == ATTR_VAL_REF_ALT_INFO)
> > +    {
> > +      struct unit *alt_unit
> > +     = find_unit (ddata->altlink->units, ddata->altlink->units_count,
> > +                  val->u.uint);
> > +      if (alt_unit == NULL)
> > +     {
> > +       error_callback (data,
> > +                       "Could not find unit for DW_FORM_GNU_ref_alt", 0);

s/Could/could/

or maybe just skip this error_callback call as discussed earlier.


> > +       return NULL;
> > +     }
> > +      uint64_t unit_offset = val->u.uint - alt_unit->low;

Earlier a unit_offset was the offset of the unit within unit_data, but
here this is an offset within a single unit.  This should just be
called offset, which is the name used by read_referenced_name.

This is OK with those changes.

Thanks.

Ian

  reply	other threads:[~2019-01-17  0:36 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 10:14 [PATCH 0/9] [libbacktrace] Handle .gnu_debugaltlink Tom de Vries
2018-12-11 10:14 ` [PATCH 5/9] [libbacktrace] Unify function name preference handling Tom de Vries
2019-01-16  1:10   ` Ian Lance Taylor via gcc-patches
2018-12-11 10:14 ` [PATCH 3/9] [libbacktrace] Handle alt FORMS without .gnu_debugaltlink Tom de Vries
2019-01-16  1:06   ` Ian Lance Taylor
2019-01-16 16:34     ` Tom de Vries
2019-01-16 18:24       ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 6/9] [libbacktrace] Factor out read_referenced_name_1 Tom de Vries
2019-01-16  1:15   ` Ian Lance Taylor via gcc-patches
2019-01-16 16:37     ` Tom de Vries
2019-01-16 18:26       ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 1/9] [libbacktrace] Read .gnu_debugaltlink Tom de Vries
2019-01-16  0:56   ` Ian Lance Taylor via gcc-patches
2019-01-16 16:26     ` Tom de Vries
2019-01-16 17:15       ` Ian Lance Taylor via gcc-patches
2019-01-16 22:48         ` Tom de Vries
2019-01-16 23:21           ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 4/9] [libbacktrace] Handle DW_FORM_GNU_strp_alt Tom de Vries
2019-01-16  1:07   ` Ian Lance Taylor via gcc-patches
2018-12-11 10:14 ` [PATCH 9/9] [libbacktrace] Add printdwarftest_dwz_cmp.sh test-case Tom de Vries
2019-01-17 13:58   ` Tom de Vries
2019-01-18 14:24     ` Ian Lance Taylor via gcc-patches
2019-01-19  0:45       ` Tom de Vries
2019-01-19  0:54         ` Ian Lance Taylor via gcc-patches
2019-01-22 22:03           ` Tom de Vries
2019-01-29 15:31             ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 2/9] [libbacktrace] Add altlink field to struct dwarf_data Tom de Vries
2019-01-16  1:02   ` Ian Lance Taylor
2019-01-16 16:33     ` Tom de Vries
2019-01-16 16:34       ` Tom de Vries
2019-01-16 22:20         ` Tom de Vries
2019-01-16 22:25           ` Ian Lance Taylor
2019-01-16 17:17       ` Ian Lance Taylor
2019-01-16 22:18         ` Tom de Vries
2019-01-16 22:40           ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 7/9] [libbacktrace] Handle DW_FORM_GNU_ref_alt Tom de Vries
2019-01-17  0:17   ` Tom de Vries
2019-01-17  0:36     ` Ian Lance Taylor [this message]
2019-01-17 14:14       ` Tom de Vries
2019-01-17 14:16         ` Tom de Vries
2019-01-18 14:26         ` Ian Lance Taylor
2019-01-22 22:17           ` [libbacktrace] Use size_t for low_offset/high_offset fields of struct unit Tom de Vries
2019-01-22 23:05             ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 8/9] [libbacktrace] Add btest_dwz test-case Tom de Vries
2019-01-16  1:19   ` Ian Lance Taylor
2019-01-16 16:39     ` Tom de Vries
2019-01-16 18:30       ` Ian Lance Taylor

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='CAKOQZ8wMHm2f6hZ91C6EhQ2wYk73d-9=VqCGZdPTuiz7QeXXyQ@mail.gmail.com' \
    --to=iant@golang.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tdevries@suse.de \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).