From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mdiLBeB4qWrG/A4AWB0awg (envelope-from ) for ; Tue, 15 Sep 2026 12:57:04 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=cPtiUtK9; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F25D71E06B; Tue, 15 Sep 2026 12:57:03 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 227521E01F for ; Tue, 15 Sep 2026 12:57:03 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77DD64BA903A for ; Tue, 15 Sep 2026 16:57:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77DD64BA903A Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=cPtiUtK9 Received: from mail-oo2-x0d.google.com (mail-oo2-x0d.google.com [IPv6:2607:f8b0:4864:31::d]) by sourceware.org (Postfix) with ESMTPS id 8D7454BA7986 for ; Tue, 15 Sep 2026 16:56:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D7454BA7986 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8D7454BA7986 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:31::d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789491397; cv=none; b=lFYHXk3CAHkueW1sfdvUA3UGId0e0/RRYz4Aw6+pmZdYq7SFIQHiBruYQtKRTePslIjcDlBok6dlDxQeyNPUDCKIGePjXg0x6gm//ZN8f+c6bM3r2Y4wncnjJ1gqQhQJv0VdQwbIKUUMLepLPdUGaMTBFy7qEHML5qlLmHYobo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789491397; c=relaxed/simple; bh=FEjflItP0GA6ebfAxaX6Uts5dyfj8ZEMirxTgRPXkqA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ekODMOcQ5SpL3m1+9BR2yZeiVnTA7KqeHTcC8cpzb+EnwQZ2F44cDk/zKg+80Cdcr89+Oc4U6xXOEZrh/WHzdruyJLgh1HdvSKBYZWh/COQS2JRKDXiGLvQGuf5mMX80OgvAOYOLRC7f6Lg67+oRDjNgus1LkJtrrjhmz1+vkMQ= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=cPtiUtK9 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D7454BA7986 Received: by mail-oo2-x0d.google.com with SMTP id 46e09a7af769-8055dcba0a5so775889a34.1 for ; Tue, 15 Sep 2026 09:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1789491397; x=1790096197; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=jDC+gjMFN6pGkRo7bvobCmUQGft6UcWwQF3ZivVtxVA=; b=cPtiUtK99GsRfoYQHVtC82b3OS8TN60L3DyEbangmidjSnKRG7fnkpSI9Gzour5HdA T1meHXS/5eVZsmD10W9vKub2J5eonaiiTr36Oz8LvMm5lqBsw3boB9EFwJmrH7Is/fGN iK/daSromKhOFzpDXsrkxOad5S6Qr4dAvA5K1h8YKPU12DgJpKPwtWU4ybEMdo17Bzpj seD68OQc2nikzajkoPZxebgx7e7SS/HYsN4SgTsR5PqnB2PQsJKDevb0IxhziESq7dzP wAfLqXSUAkSj16bb73SmQtljxSoAWhEpeVJUNwHn/bm9KIY6HwjmXKf83uEN1WkmQReT zdbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789491397; x=1790096197; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jDC+gjMFN6pGkRo7bvobCmUQGft6UcWwQF3ZivVtxVA=; b=kpvLWOdEB9zUNazYn+eN30bLTLG0S8tF5AxZTz3Gmhr+0bkcXLRMubWGIDkN1Db/5D S+YODGRjuy90oXFU12sdb/JiDsJWCIoTxVrO+EbeVE7bncPLeFKPcn90MUkFA3qMkn2o inJuqz1zbvWgnz432yuJjudxZ9SIXx6/UR0Rxap9X0+dmXOhECLYMQUC30U84NZSa2fR Fxq2hgWD8hMROUkhCuBH5yk+qXKN3xoND4BFiLcmwsUhMQwv1I6Ke9YTTOiBahHicyJD FebExGIRSueKBzP52AKD78Q1rtOmlTn835x1+HwhpH0H+4lk6/i4W1kmGRQR+DKA1qp2 QTbQ== X-Gm-Message-State: AFuF++mxqSXJ73QwdIUFLZ49ruB2KNTdrM03zSEdjnE89N2b2QzTh7Fy 3Bkxhc5bbA4e93gw2LUlPJrwsqdE7vofvbOxmdKxFh81auN2ZmZcxMBSMFWIeesRhL8x6dnfbQd Pvu6Qfg== X-Gm-Gg: AYBFou23nEZXcsSyHsQE/Vb+FaAk/qsUIHGKs/6YfA2LznSlvLdTPK400K4sib2/3h5 fzN9lc0pVvGgfhc0H/Tt4JRsKO65RP8hekvvkJWz45ujWm/Tg9EFQKWQjIb1YG0fzqOfxesQFuT qHrubbCottSiGDYVVLWxXI6eGIwlukLPMON+kvMB0IT6Yy3F+uC3yUUPLlS3xasv8kKHy31oo3i OktJOu934nYGFSBsB3qygwoeqMnplND+CH7lRFTr0BUPU9VJoWNO2OvAUYxL07+SXoSWHZZdi/B wR3MY3zEn/gs5Dj/flTjcs6SygG4yVsP/zHQZsSJnqfLI8TSVriKM9kvfaih9tgop15kPtW75A2 n1iPsSOeUsQOo1C6E5gBhLFOeq7CzNTev/4RrqoDGbPLhL3wTARBd6qR2rd8qstDaSKQ7MQvfo5 ChmsJNaTRFuaKByE2clb18zlffTggnUdrPm4GNUhVx7UZSVjTodTUp2VJ5VpfnH94jGSD8gDYAc 7lJikfdt3WpSk3HScTiqYZxKrYrtQ== X-Received: by 2002:a05:6830:6f42:b0:7f9:555:1df1 with SMTP id 46e09a7af769-80982bf0366mr2980605a34.13.1789491396812; Tue, 15 Sep 2026 09:56:36 -0700 (PDT) Received: from bapiya (75-166-229-74.hlrn.qwest.net. [75.166.229.74]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-803f5ffd82bsm14766711a34.11.2026.09.15.09.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:56:36 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove iterate_over_block_arg_vars_printing Date: Tue, 15 Sep 2026 10:56:34 -0600 Message-ID: <20260915165634.3008224-1-tromey@adacore.com> X-Mailer: git-send-email 2.55.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 Back in commit c76bd1b0 ("Remove symbol lookup of arguments"), I removed some old stabs code that performed a double lookup of argument symbols. I was surprised today to find that this double-lookup re-entered the tree in commit 2465b9e4 ("gdb: add annotation in 'info locals' command for variables shadowing case"). That patch added copies of a couple of block iteration functions. The function in question, iterate_over_block_arg_vars_printing, is not really needed. This patch removes it, removing the old stabs code as a consequence. Regression tested on x86-64 Fedora 43. --- gdb/stack.c | 37 +++++-------------------------------- gdb/stack.h | 7 ------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/gdb/stack.c b/gdb/stack.c index 003811e9c08..c380cf4f7d0 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2453,37 +2453,6 @@ iterate_over_block_arg_vars (const struct block *b, } } -/* See stack.h. */ - -void -iterate_over_block_arg_vars_printing - (const struct block *b, - iterate_over_block_arg_local_vars_cb_printing cb) -{ - for (struct symbol *sym : block_iterator_range (b)) - { - /* Don't worry about things which aren't arguments. */ - if (sym->is_argument ()) - { - /* We have to look up the symbol because arguments can have - two entries (one a parameter, one a local) and the one we - want is the local, which lookup_symbol will find for us. - This includes gcc1 (not gcc2) on the sparc when passing a - small structure and gcc2 when the argument type is float - and it is passed as a double and converted to float by - the prologue (in the latter case the type of the LOC_ARG - symbol is double and the type of the LOC_LOCAL symbol is - float). There are also LOC_ARG/LOC_REGISTER pairs which - are not combined in symbol-reading. */ - - struct symbol *sym2 - = lookup_symbol_search_name (sym->search_name (), - b, SEARCH_VAR_DOMAIN).symbol; - cb (sym->print_name (), sym2, var_shadowing::NONE); - } - } -} - /* Print all argument variables of the function of FRAME. Print them with values to STREAM. If REGEXP is not NULL, only print argument variables whose name @@ -2526,7 +2495,11 @@ print_frame_arg_vars (const frame_info_ptr &frame, cb_data.stream = stream; cb_data.values_printed = 0; - iterate_over_block_arg_vars_printing (func->value_block (), cb_data); + iterate_over_block_arg_vars (func->value_block (), + [&] (const char *print_name, symbol *sym) + { + cb_data (print_name, sym, var_shadowing::NONE); + }); if (!cb_data.values_printed && !quiet) { diff --git a/gdb/stack.h b/gdb/stack.h index 4f7c223f47f..819f5993004 100644 --- a/gdb/stack.h +++ b/gdb/stack.h @@ -39,13 +39,6 @@ void iterate_over_block_arg_vars (const struct block *block, void iterate_over_block_local_vars (const struct block *block, iterate_over_block_arg_local_vars_cb cb); -/* Iterate over all the argument variables in block B, call CB for - each variable with its print name, symbol, and shadowing status. */ - -void iterate_over_block_arg_vars_printing - (const struct block *block, - iterate_over_block_arg_local_vars_cb_printing cb); - /* Iterate over all the local variables in block B, including all its superblocks, stopping when the top-level block is reached. Call CB for each variable with its print name, symbol, and shadowing status base-commit: 71400155a3c026269f2602fa168a15b739ae8e39 -- 2.55.0