From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15356 invoked by alias); 17 Mar 2006 08:40:20 -0000 Received: (qmail 15334 invoked by uid 22791); 17 Mar 2006 08:40:17 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 17 Mar 2006 08:40:15 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FKAV6-0001p0-8y for gdb-patches@sources.redhat.com; Fri, 17 Mar 2006 09:40:00 +0100 Received: from zigzag.lvk.cs.msu.su ([158.250.17.23]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Mar 2006 09:40:00 +0100 Received: from ghost by zigzag.lvk.cs.msu.su with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Mar 2006 09:40:00 +0100 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: Remove type prefix for -var-evaluate-expression/functions Date: Fri, 17 Mar 2006 10:42:00 -0000 Message-ID: References: <17434.29587.870198.135084@kahikatea.snap.net.nz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart10607332.KrR8IaCfWG" Content-Transfer-Encoding: 7Bit User-Agent: KNode/0.8.2 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00222.txt.bz2 --nextPart10607332.KrR8IaCfWG Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8Bit Content-length: 1047 Nick Roberts wrote: >> Hi, >> the following patch removes 'type prefix' from output of >> -var-evaluate-expression applied to objects of function type (not >> pointers to functions, but functions). >> >> It causes no regression in the testsuite for me. > > But I guess a new test would help prevent a regression (in the code) in > the future. Yes, can you suggest which file should I add this new testcase too? >> Changelog: >> >> 2006-03-15 Vladimir Prus >> >> * c-valprint.c >> (c_val_print): Don't print type prefix for functions. >> (c_value_print): Print type prefix for functions here. > > >> Patch attached. > > ... >> + if (TYPE_CODE (type) == TYPE_CODE_FUNC) > > This condition must always be true here (case TYPE_CODE_FUNC:). This chunk is in 'c_value_print', where there's no switch. > > > Where's the patch for c_value_print? I guess I'd better send the patch with "-p". It's attached, hopefully it's more clear. And thanks for the hint about -p! - Volodya --nextPart10607332.KrR8IaCfWG Content-Type: text/x-diff; name="type_prefix.diff" Content-Transfer-Encoding: 8Bit Content-Disposition: attachment; filename="type_prefix.diff" Content-length: 1384 Index: c-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/c-valprint.c,v retrieving revision 1.39 diff -u -p -r1.39 c-valprint.c --- c-valprint.c 18 Jan 2006 21:24:19 -0000 1.39 +++ c-valprint.c 17 Mar 2006 08:38:41 -0000 @@ -356,11 +356,6 @@ c_val_print (struct type *type, const gd print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); break; } - /* FIXME, we should consider, at least for ANSI C language, eliminating - the distinction made between FUNCs and POINTERs to FUNCs. */ - fprintf_filtered (stream, "{"); - type_print (type, "", stream, -1); - fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ print_address_demangle (address, stream, demangle); break; @@ -570,6 +565,16 @@ c_value_print (struct value *val, struct } } + if (TYPE_CODE (type) == TYPE_CODE_FUNC) + { + /* FIXME, we should consider, at least for ANSI C language, eliminating + the distinction made between FUNCs and POINTERs to FUNCs. */ + fprintf_filtered (stream, "{"); + type_print (type, "", stream, -1); + fprintf_filtered (stream, "} "); + } + + if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS)) { /* Attempt to determine real type of object */ --nextPart10607332.KrR8IaCfWG--