From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id PdueGAJM4mkl/R4AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 11:04:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776438274; bh=JcZ62Ih769d7fi6rzy1zQe5bGIAoItKxoiYTp0dObPQ=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=R51iutJvjrOtZFEvIGvs4NBliLls1eDOtxmZ3Fj231qnSskgGfGpIzRF7YpGBNNMl FeOEb6z+z6s4jAueciTOXGp77w8NMi9PSvFh2X5GUxhtqbStzZKhm1ZHiwE6go/aKn Z7Yh8/K/gctlRy3XVHSMAEJqCDAaMpCZvIqrDA3E= Received: by simark.ca (Postfix, from userid 112) id 51BE31E093; Fri, 17 Apr 2026 11:04:34 -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 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=WPmO4U/R; dkim-atps=neutral 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 887821E093 for ; Fri, 17 Apr 2026 11:04:33 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 24BE44CCCA0E for ; Fri, 17 Apr 2026 15:04:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24BE44CCCA0E Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=WPmO4U/R Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id F29574BA2E3B for ; Fri, 17 Apr 2026 14:54:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F29574BA2E3B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F29574BA2E3B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776437660; cv=none; b=RCi/2IOTMvZGaSqG/L7FwtHth+dLUX7T7GkGl64Jbb9pQn7YJDav9MNjSzBGWDzszNqYkc3SxAFdNMz4qcl0WaENZYCtFldLZFKDtKnO0CBaaTMdQaXdxPnOFQVTSKJTpr0UsVqhYi0OBerJUJ1F9BAGXppdXN6v8wqSbbFJYUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776437660; c=relaxed/simple; bh=JcZ62Ih769d7fi6rzy1zQe5bGIAoItKxoiYTp0dObPQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=eRZsofz8qvKAC+uKwKsJJtNxrJkWhIaiViJdqC9aIw41hB6vR7Pzdw8jd9+xkJh5S8BiX5Z9IXcNXPVIvhFD+/Q3SrLiZ7vrZXd4ZJio9I1WyFHVdCQIwDnTbdHJvUXIPlJUbL0XDeo3kvxK5H2cMZcAW2BbnhoNwrokTgELKU8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F29574BA2E3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776437657; bh=JcZ62Ih769d7fi6rzy1zQe5bGIAoItKxoiYTp0dObPQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=WPmO4U/RcWAfHQkYrcAzv3TJmltRsq874mGwlZcR1GbEQWiJJGzaD/MIzUiJOh9to +udn2h8eiQpqchwGacxOsdtknXXDZYVbum5WbvJzOnFTiYyOQt3DwzlRI7zWtH8FD9 rIt6VhFU1DskCG90CRR5v87YWEDf29qm7c6R0YrA= Received: by simark.ca (Postfix) id 821D11E093; Fri, 17 Apr 2026 10:54:16 -0400 (EDT) Message-ID: Date: Fri, 17 Apr 2026 10:54:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 08/11] gdb: split iterate_over_symtabs in for_each_symtab and find_symtab To: Andrew Burgess , Simon Marchi , gdb-patches@sourceware.org References: <20260416202408.422441-1-simon.marchi@efficios.com> <20260416202408.422441-9-simon.marchi@efficios.com> <87eckdemrj.fsf@redhat.com> Content-Language: fr From: Simon Marchi In-Reply-To: <87eckdemrj.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 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 4/17/26 9:31 AM, Andrew Burgess wrote: > 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. Done. >> +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. Fixed. > Otherwise: > > Approved-By: Andrew Burgess Thanks, Simon