Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch+7.8] Fix 7.8 regression: resolve_dynamic_struct: Assertion `TYPE_NFIELDS (type) > 0' (PR 17642)
Date: Sat, 13 Dec 2014 14:23:00 -0000	[thread overview]
Message-ID: <20141213142351.GG5457@adacore.com> (raw)
In-Reply-To: <20141125195444.GA3400@host2.jankratochvil.net>

> It is another missing check_typedef().

> gdb/
> 2014-11-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Fix internal error on stubs of dynamic types.
> 	* gdbtypes.c (resolve_dynamic_type_internal): Apply check_typedef to
> 	TYPE if not TYPE_CODE_TYPEDEF.
> 
> gdb/testsuite/
> 2014-11-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Fix internal error on stubs of dynamic types.
> 	* gdb.base/vla-stub-define.c: New file.
> 	* gdb.base/vla-stub.c: New file.
> 	* gdb.base/vla-stub.exp: New file.

Pre-approved with the following comments. Ok for 7.8 as well, although
the chances of a 7.8.2 are getting slimmer, and you'll need also to
create a PR.

> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
> index 61d259d..aa76604 100644
> --- a/gdb/gdbtypes.c
> +++ b/gdb/gdbtypes.c
> @@ -1875,41 +1875,48 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr,
>    if (!is_dynamic_type_internal (real_type, top_level))
>      return type;
>  
> -  switch (TYPE_CODE (type))
> +  if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
>      {
> -    case TYPE_CODE_TYPEDEF:
>        resolved_type = copy_type (type);
>        TYPE_TARGET_TYPE (resolved_type)
>  	= resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr,
>  					 top_level);
> -      break;
> +    }
> +  else 

Trailing space here...

> +    {
> +      /* Typedefs do not need to be preserved here but we need
> +	 to resolve any possible stub types.  */
> +      type = real_type;

It took me a moment, despite your added comment, to understand that
it was not so much about TYPE_CODE_TYPEDEF but about stubs! I keep
forgetting that check_typedef does more than unwrapping typedef
layers.

We know that type isn't a typedef here, so mentioning typedefs
is a bit confusing, IMO. How about we adjust the comment to say,
for instance:

        /* Before trying to resolve TYPE, make sure it is not a stub.  */

This is only a suggestion, and it's subjective, so feel free to ignore.

Thank you,
-- 
Joel


  reply	other threads:[~2014-12-13 14:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 19:54 Jan Kratochvil
2014-12-13 14:23 ` Joel Brobecker [this message]
2014-12-13 14:39   ` [commit] " Jan Kratochvil
2014-12-13 18:18   ` Doug Evans
2014-12-15 15:06   ` Joel Brobecker
2014-12-15 15:21     ` Jan Kratochvil
2014-12-15 19:12     ` [commit 7.8] " Jan Kratochvil
2014-12-15 19:23       ` H.J. Lu
2014-12-15 19:37         ` Joel Brobecker
2014-12-15 20:02           ` H.J. Lu
2014-12-15 20:41             ` Joel Brobecker
2014-12-15 21:09               ` H.J. Lu
2014-12-15 22:11                 ` H.J. Lu
2014-12-15 22:44                   ` Joel Brobecker
2014-12-15 22:53                     ` H.J. Lu

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=20141213142351.GG5457@adacore.com \
    --to=brobecker@adacore.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