Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wei-min Pan <weimin.pan@oracle.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3 PR gdb/16959] gdb hangs in infinite recursion
Date: Sat, 24 Mar 2018 18:56:00 -0000	[thread overview]
Message-ID: <71719916-38d0-dd84-e79c-0e9d24dda5aa@oracle.com> (raw)
In-Reply-To: <58d0f0759e471fb7862da336ba18bde6@polymtl.ca>



On 3/24/2018 5:33 AM, Simon Marchi wrote:
> On 2018-03-24 06:10, Pedro Alves wrote:
>> On 03/23/2018 09:25 PM, Weimin Pan wrote:
>>
>>> -  if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
>>> +  struct type *real_type = check_typedef (type);
>>> +  if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT)
>>>      {
>>>        CORE_ADDR *first_dont_print;
>>>        CORE_ADDR addr;
>>> @@ -658,15 +659,14 @@ cp_print_static_field (struct type *type,
>>>        addr = value_address (val);
>>>        obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
>>>              sizeof (CORE_ADDR));
>>> -      type = check_typedef (type);
>>> -      cp_print_value_fields (type, value_enclosing_type (val),
>>> +      cp_print_value_fields (real_type, value_enclosing_type (val),
>>
>> This is still passing the resolved type down instead of the
>> original type.
>
> I did not point this out because cp_print_value_fields does a 
> check_typedef anyway, so it doesn't change anything.  But it's true 
> that to be consistent it would be better to always pass down the 
> original type, and let the callee decide whether it wants to resolve 
> the typedef or not.  Please consider this comment when preparing the 
> next version.
>

Please note the check_typedef() call (now redundant and removed) before 
calling cp_print_value_fields().
So passing the resolved type is correct.

Thanks,
Weimin

> Thanks,
>
> Simon


  reply	other threads:[~2018-03-24 18:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 21:51 Weimin Pan
2018-03-24  2:41 ` Simon Marchi
2018-03-24 19:41   ` Wei-min Pan
2018-03-24 19:51     ` Simon Marchi
2018-03-26 22:28       ` Weimin Pan
2018-03-24 10:10 ` Pedro Alves
2018-03-24 12:33   ` Simon Marchi
2018-03-24 18:56     ` Wei-min Pan [this message]
2018-03-24 19:23       ` Simon Marchi
2018-03-24 19:32         ` Wei-min Pan
2018-03-24 19:48           ` Simon Marchi

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=71719916-38d0-dd84-e79c-0e9d24dda5aa@oracle.com \
    --to=weimin.pan@oracle.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@polymtl.ca \
    /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