From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79322 invoked by alias); 19 Jan 2019 12:11:21 -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 79289 invoked by uid 89); 19 Jan 2019 12:11:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=philippe.waroquiers@skynet.be, D*be, U*philippe.waroquiers, philippewaroquiersskynetbe X-HELO: mailsec102.isp.belgacom.be Received: from mailsec102.isp.belgacom.be (HELO mailsec102.isp.belgacom.be) (195.238.20.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 19 Jan 2019 12:11:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1547899876; x=1579435876; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=NkmtzEhWQQ08QOgk9kkfFC4emz8j4Y+jYLQEc/QL6gY=; b=GPfJQ8HwQ7fDheKuOzsZFuM7mYM9Xgr6BXIRmnRBhdP65TAgiWxCqrc1 kWPQL2D9bVl/Shwd6Gy+SlVdJeNBPg==; Received: from 184.205-67-87.adsl-dyn.isp.belgacom.be (HELO md) ([87.67.205.184]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 19 Jan 2019 13:11:13 +0100 Message-ID: <1547899873.15869.5.camel@skynet.be> Subject: Re: [RFAv2 1/3] Use function_name_style to print Ada and C function names From: Philippe Waroquiers To: Tom Tromey , Joel Brobecker Cc: gdb-patches@sourceware.org Date: Sat, 19 Jan 2019 12:11:00 -0000 In-Reply-To: <877ef2ncvy.fsf@tromey.com> References: <20190112222835.16932-1-philippe.waroquiers@skynet.be> <20190112222835.16932-2-philippe.waroquiers@skynet.be> <877ef2ncvy.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00429.txt.bz2 Thanks for the review. On Thu, 2019-01-17 at 15:21 -0700, Tom Tromey wrote: > > > > > > "Philippe" == Philippe Waroquiers writes: > > 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. If that can help, here is some more detailed investigations: First, in Ada, after the keywords procedure/function, and before the arg list (as printed by print_func_type), you must put a procedure/function name, no type name can be put there, so GDB would produce real strange/invalid Ada such as: procedure Some_Ada_Type_Name (Some_Arg : ...); This explanation matches the comment of print_func_type: /* Print function or procedure type TYPE on STREAM.  Make it a header    for function or procedure NAME if NAME is not null.  */ Also, the type name of an Ada type is accessed via ada_type_name, that accesses a member of TYPE containing the type name. To the contrary: the NAME arg of print_func_type is received from ada_print_type (the single caller of print_func_type), that passes as NAME its VARSTRING arg. There are only a few places where ada_print_type is called with a non null VARSTRING arg, and these are for the names of fields of record/unchecked unions. ada_print_type is called (indirectly) by all calls to print_type (dispatching on the language). Doing a grep, I found only symtab.c:print_symbol_info that calls type_print with a non NULL/non "" VARSTRING arg, and this piece of code gives "" when the symbol is a TYPEDEF. So, I really do not see how that piece of code could style something else than a function/procedure name. Thanks Philippe