From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44683 invoked by alias); 26 Jan 2019 06:21:59 -0000 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 Received: (qmail 44669 invoked by uid 89); 26 Jan 2019 06:21:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 26 Jan 2019 06:21:56 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A76D2117AF4; Sat, 26 Jan 2019 01:21:53 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fBz0I0jAkGhc; Sat, 26 Jan 2019 01:21:53 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 2073C117AE0; Sat, 26 Jan 2019 01:21:53 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 21325857A4; Sat, 26 Jan 2019 10:21:47 +0400 (+04) Date: Sat, 26 Jan 2019 06:21:00 -0000 From: Joel Brobecker To: Philippe Waroquiers Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFAv2 1/3] Use function_name_style to print Ada and C function names Message-ID: <20190126062147.GA26587@adacore.com> References: <20190112222835.16932-1-philippe.waroquiers@skynet.be> <20190112222835.16932-2-philippe.waroquiers@skynet.be> <877ef2ncvy.fsf@tromey.com> <1547899873.15869.5.camel@skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547899873.15869.5.camel@skynet.be> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2019-01/txt/msg00560.txt.bz2 > > Philippe> Note that ada-typeprint.c print_func_type is called with > > Philippe> types representing functions and is also called to print > > Philippe> a function NAME and its type. In such a case, the function > > Philippe> name will be printed using function name style. > > > > In this particular spot it still isn't clear to me if this will > > sometimes style a type name. So, I'm going to defer to Joel on the Ada > > bits. > > Would be nice to have Joel confirming, but I am quite confident that > this will only style function names and not type names. I reviewed the situation, and I think Philippe is right in the sense that when this function is called with a name, it's an actual function's name. When one declares a function type in Ada, it has to be an access type (the Ada equivalent of a pointer). And the target (function) declaration is anonymous. This is what it looks like: type FA is access procedure (A : System.Address); So, while the access type has a name ("FA"), the function type itself does not. From there, the only way I could see that the function might be called with a name is if it is given a symbol which is a procedure (not an access to that symbol). In that case, it would be legitimate to stylize the name as a function name. But in practice, it's hard to make GDB call that function with a name, because you can't really put the function name within an Ada expression without taking it's address (in Ada, this is a parameterless function call). The only way I could find that allowed me to trigger this function call with a non-NULL name was with "maintenance print symbols FILENAME". In that situation, we're back to the reasoning above that function types have no name unless they are tied to a real function, and thus "name" seems to always represent a function name. With all that, I'm wondering if Philippe had other examples where he can demonstrate the usefulness of this patch. At the moment, if the maintenance command is the only case, knowing that the output gets sent to a file, rather than stdout, and thus should not be stylized, are there other situations I couldn't think of where this patch would be useful? -- Joel