From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id jprMNPMyqmcPNioAWB0awg (envelope-from ) for ; Mon, 10 Feb 2025 12:10:11 -0500 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=RwWqnF65; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C591E1E105; Mon, 10 Feb 2025 12:10:11 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 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 14AA61E08E for ; Mon, 10 Feb 2025 12:10:11 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A91AB3858CD9 for ; Mon, 10 Feb 2025 17:10:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A91AB3858CD9 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=RwWqnF65 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 948F33858D26 for ; Mon, 10 Feb 2025 17:09:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 948F33858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none 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 948F33858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739207374; cv=none; b=L2frKPcP69sEhevzYuo/w+zq9eoog7xNsJYCEt6ZfZimDEbykCTqGHsBOlwtLTuJSJQgs4yEQVFDSoUtvRv78RfIa2ZpFkG6HyDSd9tluEE49NfBiWv/WAckZX83nq+PSz39+lfU4OYTM2CbQWNgeIAalszHPkOASKTTC43UHD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739207374; c=relaxed/simple; bh=6UoLoyngMI1MKhQXJZSmF2o32M34k2cQiz1u3yzMpjg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=U3T1nbjiMF3Ypiz69BJ08GzYTUiFgwQefU5UVx4xayriqaLnJb30i/EVNs7jzoQcZ8uT2jT9jr/3R7q/aejnmJju2Wuledq9wABcU72Ctv0v+biNM1oqtoMRfJ7lLmilV4Tv22EzNIlq/rrLGng9Y2skRqZ1gRIk+0VmvW+Nb1g= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 948F33858D26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739207374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a3AncHuQa6Janv0+ELBbf4K3YIWfgzeSDgDTjq6V3Fg=; b=RwWqnF65UQsGR8D9Q6nv+htCi0FkZyotvprro6qMb1FlPXvhUSbLzwppeOcbHFA2iSvZzX O1E6gCU9B/t4bUyCtGxWuJ9CKZ3vYvEsSyft+KJb0xTz3jcynw4332u3vnKBkXUhnnfyA8 mpK+Dg3jG99g5vINjq6PQ4In6UXh9qM= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-190-Udp1ZqJWPYKLoPVXqqnmnA-1; Mon, 10 Feb 2025 12:09:32 -0500 X-MC-Unique: Udp1ZqJWPYKLoPVXqqnmnA-1 X-Mimecast-MFC-AGG-ID: Udp1ZqJWPYKLoPVXqqnmnA Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-21f68852b7bso88001315ad.1 for ; Mon, 10 Feb 2025 09:09:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739207371; x=1739812171; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a3AncHuQa6Janv0+ELBbf4K3YIWfgzeSDgDTjq6V3Fg=; b=Beyju7egM+R7fXAaX2DXCLZGx+l7fLRJiRXVzUKtYzd1X0I+EBlXro8s/Naf2YaZHH sgCOaHV0etpV/zwN/I7kYdIPQbhTmbcsLhdTC73svgJlRjIwRhtniSX64fUM1reLz5mI FKtJX9x322mY3LnNpaarNCE6ZthA7eHfTkXtg6bi5z2ul/OR6peu9XdbxtOqpuofA7zp VCOV9f4aZ/in/lplTWxoubDh9MndBd+K1wo2VSPi9uits2jrgPxkEPPnHBxhkYUOj0GC XIA8GSr8jHHHVpVPJ3/lXmB062rXtsd2iWLBuZgdOr7x0DzyeTgilW9lCq1/qJ/cihtK wxiQ== X-Gm-Message-State: AOJu0YwwLSbVStj3O6EDY0OsGSEOouNoCZwiqCkNdyknoBO5ywyUaCb2 /JcBSBHfGi5e7UESbGF9reBxKwpXAXrr1hVpEynULxeXkM73QIxGB5Gtvy90a23T8VJ2BBmirBu IbcgDSEfZUhwZ/1JcPfxp8F5jzWZXwpn+hMX967blaRPiJC2qznQy2G32dhk= X-Gm-Gg: ASbGncsErZFM7Rgd0jYZiZALe7yfdGRrvs8N3qf9gTCrwcljTv5Iljw97TiWiXTvywx rUyc/IvNhMXxilMkx+GCiCLSO09WWiJH+AmmYanE3Z4kGNnCHJ0Pz3X9p6FF9cAS/zgWi8AjA88 TOuZUD2K822sEr7+vF6LSt17Ii2sNME12nWKj0gS0Kpe6TN8JjE89C3eA2dzVVfRWjOtXr74/U/ cUO4rC4wPGofvNWmnZmxtjexBpClAxcg6nprqjqnqaN/imODw2W33D3PGD7Tv6YM8cJ/6lvvaF4 1racZIFJSZkPk9Ur X-Received: by 2002:a05:6a00:6c90:b0:726:54f1:d133 with SMTP id d2e1a72fcca58-7305d491f5fmr23949592b3a.12.1739207369368; Mon, 10 Feb 2025 09:09:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0cpwLOYmpXK5A1ilWlOqZDvpxXsTQpReS3u2tpK0yxK7fVz3v0UGJWXDt+09TN4cOKOQohQ== X-Received: by 2002:a05:6a00:6c90:b0:726:54f1:d133 with SMTP id d2e1a72fcca58-7305d491f5fmr23949405b3a.12.1739207367510; Mon, 10 Feb 2025 09:09:27 -0800 (PST) Received: from ?IPV6:2804:14d:8084:9a69::1001? ([2804:14d:8084:9a69::1001]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7309598b5d6sm1596044b3a.16.2025.02.10.09.09.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Feb 2025 09:09:26 -0800 (PST) Message-ID: Date: Mon, 10 Feb 2025 14:09:23 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/1] gdb: remove check for minimal symbols in 'start_command' To: Kevin Buettner , Stephan Rohr Cc: gdb-patches@sourceware.org, eliz@gnu.org, tom@tromey.com References: <20250127154211.2509613-1-stephan.rohr@intel.com> <20250127154211.2509613-2-stephan.rohr@intel.com> <20250127162830.5d10b4f7@f41-zbm-amd> From: Guinevere Larsen In-Reply-To: <20250127162830.5d10b4f7@f41-zbm-amd> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HMdyQhIWhKAyWf4O0tveJVqnGdioFt_rPeBNUyaQzo4_1739207371 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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 1/27/25 8:28 PM, Kevin Buettner wrote: > On Mon, 27 Jan 2025 07:42:11 -0800 > Stephan Rohr wrote: > >> From: "Rohr, Stephan" >> >> GDB aborts the 'start' command if the minimal symbols cannot be >> resolved. On Windows, GDB reads the minimal symbols from the COFF >> header of the PE file. The symbol table is deprecated and the >> number of symbols in the COFF header may be zero: >> >> https://learn.microsoft.com/en-us/windows/win32/debug/pe-format >> >> This is reproducible with clang version 18.1.8 on Windows: >> >> clang++ -g -O0 -gdwarf -fuse-ld=lld test.cpp -o test_clang >> >> The COFF file header shows: >> >> FILE HEADER VALUES >> 8664 machine (x64) >> E number of sections >> 66E889EC time date stamp Mon Sep 16 21:41:32 2024 >> FB400 file pointer to symbol table >> 0 number of symbols >> F0 size of optional header >> 22 characteristics >> >> GDB is not able to read the minimal symbols; the `start' command fails >> with an error: >> >> (gdb) start >> No symbol table loaded. Use the "file" command. >> >> Manually inserting a breakpoint in main works fine: >> >> (gdb) tbreak main >> Temporary breakpoint 1 at 0x14000100c: file test.cpp, line 6. >> (gdb) run >> Starting program: C:\test-clang >> >> Temporary breakpoint 1, main () at test.cpp:6 >> 6 std::cout << "Hello World.\n"; >> >> Remove the check entirely; a 'NOT_FOUND_ERROR' is thrown if 'main' >> cannot be resolved. The error is consumed in 'create_breakpoint ()' >> and an error message is displayed to the user. >> --- >> gdb/infcmd.c | 6 ------ >> 1 file changed, 6 deletions(-) >> >> diff --git a/gdb/infcmd.c b/gdb/infcmd.c >> index b6b21a46b3d..00703e44b7b 100644 >> --- a/gdb/infcmd.c >> +++ b/gdb/infcmd.c >> @@ -517,12 +517,6 @@ run_command (const char *args, int from_tty) >> static void >> start_command (const char *args, int from_tty) >> { >> - /* Some languages such as Ada need to search inside the program >> - minimal symbols for the location where to put the temporary >> - breakpoint before starting. */ >> - if (!have_minimal_symbols (current_program_space)) >> - error (_("No symbol table loaded. Use the \"file\" command.")); >> - >> /* Run the program until reaching the main procedure... */ >> run_command_1 (args, from_tty, RUN_STOP_AT_MAIN); >> } > It's possible to reproduce this behavior on Linux too: > > $ gcc -static -g -o hello hello.c > $ strip --keep-section='.debug*' hello > > Using a gdb built without this patch: > > (gdb) file hello > Reading symbols from hello... > (gdb) start > No symbol table loaded. Use the "file" command. > > Which demonstrates the behavior that you're fixing with this patch. > > And yet... > > (gdb) b main > Breakpoint 1 at 0x401849: file hello.c, line 6. > (gdb) run > Starting program: /home/kev/ctests/hello > > This GDB supports auto-downloading debuginfo from the following URLs: > > Enable debuginfod for this session? (y or [n]) y > Debuginfod has been enabled. > To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit. > > Breakpoint 1, main () at hello.c:6 > 6 printf("Hello world\n"); > > ...it's still possible to set a breakpoint on main and run to it. > > With your patch: > > (gdb) file hello > Reading symbols from hello... > (gdb) start > Temporary breakpoint 1 at 0x401849: file hello.c, line 6. > Starting program: /home/kev/ctests/hello > > This GDB supports auto-downloading debuginfo from the following URLs: > > Enable debuginfod for this session? (y or [n]) y > Debuginfod has been enabled. > To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit. > > Temporary breakpoint 1, main () at hello.c:6 > 6 printf("Hello world\n"); > > The one thing that concerns me is the comment regarding the Ada language > and the need to search for minimal symbols. I'm going to give this patch > an "Approved-by", but please wait a few days for others to weigh in > regarding this concern. > > Approved-by: Kevin Buettner > Has this patch been pushed it already? I just ran into this in a different situation and it would be nice to have the fix upstreamed :) -- Cheers, Guinevere Larsen She/Her/Hers