From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id JVSuH4NF4Wlo4xwAWB0awg (envelope-from ) for ; Thu, 16 Apr 2026 16:24:35 -0400 Received: by simark.ca (Postfix, from userid 112) id 428121E0C3; Thu, 16 Apr 2026 16:24:35 -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.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 08A001E04F for ; Thu, 16 Apr 2026 16:24:34 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 62AA34AA51CC for ; Thu, 16 Apr 2026 20:24:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62AA34AA51CC Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 59F2C4BA903C for ; Thu, 16 Apr 2026 20:24:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 59F2C4BA903C Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 59F2C4BA903C 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=1776371050; cv=none; b=Y8HDcTzsk+TTeQC7N2rY7T7wG895pVE78Lqb0vXNJVFk56Jl8IWQ4A8Hwdb7jf+CnjETChFu4x7JYcb9PCUcFQeEi4+rxqRaG/06vzqSAbAem8KJSjxjkDTmmGdQrgDSrEvCNvBxieeCoMyKuTf4+wsP5GItTGhbyZUZqptnkEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776371050; c=relaxed/simple; bh=HLqErqSckV8IY9dDdKx9wqDuPFQYM14Q+lYsNipQuwQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=pQLihc8kABRYhXvR/JmQKh8sCEfBjsFO4ampVaaRf9BImw6Ke8B0DN/iRUypu7a0ApH97Vya0WmUG2gllixHHXeQ3dWSRqCN87VBGfS817HSGNU+WODf7k2h2v/yVDOxrv8dgh3MHiSsGXYeyZ7dp3eFWpCkDP+43SUzAcr0u1M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59F2C4BA903C Received: by simark.ca (Postfix) id 6D2061E04F; Thu, 16 Apr 2026 16:24:09 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 00/11] Readability improvements of some iteration functions Date: Thu, 16 Apr 2026 16:16:10 -0400 Message-ID: <20260416202408.422441-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 This series contains a few readability improvements that I came up with as I was reading the DWARF index and symbol lookup code. The first significant change is the introduction of the `iteration_status` enum, since I was confused with the meaning of true/false to mean "stop" vs "keep iterating", for some iteration functions that use a callback. I think that an enum will make that clearer. This enum is used for method quick_symbol_functions::search and everything around it. I looked at using the enum for the various "iterate_over_*" functions that have this "stop iteration early" capability, but for them I concluded that the code would be clearer if we split them in two: - A "for each" function that doesn't have the capability of stopping iteration early - A "find" function that returns the first element for which the callback returns true. For this use case, I think it's fine for the callback to return a bool. That's mostly it, there are other small changes, but the patches should be clear on their own. Simon Marchi (11): gdb/dwarf: remove unused file_match parameter from dwarf2_base_index_functions::search_one gdb: rename search_symtabs_expansion_listener -> compunit_symtab_iteration_callback gdb: introduce iteration_status enum, use it for search callbacks gdb, gdbserver: make iterate_over_lwps_ftype a function_view gdb, gdbserver: split iterate_over_lwps in for_each_lwp and find_lwp gdb: split iterate_over_threads in for_each_thread and find_thread gdb: split iterate_over_minimal_symbols in for_each_minimal_symbol and find_minimal_symbol gdb: split iterate_over_symtabs in for_each_symtab and find_symtab gdb: change objfile::map_symtabs_matching_filename to find_symtab_matching_filename gdb: make symbol_found_callback_ftype a function_view gdb: make iterate_over_symbols return void, rename to for_each_symbol gdb/ada-lang.c | 32 ++-- gdb/aix-thread.c | 2 +- gdb/arm-linux-nat.c | 38 ++-- gdb/breakpoint.c | 3 +- gdb/cp-support.c | 2 +- gdb/dwarf2/cooked-index-entry.c | 2 +- gdb/dwarf2/cooked-index-entry.h | 10 +- gdb/dwarf2/cooked-index.h | 4 +- gdb/dwarf2/index-write.c | 4 +- gdb/dwarf2/read.c | 78 ++++---- gdb/dwarf2/read.h | 26 +-- gdb/expanded-symbol.c | 16 +- gdb/expanded-symbol.h | 15 +- gdb/fbsd-tdep.c | 2 +- gdb/gdbthread.h | 21 ++- gdb/infcmd.c | 9 +- gdb/infrun.c | 4 +- gdb/language.h | 13 +- gdb/linespec.c | 80 ++++----- gdb/linux-nat.c | 277 +++++++++++++++-------------- gdb/mi/mi-main.c | 15 +- gdb/minsyms.c | 25 ++- gdb/minsyms.h | 37 +++- gdb/nat/aarch64-linux-hw-point.c | 17 +- gdb/nat/linux-nat.h | 17 +- gdb/nat/loongarch-linux-hw-point.c | 18 +- gdb/nat/x86-linux-dregs.c | 15 +- gdb/objfiles.h | 31 ++-- gdb/ppc-linux-nat.c | 22 +-- gdb/procfs.c | 6 +- gdb/python/py-symbol.c | 18 +- gdb/quick-symbol.h | 25 +-- gdb/s390-linux-nat.c | 22 +-- gdb/sol-thread.c | 4 +- gdb/symfile-debug.c | 114 ++++++------ gdb/symtab.c | 97 +++++----- gdb/symtab.h | 41 ++--- gdb/thread.c | 27 ++- gdbserver/linux-low.cc | 21 +-- gdbsupport/iteration-status.h | 48 +++++ 40 files changed, 659 insertions(+), 599 deletions(-) create mode 100644 gdbsupport/iteration-status.h base-commit: cc9d69394628641235da1483788c0d938c9b6661 -- 2.53.0