From: Luis Machado <lgustavo@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix mi "-var-create" regression
Date: Mon, 15 Oct 2012 12:21:00 -0000 [thread overview]
Message-ID: <507BFF97.2000900@codesourcery.com> (raw)
In-Reply-To: <20121014171805.GB3050@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 1657 bytes --]
On 10/14/2012 02:18 PM, Joel Brobecker wrote:
> I don't feel entirely comfortable approving this patch, not because
> I think it's iffy, but just because I don't have a good knowledge
> of what is going on for you (RTTI is C++, and I don't follow C++
> support). If no one else has the time to officially review your patch
> within the next week or so, I will take a deeper look. It does look
> reasonable.
>
The biggest problem caused by this regression is the breakage of
information sent to IDEs based on MI output, as Marc pointed out.
Eclipse, for example, will attempt to list registers and gdb will end up
throwing these errors, causing eclipse to get all confused when trying
to display the register values.
This is more about a regression of a generic gdb feature than a fix to a
C++ feature.
> I did notice a couple of things (besides the unnecessary parens):
>
>> - if (TYPE_CODE (result) == TYPE_CODE_PTR
>> + /* If result's target type is TYPE_CODE_VOID, do not try fetching its rtti
>> + type. GDB will try to dereference the void pointer and will throw an
>> + error when trying to do so. */
>
> Can you reformat the comment to fit within 70 characters. That's the
> soft line limit...
>
Fixed.
>> + if ((TYPE_CODE (result) == TYPE_CODE_PTR
>> || TYPE_CODE (result) == TYPE_CODE_REF)
>> + && ((TYPE_TARGET_TYPE (result) != NULL)
>> + && TYPE_CODE (TYPE_TARGET_TYPE (result)) != TYPE_CODE_VOID))
>
> I don't think that you need to test for the TYPE_TARGET_TYPE, since
> you already know that it's either a PTR or REF type, which always
> have a TARGET_TYPE.
>
Well spotted. I fixed this now.
Thanks,
Luis
[-- Attachment #2: rtti-print-object.diff --]
[-- Type: text/x-patch, Size: 905 bytes --]
2012-10-15 Luis Machado <lgustavo@codesourcery.com>
* value.c (value_actual_type): Check for TYPE_CODE_VOID
target types.
Index: gdb/gdb/value.c
===================================================================
--- gdb.orig/gdb/value.c 2012-10-10 16:54:36.048188274 -0300
+++ gdb/gdb/value.c 2012-10-14 21:41:22.997797277 -0300
@@ -850,8 +850,13 @@ value_actual_type (struct value *value,
result = value_type (value);
if (opts.objectprint)
{
- if (TYPE_CODE (result) == TYPE_CODE_PTR
+ /* If result's target type is TYPE_CODE_VOID, do not try
+ fetching its rtti type. GDB will try to dereference
+ the void pointer and will throw an error when trying to
+ do so. */
+ if ((TYPE_CODE (result) == TYPE_CODE_PTR
|| TYPE_CODE (result) == TYPE_CODE_REF)
+ && TYPE_CODE (TYPE_TARGET_TYPE (result)) != TYPE_CODE_VOID)
{
struct type *real_type;
next prev parent reply other threads:[~2012-10-15 12:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 20:05 Luis Gustavo
2012-10-11 21:53 ` Sergio Durigan Junior
2012-10-11 22:10 ` Luis Machado
2012-10-17 17:29 ` Tom Tromey
2012-10-12 19:57 ` Marc Khouzam
2012-10-14 17:18 ` Joel Brobecker
2012-10-15 12:21 ` Luis Machado [this message]
2012-10-18 1:13 ` Tom Tromey
2012-10-19 13:14 ` Luis Machado
2012-10-28 22:44 ` Luis Machado
2012-10-30 20:36 ` Tom Tromey
2012-11-14 19:21 ` Luis Machado
2012-11-15 16:44 ` Marc Khouzam
2012-11-15 17:48 ` Joel Brobecker
2012-11-15 18:47 ` Tom Tromey
2012-11-15 20:54 ` Marc Khouzam
2012-11-15 21:13 ` Tom Tromey
2012-11-15 23:28 ` Luis Machado
2012-11-16 0:50 ` Marc Khouzam
2012-11-16 2:10 ` Luis Machado
2012-11-29 20:11 ` Andreas Schwab
2012-11-29 21:07 ` Joel Brobecker
2012-11-30 2:13 ` Luis Machado
2012-12-07 2:48 ` Joel Brobecker
2012-12-07 2:51 ` Luis Machado
2012-12-26 12:31 ` Luis Machado
2013-01-03 3:46 ` Joel Brobecker
2013-01-03 12:30 ` Luis Machado
2013-01-03 12:38 ` 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=507BFF97.2000900@codesourcery.com \
--to=lgustavo@codesourcery.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