From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
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: Thu, 16 Mar 2017 18:25:00 -0000 [thread overview]
Message-ID: <m3fuidcc55.fsf@oc1027705133.ibm.com> (raw)
In-Reply-To: <20170315191648.EC8B7D83328@oc3748833570.ibm.com> (Ulrich Weigand's message of "Wed, 15 Mar 2017 20:16:48 +0100 (CET)")
On Wed, Mar 15 2017, Ulrich Weigand wrote:
> Andreas Arnez wrote:
[...]
>> + /* 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.
From looking at the code, it looks like it can. But only for very
special cases, it seems. For instance, in case of a missing DW_AT_TYPE
attribute for the pointed-to die we get the type "void" instead.
>
>> - 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 ...
Right, I'll look into that.
>
>> 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.
OK. I'll adjust the patch with the delta-patch below. Is that ready to
apply then?
--
Andreas
-- >8 --
1 file changed, 3 insertions(+), 1 deletion(-)
gdb/dwarf2loc.c | 4 +++-
modified gdb/dwarf2loc.c
@@ -2166,6 +2166,8 @@ indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset,
/* Get type of pointed-to DIE. */
struct type *orig_type = dwarf2_fetch_die_type_sect_off (die, per_cu);
+ if (orig_type == NULL)
+ invalid_synthetic_pointer ();
/* 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,
@@ -2487,7 +2489,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
struct value *value = ctx.fetch (0);
size_t n = TYPE_LENGTH (value_type (value));
size_t len = TYPE_LENGTH (subobj_type);
- size_t max = type != NULL ? TYPE_LENGTH (type) : n;
+ size_t max = TYPE_LENGTH (type);
struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile);
struct cleanup *cleanup;
next prev parent reply other threads:[~2017-03-16 18:25 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
2017-03-16 18:25 ` Andreas Arnez [this message]
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=m3fuidcc55.fsf@oc1027705133.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=uweigand@de.ibm.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