From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14634 invoked by alias); 16 Sep 2002 19:10:08 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 14623 invoked from network); 16 Sep 2002 19:10:07 -0000 Received: from unknown (HELO valrhona.uglyboxes.com) (64.1.192.220) by sources.redhat.com with SMTP; 16 Sep 2002 19:10:07 -0000 Received: from localhost.localdomain (IDENT:Ttcvy8hJkAseWqfAzm0YJTaBa4zCqMPh@localhost.localdomain [127.0.0.1]) by valrhona.uglyboxes.com (8.11.6/8.11.6) with ESMTP id g8GJCZb03111 for ; Mon, 16 Sep 2002 12:12:45 -0700 Date: Mon, 16 Sep 2002 12:10:00 -0000 From: Keith Seitz X-X-Sender: keiths@valrhona.uglyboxes.com To: gdb-patches@sources.redhat.com Subject: [RFA] (varobj) Fix gdb/701 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-09/txt/msg00315.txt.bz2 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 * 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;