From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8004 invoked by alias); 23 Jun 2010 15:52:30 -0000 Received: (qmail 7996 invoked by uid 22791); 23 Jun 2010 15:52:29 -0000 X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,MSGID_MULTIPLE_AT,RCVD_IN_JMF_BL X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 15:52:25 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o5NFqLps009853 for ; Wed, 23 Jun 2010 17:52:22 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms6.u-strasbg.fr [IPv6:2001:660:2402:d::15]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o5NFqLBS060148 for ; Wed, 23 Jun 2010 17:52:21 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id o5NFqLpV034557 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Wed, 23 Jun 2010 17:52:21 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFC] display names of explicit typedefs for 'info types' Date: Wed, 23 Jun 2010 15:52:00 -0000 Message-ID: <000f01cb12ec$194f4b80$4bede280$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00502.txt.bz2 I was always puzzled by the fact that info types did sometime not list types that I knew existed. The problem is that for types defined in C using `typedef ' only the definition part was displayed, but not the name of the type itself. This small patch fixes that 'mis-feature'... I was expecting lots of failures in the testsuite, but was surprised to find no change that I could relate to the patch... The following tiny example: >>>>>Start typedef volatile int volint; typedef int myint; volint vol; myint my; int main () { vol = 5; my = 8; return 0; } >>>>>End gives currently (compiled with stabs debug info) typedef int; (Repeated twice) typedef volatile int; With the patch, I get: typedef int; typedef int myint; typedef volatile int volint; Note that the output of 'info var' is not really consistent: (gdb) info var myint my; volatile int vol; but this is not changed by my patch, and is the same as before.. (gdb) ptype my type = int Here again, the original typedef name is completely lost ... Comments welcome, Pierre Muller Pascal language support maintainer for GDB 2010-06-22 Pierre Muller * c-typeprint.c (c_print_typedef): Append new type name for typedefs. Index: src/gdb/c-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/c-typeprint.c,v retrieving revision 1.58 diff -u -p -r1.58 c-typeprint.c --- src/gdb/c-typeprint.c 21 Jun 2010 18:01:50 -0000 1.58 +++ src/gdb/c-typeprint.c 22 Jun 2010 22:36:06 -0000 @@ -107,7 +107,8 @@ c_print_typedef (struct type *type, stru type_print (type, "", stream, 0); if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0 || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))), - SYMBOL_LINKAGE_NAME (new_symbol)) != 0) + SYMBOL_LINKAGE_NAME (new_symbol)) != 0 + || TYPE_CODE (SYMBOL_TYPE (new_symbol)) == TYPE_CODE_TYPEDEF) fprintf_filtered (stream, " %s", SYMBOL_PRINT_NAME (new_symbol)); fprintf_filtered (stream, ";\n"); }