From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: arnez@linux.vnet.ibm.com (Andreas Arnez)
Cc: gdb-patches@sourceware.org, jan.kratochvil@redhat.com (Jan Kratochvil)
Subject: Re: [PATCH] Big-endian targets: Don't ignore offset into DW_OP_stack_value
Date: Wed, 15 Mar 2017 19:16:00 -0000 [thread overview]
Message-ID: <20170315191648.EC8B7D83328@oc3748833570.ibm.com> (raw)
In-Reply-To: <m3y3w6ct6n.fsf@oc1027705133.ibm.com> from "Andreas Arnez" at Mar 15, 2017 07:04:48 PM
Andreas Arnez wrote:
> On Mon, Mar 13 2017, Ulrich Weigand wrote:
> > Thinking about this more, maybe it would be clearer to swap around the
> > two types, and have the semantics of the function be something like:
> >
> > /* Evaluate a location description, starting at DATA and with length
> > SIZE, to find the current location of variable of TYPE in the
> > context of FRAME. If SUBOBJ_TYPE is non-NULL, return instead the
> > location of the subobject of type SUBOBJ_TYPE at byte offset
> > SUBOBJ_BYTE_OFFSET within the variable of type TYPE. */
>
> OK. Of course this increases the amount of change a bit. New patch
> below.
Well, yes ... I still think it is clearer overall in the end.
> + /* Get type of pointed-to DIE. */
> + struct type *orig_type = dwarf2_fetch_die_type_sect_off (die, per_cu);
> +
> /* If pointed-to DIE has a DW_AT_location, evaluate it and return the
> resulting value. Otherwise, it may have a DW_AT_const_value instead,
> or it may've been optimized out. */
> if (baton.data != NULL)
> - return dwarf2_evaluate_loc_desc_full (TYPE_TARGET_TYPE (type), frame,
> - baton.data, baton.size, baton.per_cu,
> + return dwarf2_evaluate_loc_desc_full (orig_type, frame, baton.data,
Can orig_type ever be NULL here? It probably would not be a good idea
to pass NULL as the type argument.
> - if (byte_offset != 0)
> + if (subobj_byte_offset != 0)
> error (_("cannot use offset on synthetic pointer to register"));
As an aside: now that we have the full object type, we may actually be able
to lift that restriction (do a value_from_register on the full type, and
then extract the subobject). Might be interesting to look into as a
follow-on change ...
> size_t n = TYPE_LENGTH (value_type (value));
> + size_t len = TYPE_LENGTH (subobj_type);
> + size_t max = type != NULL ? TYPE_LENGTH (type) : n;
As mentioned above, I don't think it makes sense to allow a NULL type here.
Otherwise, this looks good to me.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2017-03-15 19:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 19:00 Andreas Arnez
2017-03-13 14:30 ` Ulrich Weigand
2017-03-15 18:05 ` Andreas Arnez
2017-03-15 19:16 ` Ulrich Weigand [this message]
2017-03-16 18:25 ` Andreas Arnez
2017-03-16 18:43 ` Ulrich Weigand
2017-03-16 18:52 ` Andreas Arnez
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=20170315191648.EC8B7D83328@oc3748833570.ibm.com \
--to=uweigand@de.ibm.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@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