From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4sKvAjB1smiZyA8AWB0awg (envelope-from ) for ; Fri, 29 Aug 2025 23:51:12 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Db9WJtC8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EADC31E023; Fri, 29 Aug 2025 23:51:11 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F16DE1E023 for ; Fri, 29 Aug 2025 23:51:06 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F9E43858410 for ; Sat, 30 Aug 2025 03:51:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F9E43858410 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Db9WJtC8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 41A203857C67 for ; Sat, 30 Aug 2025 03:50:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41A203857C67 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 41A203857C67 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1756525832; cv=none; b=HTQx15YrbbgbIXENc/3cngiJUgV5xuzfi9yLDGdkAAZ14yM2dJyGb7iVN3MLJ9efzjvBjK7Q6w0gl3nnW4l4khbwN6K7XEi+CSI36v5VsNrLBu2gbtl4mKo/nHlCb08j6CxpVpJrw4h37a+wobM+zLs6CiV8tNr1zT7fMe39xSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1756525832; c=relaxed/simple; bh=VP9wP1WRtFDwcNXthcdaym0as+x3dEHQcJjLPebOqrE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=wNCDTztSCkTqJD+lGcf3W0LNi/FYcRX+LyqkZfpdnEGFwQulhyqmELPz8YQ9wTQk5Cb2QkpYvbMfych0fZp1uLbEnS8UzTsx8tPZY6q4DLrGpxZOUlLMu/Y/MS7rNqCbLxSUKO+veSvQ5G/hp8M0PpO83cXKFp2y7wd9Id70pCg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41A203857C67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756525831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=42tKm1pxdVAljgQ+Ri1vlql97p+T2Ulpeij70IxVS8w=; b=Db9WJtC8+mmC6Ak9zPYuEEtc6vdWSgk1ro/NyWnghbuQWo0kZ+rusOqOvYgke27DYBzFX7 E9d7fHItR1FJ77T+Swiptl63fOMGh9qz0xnuZLSPD0es26CQh0kD01Q0mebk9CDNx62w2B yFIllGqht63Hn0moUZrhOaSDLMx3y0g= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-175-Frs77SRqOe-_dOalh40L0A-1; Fri, 29 Aug 2025 23:50:30 -0400 X-MC-Unique: Frs77SRqOe-_dOalh40L0A-1 X-Mimecast-MFC-AGG-ID: Frs77SRqOe-_dOalh40L0A_1756525829 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B180195C277 for ; Sat, 30 Aug 2025 03:50:29 +0000 (UTC) Received: from f41-zbm-amd (unknown [10.22.88.27]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A5C71180047F for ; Sat, 30 Aug 2025 03:50:28 +0000 (UTC) Date: Fri, 29 Aug 2025 20:50:23 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH][fix the buildbot] gdb/solib-svr4: update default debug base in svr4_solib_ops::current_sos Message-ID: <20250829205023.6aa24f0c@f41-zbm-amd> In-Reply-To: <20250829200538.2276767-1-simon.marchi@polymtl.ca> References: <20250829200538.2276767-1-simon.marchi@polymtl.ca> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: n8EUFHDOOOfkiF0J6mCYEt-r40FmVfI3MYWgtJS0clk_1756525829 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On Fri, 29 Aug 2025 16:05:27 -0400 simon.marchi@polymtl.ca wrote: > From: Simon Marchi > > Commit d33a66a31134 ("gdb/solib-svr4: fix wrong namespace id for dynamic > linker") regressed test gdb.base/break-probes.exp with the native-gdbserver > board: > > Running /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/break-probes.exp ... > FAIL: gdb.base/break-probes.exp: run til our library loads (the program exited) > FAIL: gdb.base/break-probes.exp: call (int) foo(23) > > In the logs, we see this: > > Stopped due to shared library event: > Inferior unloaded target:/lib64/ld-linux-x86-64.so.2 > Inferior loaded target:/lib64/ld-linux-x86-64.so.2 > > When we should see this: > > Stopped due to shared library event (no libraries added or removed) > > In the unexpected output, GDB claims that the inferior unloaded and then > loaded the dynamic linker. This is obviously not true. > > Commit d33a66a31134 changed the svr4_same function to consider the debug > bases the solibs come from. Two solibs with the same inferior address but > different debug base (such as the multiple solibs representing the dynamic > linker in all the namespaces) now compare unequal. > > That commit also introduced a mechanism to update the debug base of an > existing solib (more precisely, field lm_info_svr4::debug_base) when that > value becomes known. The solib for the dynamic linker view in the default > namespace starts with a debug base of 0, and is then changed to have the > real debug base address later on. > > With the particular code path taken when connecting to a remote target, > nothing triggers the update of the debug base of the dynamic linker solib > initially created with a debug base of 0. So when > svr4_solib_ops::current_sos returns a list with an solib for the dynamic > linker with the real debug base value, the core sees this as an unload and > a load. > > This happens specifically when debuggin remotely, because, > svr4_solib_ops::current_sos_direct takes the "using_xfer" branch, which > doesn't do any svr4_solib_ops::default_debug_base call. In local, we don't > take that branch, which leads us to a call to default_debug_base. > > The way I propose to fix it is to add a call to > svr4_solib_ops::default_debug_base at the beginning of > svr4_solib_ops::current_sos. The rationale to put it there is that if the > core is requesting a fresh list of libraries, and then compare that list > with what it had previously, then we better make sure that the core's list > has received the debug base update, if one is needed. > > Change-Id: If09c5a7b3d956e18d4b9514466226267c85f12a6 > --- > gdb/solib-svr4.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c > index 635e52a19877..58432b69a5d5 100644 > --- a/gdb/solib-svr4.c > +++ b/gdb/solib-svr4.c > @@ -1512,6 +1512,15 @@ owning_intrusive_list > svr4_solib_ops::current_sos () const > { > svr4_info *info = get_svr4_info (current_program_space); > + > + /* Call this for the side-effect of updating the debug base in existing > + solibs' lm_info_svr4, if needed. It is possible for the core to have > + an solib with a stale lm_info_svr4::debug_base. In that case, we are > + about to return the same solib, but with an updated debug_base. If we > + didn't do this call, then it would appear as two different libraries to > + the core, and it would appear as a spurious unload / load. */ > + this->default_debug_base (info); > + > owning_intrusive_list sos = this->current_sos_1 (info); > struct mem_range vsyscall_range; > LGTM. Approved-by: Kevin Buettner