From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6eu6IFcDr2mleiAAWB0awg (envelope-from ) for ; Mon, 09 Mar 2026 13:28:55 -0400 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=fCrM5VuB; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 80E7E1E0DD; Mon, 09 Mar 2026 13:28:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 5A9661E089 for ; Mon, 09 Mar 2026 13:28:54 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 0F3994BA23F9 for ; Mon, 9 Mar 2026 17:28:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F3994BA23F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1773077333; bh=sGjrUuafjj/N3l8eM3XOSgJM5gcnoG/9EnjGyWYsjOQ=; h=To:Cc:Subject:In-Reply-To:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=fCrM5VuB+FG6ZUCOtfyUNBBO4ae6qblfcL4lX/hFviFbfz5pQqbo0IY2biSuFCRAR X2M5a4OPnns021m41NXePi6dT5LRbZWB5YmSLzfOIaQ0Q2LqwhtiMqqJOmMqA/xxPv 2A+2dSLNGg18h/X85qBAqCZeJiYjddIU9Tjk/rLA= 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 3E4444BA23CD for ; Mon, 9 Mar 2026 17:28:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3E4444BA23CD ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3E4444BA23CD ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773077296; cv=none; b=P5xeZo+wyxkt9zP40t+ykltguOncgbZiVhDG6pO0T6TyOhDfA6iic1Uby4JGmwflIVOsmhXEZ/49YABUTczG7cbSKGMtaq9zEF+0fPbkpqk7fqrF1iktb18OpcK72NlWn/eJMEV18UTZqY4AdINYjKoJW0yDcDaZ/1ox/BxGZtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773077296; c=relaxed/simple; bh=eLtA2M9qBYLh/jno/TPNpJUhB6kCMzP1B6sRc5I7Yts=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pVLJDdF0ycfHJLKT6allF3IsKGEoqE6MCJkNodCFBlw4/E11OoybxNs9pgKUw5ktupvSaq8XWcWhwD3TmAstZp6AzP0DmHvy9Azm8Tac8qLEtLO58AlJRT60kjpil7ewPBnCQYq1/5rhKi4NcVPsWzvHPR8iDEjYIKjP5X1iQes= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E4444BA23CD Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-53-_kcb8omkMQi_8z6CV5cjwQ-1; Mon, 09 Mar 2026 13:28:14 -0400 X-MC-Unique: _kcb8omkMQi_8z6CV5cjwQ-1 X-Mimecast-MFC-AGG-ID: _kcb8omkMQi_8z6CV5cjwQ_1773077293 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-439b50dfca1so6490338f8f.0 for ; Mon, 09 Mar 2026 10:28:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773077293; x=1773682093; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sGjrUuafjj/N3l8eM3XOSgJM5gcnoG/9EnjGyWYsjOQ=; b=HQ4019P1taY30xIYHf8i6hrtd1I7Ou/l7b7mvueT4ryb4nglTaq9Iiy/NJFEJfokW6 tstKzT0SVOjGII6rVgjDPUWFX3uHXEd1GnhN+odWrRouqbY2iaAJ1JxFT05bAedUTV7F c6Rw1gYhDXOHb7CJM3crYnAieyE5BNppAst7Q81KrorJnThomB9QXU/jFSYetSSkQfhi 4RORwNCa2AOpjCW9RuTIYgZdCefzK+iq+s9GaTzOGLJzCgIpEP3QeM91AbNGjsITNDre cpsIG9j0LVV9hpi1U4+QOagXX2T7ndF7q6a4OE4+Y3alasE63ChIayMhVqCgxisFFHjR F32A== X-Gm-Message-State: AOJu0Yz4YMTtLZ/i70xMKXqQt2P8tNGQOXyiVDp4PYeDJB4INHV6Y8YY 1Swwm+JqWrOvXFnly2tbjXdAf2LvhbZguUfFYiOzhJcoxqnQXGNk6xPihcbFFOmDyptfPPdY5Bp ua1vBcJQJmG68x7jUE3mpgz4cy4hKuGkYpqRU7GdQlk1upbQ03xkTqykvx4Qq X-Gm-Gg: ATEYQzzMldxr6vAcqEIqpGynu6ZNaJJS2UUDuBfWv8S8wPmG+7P9dnhAcTSbEpwnSUW XLdixiEk+6sOyyUvpeE37rTfThPEvxzyQmbja6ePI1rYQgRviEZ0qiEaZs8oNB6gXLTJs0oE0yG 1MMPmxID+ibuEPPV3P/luiiyCTxUlANN0QHqbzOqaUUmwah7FRT3ZJ5kOFoxYgLIUjRm8NLO8Bw novHW4h7uOTxjOFbb06CdfHpPemE8akPJjymo1AU6S7XWzI0G3k8q0uAiuPXXgrHg9sn+FSNls3 C5ssVn+GCsFGBWM6itf/R2oYSPlPJxbLxGwLroKwxWwMzYGWGLnw5J/AmRnh+MtgQJVCCF6HZlJ crQR3BjHG3RrYT9cD X-Received: by 2002:a05:6000:2404:b0:439:85bf:2366 with SMTP id ffacd0b85a97d-439da651e39mr19071847f8f.52.1773077292712; Mon, 09 Mar 2026 10:28:12 -0700 (PDT) X-Received: by 2002:a05:6000:2404:b0:439:85bf:2366 with SMTP id ffacd0b85a97d-439da651e39mr19071816f8f.52.1773077292271; Mon, 09 Mar 2026 10:28:12 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439dad8daf2sm28817041f8f.2.2026.03.09.10.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 10:28:12 -0700 (PDT) To: Simon Marchi , psmith@gnu.org, Arsen =?utf-8?Q?Arsen?= =?utf-8?Q?ovi=C4=87?= Cc: gdb@sourceware.org Subject: Re: Does gdb debuginfod download libc etc.? In-Reply-To: <371fdb1a-2c5d-40cd-9294-03e2a5040e06@simark.ca> References: <86wlzmfyep.fsf@aarsen.me> <4844fe241f5524951dc68a6ce05e450897342034.camel@gnu.org> <8c514818-14bd-462d-8aed-0c323327acae@simark.ca> <7949b3d7727ab11f6bc3c833fae81f485c345c47.camel@gnu.org> <371fdb1a-2c5d-40cd-9294-03e2a5040e06@simark.ca> Date: Mon, 09 Mar 2026 17:28:11 +0000 Message-ID: <87fr687w0k.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LJ4p65noB76yYfAnt9ZQjukrkvASdKGIYgH62HPtLRY_1773077293 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb Reply-To: Andrew Burgess Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" Simon Marchi via Gdb writes: > On 3/9/26 9:57 AM, Paul Smith wrote: >> On Sun, 2026-03-08 at 22:32 -0400, Simon Marchi wrote: >>> I noticed a difference between the first debuginfod call (which >>> succeeds) and the second one (that fails). The first one is >>> debuginfod_find_executable and the second is >>> debuginfod_find_debuginfo. Could it be important? >>=20 >> I think this is not an issue. >>=20 >>> Are you able to replicate those queries using the debuginfod-find CLI >>> tool? This is equivalent to the first query, I would expect it to >>> work: >>> >>> debuginfod-find executable f87c1d8cd2118209ef2350b22b187a64d705d6cd >>=20 >> This is the build ID for my program, and this exists and is downloaded >> properly. >>=20 >>> And this is equivalent to the second query, I would expect it to >>> fail: >>> >>> debuginfod-find debuginfo 8cfa19934886748ff4603da8aa8fdb0c2402b8cf >>=20 >> This is the build ID for the debuginfo for my local system's runtime >> linker /lib64/ld-linux-x86-64.so.2: > > Ah ok, I didn't catch that from your output, sorry. > >>> [separate-debug-file] find_separate_debug_file_by_buildid: end: >>> looking for separate debug info (build-id) for /lib64/ld-linux-x86- >>> 64.so.2 debuginfod_find_debuginfo >>> 8cfa19934886748ff4603da8aa8fdb0c2402b8cf >>=20 >> This doesn't exist in my debuginfod server. It might be nice to have >> debuginfo for the runtime linker, but I've never had it for any of my >> debugging sessions, because users very rarely install it on their >> systems, and it's not been a problem. >> >> Even if I wanted the debuginfo for the runtime linker, things have >> already gone awry here because GDB is loading my LOCAL SYSTEM'S runtime >> linker, when instead it should have downloaded the core file's runtime >> linker which is a different file with a different build ID. >>=20 >>>>> =E2=9A=A0=EF=B8=8F warning: platform-specific solib_create_inferior_h= ook did not >>>>> load initial shared libraries. >>> >>> GDB still ends up listing the shared libs, so it might be red >>> herring. It is still curious though. >>=20 >> The reason I suggest this might be related is that it seems to me that >> once we reach this point, GDB has already started to do the wrong >> thing. For example as above, it's use the local system's ld-linux.so >> rather than downloading the core file's ld-linux.so. >>=20 >> I would expect that I would see requests to the debuginfod server for >> the shared libraries, including the runtime linker itself, but I don't >> see any of that. It only tries to find the executable and the >> debuginfo file for the local system's runtime linker, and it never >> tries to find anything else. > > I would add a printf in core_target::build_file_mappings to print the > mapped files and their (if present) build-ids. > > And then put a breakpoint or printf in solib_bfd_open, to see when GDB > tries to open the files for the solibs. It might be that we blindly > open the files from the host, and we could add some build-id checks to > avoid that (and ask debuginfod instead). This should be handled already in solib_map_sections. Initially we open a local file based on the shared library filename, but then we call core_target_find_mapped_file which looks up the file based on the filename and a representative address mapped within the shared library, and returns some data that includes the build-id. We the compare the build-id for the local file with that obtained from the core file. If they don't match we close the local file we initially opened, and then try to find a suitable file based on the build-id. Or if there was no local file to open, then we also do the lookup by build-id path. Thanks, Andrew