From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2oMJKWc34mnAsR4AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 09:36:39 -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=Dn6+aWkG; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9343B1E0C3; Fri, 17 Apr 2026 09:36:39 -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 D4B661E0B1 for ; Fri, 17 Apr 2026 09:36:38 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 464014CCCA15 for ; Fri, 17 Apr 2026 13:36:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 464014CCCA15 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=Dn6+aWkG 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 AD2174C900E9 for ; Fri, 17 Apr 2026 13:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD2174C900E9 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 AD2174C900E9 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=1776432711; cv=none; b=fbpnpy7h7RJ0hPdLGEm0Fsn84qnSwa1fG52AHTY6x5aIKwb7NgVX9rupv8rP5ArMEh7FPh676aPtMOCJEFRPDL/UkHH2/75BNBFBvWZTJF4G37FV4V6pCgkN99cJhKU1b20yl6Bl7p7zJPkqCPDwWnTaa+drF7A8m2pxUaUZVhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776432711; c=relaxed/simple; bh=ki7xl9odiKBQs/YdQOQPx9oBWAmYWhWNHBxBTV9M1aw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OwAwSL4/IUaK1jwZtGnXL6myBOaULcXHz4rL4gfWjf5gGB2+WleWM/U6AjxAKuM3bk3HgcYI+k+c6kukb3VWLVk5wmTygGog86l/pvwD+gJLP/cxwrgFHPh0wIrK4fjsnpwIN8VzGu2MIveOLYipLnx+jq+13P4OTWXSoQ0C9VE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD2174C900E9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776432711; 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=1bTyV1GPCW1y1WXokyIFYp1fZ/2oBcw03b7pwX6s6Xw=; b=Dn6+aWkG7IwBGXlUSn8aF5tPbKumobUpFUJFZrOnI86ffv71WfqlU95938NIJKXql25n3V 2miachnLG8IIS95mKLXxO4MXXTb3YXFmhYJ/9uA8+EjpOGfOyfj8q1DnYPKLxqpcycyoZw hPSIr40xp+SizB5ONjoVblNz6E2jFFs= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-133-ERP3dNNRPdKv8ZPLUyJz_w-1; Fri, 17 Apr 2026 09:31:49 -0400 X-MC-Unique: ERP3dNNRPdKv8ZPLUyJz_w-1 X-Mimecast-MFC-AGG-ID: ERP3dNNRPdKv8ZPLUyJz_w_1776432707 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-43d76eeb303so714470f8f.3 for ; Fri, 17 Apr 2026 06:31:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776432706; x=1777037506; 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=1bTyV1GPCW1y1WXokyIFYp1fZ/2oBcw03b7pwX6s6Xw=; b=ZArP7XYm3qtR8tpN1lNS5krK8q7UQGkGUjQ1mBFr1ipRKPfpFtlUNGZN+tXaCLLJWz GZ4TUbucMOYh4Nwx9xXDTJyCp5U8TINJxMH/KF+QRhGHJ+O9Y+ePRezAYKzpakTbenyL 2ZKpt6A0fSWcdQ9FQ6yaNsig0+57BU2cCwSejBFydzXwHZRsnkOb1KDOhc0qeZEUULlB hWuYHBoYSEUXhbRFE283xABAzdehSh6NJQqwH1x2jTC1SErAem+5hi0byJeb2vuzugcK JYAPQjLsHfR9i3vdPAfPd4xAlNgs//rzFdj75IiFvDv0MMLtLD5jtDcEhOUhRop/KE32 0G7A== X-Forwarded-Encrypted: i=1; AFNElJ9L4so979Z86rxzXJL1SUF+ACYcCdXGGgz5xT+4yb0VnqEeHlj7Dz96SFm15PP0xerIzdgfav7+yynubA==@sourceware.org X-Gm-Message-State: AOJu0Yzorv26rHFZrX/FYXYqfb8wnReQpiJJz2xmYxY9MDaMcDzYhKgK usI4uW0ZQ312oXdaJ1w2V/MH9YLwTKtQI3mQGn+OEne7hb9DGy7X5U0TmSRe7YJb3TMk+7p4O24 tR4j+F6DlP0HR9ZBC9S9yrFaZc7gm2Kvlyna3AGKpdRknEBlDWk54at4GiPeGVspF1WpXoMs= X-Gm-Gg: AeBDievoHvw2TbZgU6H+ufWi5IW7QuqKbiYf75/si07XSpqqQVdVwWPAc/efSvwK6++ WagqfioggsDrQuW3yXN3lqWQc5ODezIIf0vCGiXrUPlvSJcSa3QC+W+tUZkRtvnRXYYScxYKAPD 0gKo0fWG/F8XYiHQJQAJ4e2WbdCW45TjDpYeXEC9nGS32zIraA0O869t0pwb/40jceYpw94Hdlh oaWjoJGE66R6DVercs5vLJkAX6mICtDnM3lTAMRrYYucT7Clymcm/4V4y107RwiBwOCV/3vpbtn HTCxB3xPbQ2bHwSxMzh/0P6F/62ifWgSQb3VlPtyXEDNL+PpNqIWL20X2EakN1jI/9m75JGpHHw 5WLJGn+YywKjjX0NRAk0i9NIQJBk= X-Received: by 2002:a05:600c:5246:b0:488:a639:b787 with SMTP id 5b1f17b1804b1-488fb74fc0dmr44632445e9.11.1776432706277; Fri, 17 Apr 2026 06:31:46 -0700 (PDT) X-Received: by 2002:a05:600c:5246:b0:488:a639:b787 with SMTP id 5b1f17b1804b1-488fb74fc0dmr44631935e9.11.1776432705783; Fri, 17 Apr 2026 06:31:45 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc16f93dsm63247385e9.3.2026.04.17.06.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2026 06:31:45 -0700 (PDT) From: Andrew Burgess To: Simon Marchi , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH 08/11] gdb: split iterate_over_symtabs in for_each_symtab and find_symtab In-Reply-To: <20260416202408.422441-9-simon.marchi@efficios.com> References: <20260416202408.422441-1-simon.marchi@efficios.com> <20260416202408.422441-9-simon.marchi@efficios.com> Date: Fri, 17 Apr 2026 14:31:44 +0100 Message-ID: <87eckdemrj.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: NYuE0hwuMFLNCSBTwQ_p8Kuh96W5pVonSDzrHH4LnnA_1776432707 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: > Same rationale as the previous patches. > > For the moment, find_symtab is only needed internally in symtab.c, so > keep it static there. Note that the interaction with > objfile.map_symtabs_matching_filename gets cleaner in a subsequent > patch. > > for_each_symtab is implemented using find_symtab, because the iteration > behavior is not completely trivial. > > find_symtab_callback_ftype is in the header file, because it is used > from another source file in the next patch. > > Change-Id: I6ab8342151eb735327fc2e7935e7a65cede5e1dd > --- > gdb/linespec.c | 5 ++--- > gdb/symtab.c | 55 ++++++++++++++++++++++++++++++++++---------------- > gdb/symtab.h | 19 +++++++++-------- > 3 files changed, 51 insertions(+), 28 deletions(-) > > diff --git a/gdb/symtab.c b/gdb/symtab.c > index 5a39081dfc54..6a5c8c7058e4 100644 > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -629,12 +629,16 @@ compare_filenames_for_search (const char *filename, const char *search_name) > && STRIP_DRIVE_SPEC (filename) == &filename[len - search_len])); > } > > -/* See symtab.h. */ > +/* Return the first symtab in PSPACE matching NAME. > > -void > -iterate_over_symtabs (program_space *pspace, const char *name, > - gdb::function_view callback) > + See documentation for for_each_symtab for how exactly NAME is matched. */ > + The comment here fails to mention CALLBACK as you have for your other find_* functions, something like: Return the first symtab in PSPACE matching NAME and for which CALLBACK returns true. Or similar. > +static symtab * > +find_symtab (program_space *pspace, const char *name, > + find_symtab_callback_ftype callback) > { > + struct symtab *result = NULL; I know this is copy & paste, but could you NULL -> nullptr please. Otherwise: Approved-By: Andrew Burgess Thanks, Andrew