From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bFIGOBdatmIEwwUAWB0awg (envelope-from ) for ; Fri, 24 Jun 2022 20:43:03 -0400 Received: by simark.ca (Postfix, from userid 112) id D1EF81E22C; Fri, 24 Jun 2022 20:43:03 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=QkYtiVDj; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 6B27D1E22A for ; Fri, 24 Jun 2022 20:43:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9DE1B383D81C for ; Sat, 25 Jun 2022 00:43:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DE1B383D81C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1656117782; bh=sfWpWRnTXf1/j9K7lbIaU6E0Syi29hdalz8w3RPAv94=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=QkYtiVDjPP1S0A6Ys4hD+rQ8D1qQbCr6O2TyCRre9NvIodXyhXJU/eLqRbu2R0hYa SjlVEmkb/4w4vtfzPcvoOKllNVmL032hUJd7bFNJPL33G7cLH5FRqp5pw0bHGjAfAX 8MKcWnNXgQrNLvjIzyAs8sHlY+z53VTjpKfeIO8g= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F317C3851C25 for ; Sat, 25 Jun 2022 00:42:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F317C3851C25 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-94--IhZUAwZP3W-FL1zkZznoQ-1; Fri, 24 Jun 2022 20:42:40 -0400 X-MC-Unique: -IhZUAwZP3W-FL1zkZznoQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 288F33833296; Sat, 25 Jun 2022 00:42:40 +0000 (UTC) Received: from f35-zws-1 (unknown [10.2.16.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D904A18EAB; Sat, 25 Jun 2022 00:42:39 +0000 (UTC) Date: Fri, 24 Jun 2022 17:42:38 -0700 To: Markus Metzger via Gdb-patches Subject: Re: [PATCH v5 15/15] gdb, solib-svr4: support namespaces in DSO iteration Message-ID: <20220624174238.6e057f6b@f35-zws-1> In-Reply-To: <20220602132514.957983-16-markus.t.metzger@intel.com> References: <20220602132514.957983-1-markus.t.metzger@intel.com> <20220602132514.957983-16-markus.t.metzger@intel.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Kevin Buettner via Gdb-patches Reply-To: Kevin Buettner Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On Thu, 2 Jun 2022 15:25:14 +0200 Markus Metzger via Gdb-patches wrote: > When looking up names, GDB needs to stay within one linker namespace to > find the correct instance in case the same name is provided in more than > one namespace. > > Modify svr4_iterate_over_objfiles_in_search_order() to stay within the > namespace of the current_objfile argument. If no current_objfile is > provided (i.e. it is nullptr), iterate over objfiles in the initial > namespace. > > For objfiles that do not have a corresponding so_list to provide the > namespace, assume that the objfile was loaded into the initial namespace. > This would cover the main executable objfile (which is indeed loaded into > the initial namespace) as well as manually added symbol files. > > Expected fails: > > - gdb.base/non-lazy-array-index.exp: the expression parser may lookup > global symbols, which may result in xfers to read auxv for determining > the debug base as part of svr4_iterate_over_objfiles_in_search_order(). > > - gdb.server/non-lazy-array-index.exp: symbol lookup may access the > target to read AUXV in order to determine the debug base for SVR4 > linker namespaces. > > Known issues: > > - get_symbol_address() and get_msymbol_address() search objfiles for a > 'better' match. This was introduced by > > 4b610737f02 Handle copy relocations > > to handle copy relocations but it now causes a wrong address to be > read after symbol lookup actually cound the correct symbol. This can > be seen, for example, with gdb.base/dlmopen.exp when compiled with > clang. > > - gnu ifuncs are only looked up in the initial namespace. > > - lookup_minimal_symbol() and lookup_minimal_symbol_text() directly > iterate over objfiles and are not aware of linker namespaces. > --- > gdb/solib-svr4.c | 78 ++++++++++++++++++- > gdb/testsuite/gdb.base/dlmopen-lib-dep.c | 21 +++++ > gdb/testsuite/gdb.base/dlmopen-lib.c | 5 +- > gdb/testsuite/gdb.base/dlmopen.exp | 40 ++++++++-- > .../gdb.base/non-lazy-array-index.exp | 18 ++++- > .../gdb.server/bkpt-other-inferior.exp | 13 +++- > 6 files changed, 159 insertions(+), 16 deletions(-) > create mode 100644 gdb/testsuite/gdb.base/dlmopen-lib-dep.c Okay. Kevin