From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12233 invoked by alias); 6 Jan 2020 19:26:51 -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 11952 invoked by uid 89); 6 Jan 2020 19:26:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.0 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=H*r:sk:mail-oi, HX-HELO:sk:mail-oi, HX-Spam-Relays-External:sk:mail-oi, H*RU:sk:mail-oi X-HELO: mail-oi1-f195.google.com Received: from mail-oi1-f195.google.com (HELO mail-oi1-f195.google.com) (209.85.167.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Jan 2020 19:26:50 +0000 Received: by mail-oi1-f195.google.com with SMTP id l136so16709226oig.1 for ; Mon, 06 Jan 2020 11:26:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m7aTdsqrqIRWBYhuoi6XOb+y31JH8owPeriJONQxk1g=; b=lIcoFbAZNs01Vjsk69nBsuHQBYj2va79DiPTkPvKT7lxcdOuvMQlFkT84QcNx4Udub Qikw0Hg8mJfIZN9yr2YkrsnRNxMMN87CFm38Z415lHG7GmZMgtvu4IzE3tRNae7vL/Ha YmtmjklWFB4MJvH4rP0ey5C70iXdn+idjsEEFDEzwic54OytamiEZhsCfWecXnTSVmZD 2c8XyOqi/AAlbSoeFMFr3faCnccL0ZmrLntdfvAzOqd3RxyXOcntxKPt7THtJLSdlOda Oa94U6iwa8gLMrimRRYLR64iXFCaiW1eJq35+YYjSDIuB2coQOhAajllCG0Wzdh6Rjtz syMg== MIME-Version: 1.0 References: <20191226075201.239053-1-cbiesinger@chromium.org> <34ef9777-7067-8669-a9a5-40c8cfe8e8d6@simark.ca> In-Reply-To: From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Mon, 06 Jan 2020 19:26:00 -0000 Message-ID: Subject: Re: [PATCH] Make symbol_set_names a member function To: Simon Marchi Cc: gdb-patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00128.txt.bz2 On Thu, Dec 26, 2019 at 10:43 PM Christian Biesinger wrote: > > On Fri, Dec 27, 2019 at 4:02 AM Simon Marchi wrote: > > > > On 2019-12-26 8:09 p.m., Christian Biesinger wrote: > > > On Thu, Dec 26, 2019 at 6:50 PM Simon Marchi wrote: > > >> > > >> I hacked the code to always enter these ifs and print both the linkage_name > > >> and the natural_name. With a C++ test program containing this function: > > >> > > >> int hello(int); > > >> > > >> I get: > > >> > > >> linkage_name: hello > > >> natural_name: hello > > >> > > >> I would have expected linkage_name to be _Z5helloi and the natural_name to be > > >> hello(int). Do you know if it's expected for the partial symbol to contain > > >> just "hello" for both? > > > > > > Huh.. > > > > > > I added a printf in compute_and_set_names and found that there's a > > > symbol with the mangled name *and* a symbol with the plain name. I > > > guess that's why? But I don't know what that means... > > > > Ok, I see what happens. The first call to compute_and_set_names > > is while parsing minimal symbols, by minimal_symbol_reader::install. > > This one has a mangled linkage name (_Z5helloi). > > > > The second call is while creating partial symbols, by add_psymbol_to_bcache. > > This is the one with the linkage name "hello". I suppose that's expected, > > I had never really paid attention to this. > > > > There's also a third call, while creating the full blown symbol, with a > > linkage name of "hello(int)". > > > > So the term "linkage_name" in general_symbol_info is perhaps a bit misleading, > > it makes sense for minimal symbols, but not really for partial and full symbols. > > Hm.. maybe I'll look into this some more to understand this better. It > certainly seems surprising that minsyms behave differently from other > symbols in this respect? OK, I looked into this a little bit more... For partial symbols, the actual DWARF data contains this: <2e> DW_AT_name : foo <35> DW_AT_linkage_name: (indirect string, offset: 0x5): _Z3fool And gdb just use the DIE's DW_AT_name as the linkage name for the partial symbol. I have not checked what happens for full symbols. But I'm not sure that this difference between minsyms and psymbols is a good thing :( Christian