From: Pedro Alves <palves@redhat.com>
To: Martin Galvan <martin.galvan@tallertechnologies.com>,
gdb-patches@sourceware.org, jan.kratochvil@redhat.com,
lgustavo@codesourcery.com,
daniel.gutson@tallertechnologies.com
Subject: Re: [PING 2][PATCH v3] Fix gdb crash when trying to print the address of a synthetic C++ reference
Date: Fri, 15 Apr 2016 22:32:00 -0000 [thread overview]
Message-ID: <57116C0C.4090502@redhat.com> (raw)
In-Reply-To: <1460751838-20954-1-git-send-email-martin.galvan@tallertechnologies.com>
On 04/15/2016 09:23 PM, Martin Galvan wrote:
> diff --git a/gdb/valops.c b/gdb/valops.c
> index 5a244a9..40559c2 100644
> --- a/gdb/valops.c
> +++ b/gdb/valops.c
> @@ -1463,11 +1463,19 @@ value_addr (struct value *arg1)
> if (TYPE_CODE (type) == TYPE_CODE_REF)
> {
> /* Copy the value, but change the type from (T&) to (T*). We
> - keep the same location information, which is efficient, and
> - allows &(&X) to get the location containing the reference. */
> + keep the same location information, which is efficient, and
> + allows &(&X) to get the location containing the reference.
> + Do the same to its enclosing type for consistency. */
> + struct type *type_ptr = lookup_pointer_type (TYPE_TARGET_TYPE (type));
> +
Spurious empty line.
> + struct type *enclosing_type = check_typedef (value_enclosing_type (arg1));
> + struct type *enclosing_type_ptr =
> + lookup_pointer_type (TYPE_TARGET_TYPE (enclosing_type));
= goes on the next line.
OK with those fixed.
I'd write it like this, with the variables reordered to align the
lookup_pointer_type calls:
struct type *enclosing_type
= check_typedef (value_enclosing_type (arg1));
struct type *type_ptr
= lookup_pointer_type (TYPE_TARGET_TYPE (type));
struct type *enclosing_type_ptr
= lookup_pointer_type (TYPE_TARGET_TYPE (enclosing_type));
Thanks for fixing this, and also for writing a test with the DWARF assembler.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2016-04-15 22:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 20:24 Martin Galvan
2016-04-15 22:32 ` Pedro Alves [this message]
2016-04-18 14:05 ` Martin Galvan
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=57116C0C.4090502@redhat.com \
--to=palves@redhat.com \
--cc=daniel.gutson@tallertechnologies.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=lgustavo@codesourcery.com \
--cc=martin.galvan@tallertechnologies.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