Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fernando Nasser <fnasser@redhat.com>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] (varobj) Fix gdb/701
Date: Tue, 24 Sep 2002 11:39:00 -0000	[thread overview]
Message-ID: <3D90B123.90200@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0209161207390.1395-100000@valrhona.uglyboxes.com>

This is an obvious fix.  The whole point in having get_type and 
get_target_type was to prevent things like this to happen.

Thanks for spotting and fixing it Keith.

Fernando

Keith Seitz wrote:
> Hi,
> 
> This patch fixes the failure highlighted in gdb/701 (or gdb701.exp, just 
> committed).
> 
> This happens because varobj had some last uses of TYPE_TARGET_TYPE, which 
> is a big no-no.
> 
> This patch fixes this and adds comments about why using TYPE_TARGET_TYPE 
> is not kosher.
> 
> Keith
> 
> ChangeLog
> 2002-09-16  Keith Seitz  <keiths@redhat.com>
> 
> 	* varobj.c (c_type_of_child): Use get_target_type instead
> 	of TYPE_TARGET_TYPE.
> 
> Patch
> Index: varobj.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/varobj.c,v
> retrieving revision 1.31
> diff -p -r1.31 varobj.c
> *** varobj.c	2 Aug 2002 20:51:21 -0000	1.31
> --- varobj.c	13 Sep 2002 23:51:00 -0000
> *************** make_cleanup_free_variable (struct varob
> *** 1345,1351 ****
>   
>   /* This returns the type of the variable. This skips past typedefs
>      and returns the real type of the variable. It also dereferences
> !    pointers and references. */
>   static struct type *
>   get_type (struct varobj *var)
>   {
> --- 1345,1354 ----
>   
>   /* This returns the type of the variable. This skips past typedefs
>      and returns the real type of the variable. It also dereferences
> !    pointers and references.
> ! 
> !    NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file
> !    except within get_target_type and get_type. */
>   static struct type *
>   get_type (struct varobj *var)
>   {
> *************** get_type_deref (struct varobj *var)
> *** 1374,1380 ****
>   }
>   
>   /* This returns the target type (or NULL) of TYPE, also skipping
> !    past typedefs, just like get_type (). */
>   static struct type *
>   get_target_type (struct type *type)
>   {
> --- 1377,1386 ----
>   }
>   
>   /* This returns the target type (or NULL) of TYPE, also skipping
> !    past typedefs, just like get_type ().
> ! 
> !    NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file
> !    except within get_target_type and get_type. */
>   static struct type *
>   get_target_type (struct type *type)
>   {
> *************** c_type_of_child (struct varobj *parent, 
> *** 1959,1965 ****
>     switch (TYPE_CODE (parent->type))
>       {
>       case TYPE_CODE_ARRAY:
> !       type = TYPE_TARGET_TYPE (parent->type);
>         break;
>   
>       case TYPE_CODE_STRUCT:
> --- 1965,1971 ----
>     switch (TYPE_CODE (parent->type))
>       {
>       case TYPE_CODE_ARRAY:
> !       type = get_target_type (parent->type);
>         break;
>   
>       case TYPE_CODE_STRUCT:
> *************** c_type_of_child (struct varobj *parent, 
> *** 1968,1974 ****
>         break;
>   
>       case TYPE_CODE_PTR:
> !       switch (TYPE_CODE (TYPE_TARGET_TYPE (parent->type)))
>   	{
>   	case TYPE_CODE_STRUCT:
>   	case TYPE_CODE_UNION:
> --- 1974,1980 ----
>         break;
>   
>       case TYPE_CODE_PTR:
> !       switch (TYPE_CODE (get_target_type (parent->type)))
>   	{
>   	case TYPE_CODE_STRUCT:
>   	case TYPE_CODE_UNION:
> *************** c_type_of_child (struct varobj *parent, 
> *** 1976,1982 ****
>   	  break;
>   
>   	default:
> ! 	  type = TYPE_TARGET_TYPE (parent->type);
>   	  break;
>   	}
>         break;
> --- 1982,1988 ----
>   	  break;
>   
>   	default:
> ! 	  type = get_target_type (parent->type);
>   	  break;
>   	}
>         break;
> 


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


  reply	other threads:[~2002-09-24 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-16 12:10 Keith Seitz
2002-09-24 11:39 ` Fernando Nasser [this message]
2002-09-24 11:50   ` Keith Seitz

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=3D90B123.90200@redhat.com \
    --to=fnasser@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=keiths@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