From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6xCoKr864mldvh4AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 09:50:55 -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=fBs9Oy1b; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8F5BF1E0C3; Fri, 17 Apr 2026 09:50: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=-3.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,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 052281E0B1 for ; Fri, 17 Apr 2026 09:50:55 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 1C3FD4CCCA1D for ; Fri, 17 Apr 2026 13:50:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C3FD4CCCA1D 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=fBs9Oy1b 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 92C634AA397D for ; Fri, 17 Apr 2026 13:50:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 92C634AA397D 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 92C634AA397D 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=1776433818; cv=none; b=fvTbL/oLEC6Nx8cLhN10F95Eitrahl7/+eV4+x8peGyjhrVLFQALetL/glwfa8E1G9HIFD4UQucLmiGpF3yGKCVDnp6RhBTHk43788RLcafdqEHHGwzZwFv1upfF583m9BzaVoLhczvLJ8xQOrl20kML+9sGWmfuolzuOtwxvfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776433818; c=relaxed/simple; bh=EhU/fIMD05qIpFcHK16ePl7NaAVeqwUzduNNt7xaK+I=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lFwGzrVBAIS6SSHKZjx39Kx+G+JrUJrU3FerUVD+fxktsJaAHHnEwg7swYb/APgbYnhCBvPlc7NbMWuCFV7PbDiGUYQsdzYNL83h+Bf2aQ628qpAjq1Xz0uMkTno28fIftklOil27B7wefWHbS6D2eyaJGhzDmm8kzsvjCTSpsc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92C634AA397D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776433818; 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: in-reply-to:in-reply-to:references:references; bh=Bz7UkkOWj9/OP5JHMlpg/mhzT+vHmGpKMVmGcxTnenA=; b=fBs9Oy1bizgjEXf+PXut11/lJusGfnZDIUznYM5Y+Te1bVzyJ9ZhiwxWlchfAOxXWHyMHG 80E3tdcLHqTAH+kP97br81AxLBnBA2c5yoebFgM3SoGGdqpRYyqhFsMUDpajBSSuM2z0Rx vD4b/j6p+F9Fun/pEvadB48TSdxHo+M= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-LOKkL_1nNO-0AUKII3SbYg-1; Fri, 17 Apr 2026 09:50:09 -0400 X-MC-Unique: LOKkL_1nNO-0AUKII3SbYg-1 X-Mimecast-MFC-AGG-ID: LOKkL_1nNO-0AUKII3SbYg_1776433809 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4837bfcfe0dso7673525e9.1 for ; Fri, 17 Apr 2026 06:50:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776433808; x=1777038608; h=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=Bz7UkkOWj9/OP5JHMlpg/mhzT+vHmGpKMVmGcxTnenA=; b=h3s0Ei0Q12MsJvIPMBrl+53n2GU3c78pPGOd/yUXiwNPTWUNA/bKFxwTS6tqsfhnBe g1rMaX5n3Aol/sZKDtWer6/T88uIlMQ26vbdT2sBcHj6cdy1u/YPizA5oS5UhAwxZRX/ IxtizzPe7WoKYTKUoZ4q184qUhkQTXKq+4YRUypOQsetRc+Fjv7+xEwCAa2b4VPXp7xh Pq5phenuW6rklP1+GigT2VB2VyYIczs4QIK+ehpAV5Xm4pV3hWigyDhCBanrerHO1HDO fIEEh6RxtHfIODdAlXzZ6LDxumtsPY76M+S5/ArfO9fzctjjHMXFxmwB4jgaCjxhruQq +zlQ== X-Forwarded-Encrypted: i=1; AFNElJ8c/YpTq4eMLCiAuLoO2rOYeFkjZjQV6fJKnzSqvB7O6j+T1oSStbbVG5UAXeftgkBvAX5m9QJHftNaZA==@sourceware.org X-Gm-Message-State: AOJu0Yw3CxGjeHtuPkjzZYo2ov3h34CeiD3gMzs4NPhk/HO8N0zfye5b z81rNzE/H4FBP4691BjBJWC0GtduPF68K9BwibiGU1z2qnSygP5zDtI67v9wjnzjNQBXNigN68P WtcLIQcuWTqwI/ZDkReWV6M0pyrWpshZXuocrqAz5dWMq0ed0PnddvfqfoMPIyYY5xIOtpfw= X-Gm-Gg: AeBDievN7jQ5FUFh4VskFE1zKC0N82Q4auA0YeebufNWaATk6ORkiQZPWS0rjbjQ1p3 Lukzp0MAIGY89w+0/5ZI6PET2ygPUty1POYE65SPdYMEQ5ocTOZlBOJklgkgwEbfB6qakwXFb2X UiABRfzsG4if7G+oUadHqtc1PWMJtan8zB15VOuno5S4R6xXdtU7fh/F4J3BYB+RRYg+U3/ru3Z NsYcFcufrTgRIghHJiKD5IHCy4T2n8Krg1vMzdE81R1XEzg9eU5KG4x/HrNRcZm05fQqcGQZ2Hs zK2kqcLHVCNYkZIb4YSsnIpicM2GIWkB1HKey4bFs/KmpeNyXmy6Wema8G4cND0zBzmfY6B7Ynt ojqfbNBWk2aoDB8XmdvxOYBbQnEQ= X-Received: by 2002:a05:600c:8b2e:b0:488:b749:8482 with SMTP id 5b1f17b1804b1-488fb7469b3mr48204095e9.4.1776433808271; Fri, 17 Apr 2026 06:50:08 -0700 (PDT) X-Received: by 2002:a05:600c:8b2e:b0:488:b749:8482 with SMTP id 5b1f17b1804b1-488fb7469b3mr48203575e9.4.1776433807780; Fri, 17 Apr 2026 06:50:07 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e46898sm4685865f8f.27.2026.04.17.06.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2026 06:50:07 -0700 (PDT) From: Andrew Burgess To: Simon Marchi , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH 09/11] gdb: change objfile::map_symtabs_matching_filename to find_symtab_matching_filename In-Reply-To: <20260416202408.422441-10-simon.marchi@efficios.com> References: <20260416202408.422441-1-simon.marchi@efficios.com> <20260416202408.422441-10-simon.marchi@efficios.com> Date: Fri, 17 Apr 2026 14:50:06 +0100 Message-ID: <87a4v1elwx.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 28OnrVWT7imdcnCggxezdU6usTZL4UQ4tDa5CVzu-40_1776433809 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Simon Marchi writes: > The only user of objfile::map_symtabs_matching_filename uses that method > to find the first matching symtab. It would therefore be more natural > for that method to be a "find" method, returning the first symtab > matching the predicate. > > Change map_symtabs_matching_filename to be > find_symtab_in_compunit_symtab, and the internal > iterate_over_one_compunit_symtab to be find_symtab_in_compunit_symtab. Typo: Change map_symtabs_matching_filename to be find_symtab_in_compunit_symtab, and ..." Should be: Change map_symtabs_matching_filename to be find_symtab_matching_filename, and ..." > > This makes function find_symtab simpler. > > Change-Id: Id14a95498fad243495d6eab18810d0c4ab8dbf90 > --- > gdb/objfiles.h | 16 +++----- > gdb/symfile-debug.c | 89 +++++++++++++++++++++------------------------ > gdb/symtab.c | 20 ++-------- > 3 files changed, 52 insertions(+), 73 deletions(-) > > diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c > index 8e4892649508..d90f400f379c 100644 > --- a/gdb/symfile-debug.c > +++ b/gdb/symfile-debug.c > @@ -159,29 +159,30 @@ objfile::forget_cached_source_info () > iter->forget_cached_source_info (this); > } > > -/* Check for a symtab of a specific name by searching some symtabs. > +/* Find the first symtab of CUST matching BASE_NAME, NAME and REAL_PATH, for > + which CALLBACK returns true. > > If NAME is not absolute, then REAL_PATH is NULL > If NAME is absolute, then REAL_PATH is the gdb_realpath form of NAME. > > The return value, NAME, REAL_PATH and CALLBACK are identical to the > - `map_symtabs_matching_filename' method of quick_symbol_functions. > + `find_symtab_matching_filename' method of quick_symbol_functions. This comment doesn't make sense. The find_symtab_matching_filename function is a member function of `objfile` not `quick_symbol_functions`. You didn't write that, but it looks like a pre-existing mistake in the comment. Can you fix that please? Maybe: The return value, NAME, REAL_PATH and CALLBACK are identical to the `objfile::find_symtab_matching_filename' method. Would do? > @@ -254,6 +258,7 @@ objfile::map_symtabs_matching_filename > return false; > }; > > + symtab *result = nullptr; > auto compunit_callback = [&] (compunit_symtab *symtab) > { > /* Skip included compunits, as they are searched by The next line of this comment references iterate_over_one_compunit_symtab, and should be updated to find_symtab_in_compunit_symtab. > diff --git a/gdb/symtab.c b/gdb/symtab.c > index 6a5c8c7058e4..fd841318387e 100644 > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -637,8 +637,6 @@ static symtab * > find_symtab (program_space *pspace, const char *name, > find_symtab_callback_ftype callback) > { > - struct symtab *result = NULL; > - Ahh, I should have looked ahead! I complained about this in the last patch, but I see it's now gone. No need to change the last patch I guess. > gdb::unique_xmalloc_ptr real_path; > > /* Here we are interested in canonicalizing an absolute path, not Approved-By: Andrew Burgess thanks, Andrew