From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Received: (qmail 11766 invoked from network); 10 Jan 2003 23:34:13 -0000 Received: from unknown (HELO mail-out2.apple.com) (17.254.0.51) by 209.249.29.67 with SMTP; 10 Jan 2003 23:34:13 -0000 Received: from mailgate1.apple.com (A17-128-100-225.apple.com [17.128.100.225]) by mail-out2.apple.com (8.11.3/8.11.3) with ESMTP id h0ANY1I16276 for ; Fri, 10 Jan 2003 15:34:01 -0800 (PST) Received: from scv1.apple.com (scv1.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Fri, 10 Jan 2003 15:33:32 -0800 Received: from apple.com (vpn-scv-x2-227.apple.com [17.219.193.227]) by scv1.apple.com (8.11.3/8.11.3) with ESMTP id h0ANY0s12453; Fri, 10 Jan 2003 15:34:00 -0800 (PST) Message-ID: <3E1F582E.2040408@apple.com> Date: Fri, 10 Jan 2003 23:34:00 -0000 From: Stan Shebs User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Carlton CC: gdb , Daniel Jacobowitz Subject: Re: how canonical are template names? References: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-01/txt/msg00186.txt.bz2 David Carlton wrote: >I'm testing a patch on my branch that tries to figure out when a class >lives inside a namespace by looking at the demangled names of the >methods of the classes. > >When I tested the patch, I saw some regressions in >gdb.c++/templates.exp. But, on looking at the situation further, I'm >not sure that they qualify as regressions. Basically, there are >different ways to write the same types; it turns out that G++'s debug >info and the demangler choose different ways in some circumstances. > >In an ideal world, maybe GDB would always print types in one canonical >way and allow users as much flexibility as possible in how they input >types. But, for now, it seems quite reasonable to allow GDB to print >types however it wishes and to require users to input types the same >way that GDB outputs them in some circumstances. Usually, users can >figure out what name GDB thinks a templated class has by calling >'ptype' on a variable of the appropriate type. > One goal for all GDB expression and type evaluation is to pass the cut-n-paste test - the debugger should be able to take anything in the source code and come up with the same interpretation as the compiler. Anything less is a quick trip to user hell - manually expanding macros, trying to guess how to phrase a cast, executing function bodies line by line because function calls don't work. Of course, we'll always fall short of the ideal. In the specific cases you mention, it sounds like some parser smartening is in order, and all the faults should be PRs. Stan