From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uo7zDlgs22CILQAAWB0awg (envelope-from ) for ; Tue, 29 Jun 2021 10:21:12 -0400 Received: by simark.ca (Postfix, from userid 112) id 332B81F1F2; Tue, 29 Jun 2021 10:21:12 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2D3C11EE14 for ; Tue, 29 Jun 2021 10:21:11 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B4C33382C427 for ; Tue, 29 Jun 2021 14:21:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4C33382C427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1624976470; bh=xQMw4fKRMUqvcQ190pGBG2pP/D/6vRwNTCt/Hcqb9Ac=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=F7KmqAngjbIDpqj5fNEXKyrZVUEH7jMm4k6+71MW4Oenpw++vweOI8JlSyQ9f/trH ieM6r/L4AZRh+y7vEXBSzoXoxyDatI3Sgs5X/FdaJ9ZX66r65SP9s1plCdldAf4asq I0DLpv7VHYHm0BYtQy8Xjr9EF2yB2+uoP0++ItNo= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 162BE385482F; Tue, 29 Jun 2021 14:20:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 162BE385482F Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 15TEKXN0020759 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Jun 2021 10:20:38 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 15TEKXN0020759 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 58C471EE14; Tue, 29 Jun 2021 10:20:33 -0400 (EDT) Subject: Re: [PATCH] nptl: Export libthread_db-used symbols under GLIBC_PRIVATE To: "Carlos O'Donell" , Florian Weimer , libc-alpha@sourceware.org References: <877disuwfq.fsf@oldenburg.str.redhat.com> <4df1e03a-eead-82b2-289f-b6cb7ddc0159@polymtl.ca> <26256d31-616d-2fc7-7788-937776287791@redhat.com> Message-ID: <959aa579-81b0-6b63-ae03-d9e1a15d2856@polymtl.ca> Date: Tue, 29 Jun 2021 10:20:32 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <26256d31-616d-2fc7-7788-937776287791@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 29 Jun 2021 14:20:34 +0000 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb Reply-To: Simon Marchi Cc: gdb@sourceware.org Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" On 2021-06-27 6:25 p.m., Carlos O'Donell wrote:> On 6/20/21 8:38 AM, Simon Marchi via Libc-alpha wrote: >> On 2021-06-17 3:23 p.m., Florian Weimer via Gdb wrote: >>> Kevin, this *almost* gives us the perfect debugging experience with your >>> patched GDB in Fedora 35, according to my preliminary tests. A build >>> with the patch is running here: >>> >>> >>> >>> However, it seems that GDB still needs pthread_create in the .symtab to >>> trigger loading of libpthread_db. A fully stripped libc.so.6 without >>> .symtab does not trigger loading in my experiments. (The other symbols >>> we preserve for valgrind's sake and are immaterial to GDB.) In other >>> words, >> >> Stupid question, but: since pthread_create is a function exposed by the >> libc.so shared library, won't there still be an entry for it in .dynsym? > > No question is stupid. Thank you for asking. > > Yes, there *must* be a .dynsym entry for pthread_create in libc.so.6 in > order for the dynamic loader to bind the reference to the definition. > >> And if so, shouldn't GDB see it? > > It should. Today gdb is only using the internal lookup_minimal_symbol() > API in order to trigger libthread_db loading, and it's not clear to me > if that will load *all* of the dynamic symbols during gdb startup. > > Someone would need to debug the minsyms.c API to see if something isn't > working as expected. > > gdb/minsyms.c: > > 1267 When files contain multiple sources of symbol information, it is > 1268 possible for the minimal symbol table to contain many duplicate entries. > 1269 As an example, SVR4 systems use ELF formatted object files, which > 1270 usually contain at least two different types of symbol tables (a > 1271 standard ELF one and a smaller dynamic linking table), as well as > 1272 DWARF debugging information for files compiled with -g. > > So it sounds like the data is loadable, and mergeable, but it appears that > it's not all there at early startup in gdb. My intuition is that the .dynsym symbols are normally loaded and result in minimal symbols in GDB: https://gitlab.com/gnutools/gdb/-/blob/master/gdb/elfread.c#L1102-1128 But there may be some filtering that prevents the symbols like pthread_create from making their way into the minimal symbols database. I'll have to try using the container that Florian pointed to (registry.fedoraproject.org/fedora:rawhide). Simon