From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ydoMI4xH0mnfgAgAWB0awg (envelope-from ) for ; Sun, 05 Apr 2026 07:29:16 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=BMSi1XI8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 892041E0BC; Sun, 05 Apr 2026 07:29:16 -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.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,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 DFC671E04F for ; Sun, 05 Apr 2026 07:29:15 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 5DC464BA23F9 for ; Sun, 5 Apr 2026 11:29:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DC464BA23F9 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=BMSi1XI8 Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id AF35E4BA2E1C for ; Sun, 5 Apr 2026 11:28:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF35E4BA2E1C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AF35E4BA2E1C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775388519; cv=none; b=EL1hQxLAMaF0OZ0QlLc5TogQc7iK5bukPjr/ENw4urrVaRyMVsEPNQd/N7nDzpX7Fnse3oltHcbi4MgV6eY+1QA2gfVyaznrPgo+UoK4pCLpnJ5PeVk9eb43wQeWyZ1johQI3YAzAVIV0oGYQNBbT5HWrXTrAk1EFITFrWQPLdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775388519; c=relaxed/simple; bh=UqOUOwfknsCc5wMIdhrEGBJr3NHh3OW7PPwBtYruzvs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=mkDemCMg7eTPU5AFtF3fcDmoq6W+5YhZETkMbSXoKljKVK1iPUPKD2vbDrjeqxEn0/avgiwOIhMS9yRpaxCkgABjXm7B5MKfk8I/bThq0WnqQhFYLqGz+vRwHXdxIJ1ddV7UJOzFjVJI2+QdSo9eElCHchQzwsYLlP9kBkOFCAE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF35E4BA2E1C Received: from eig-obgw-6004b.ext.cloudfilter.net ([10.0.30.210]) by cmsmtp with ESMTPS id 9868wt1tTc9KC9LehwWhwc; Sun, 05 Apr 2026 11:28:39 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 9LegwL3y4gdjv9LegwDqFa; Sun, 05 Apr 2026 11:28:38 +0000 X-Authority-Analysis: v=2.4 cv=DrxW+H/+ c=1 sm=1 tr=0 ts=69d24766 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=ItBw4LHWJt0A:10 a=W3WzSoZ2_dIdquULcY8A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=YCub5V97ZQGOsNFeFzyKd+fItG1GvEw9x6ubVLx4VjQ=; b=BMSi1XI8gJi0h1hDhra8YVdM3a 7O3OHY/1UGTXxuAIsaD4CBpANpfprwpjByHhX1m+B54OXncUDMyIpS4ssPG4lr+hzkituftQndzXM IqnXuPf8QonxZHPuTFYU6TWhB; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:42722 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9Leg-00000001QMu-1kQt; Sun, 05 Apr 2026 05:28:38 -0600 From: Tom Tromey Date: Sun, 05 Apr 2026 05:28:40 -0600 Subject: [PATCH 3/4] Add variable styling to error messages MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260405-more-error-style-v1-3-6c04da718875@tromey.com> References: <20260405-more-error-style-v1-0-6c04da718875@tromey.com> In-Reply-To: <20260405-more-error-style-v1-0-6c04da718875@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1w9Leg-00000001QMu-1kQt X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net ([192.168.122.1]) [75.166.225.82]:42722 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNKQsVs/+/qMcP7pXOXpX/tiO68bX5I5LW8Zj7RO7CVqHuZHXki8jkduOd63HzhXYxQDCMqPBGlpAN+rEeFmfR+hI7ie0kqxiNc0uHesx4ytWJNW/npU 5wYVZ/L6Q1tw/w0FCtgBQr9I71/D5FtotBDVqF8UlvNYv7PNikk+5wG1Y5gF3JrOI0YLrU7T6DDIkeX2Ti8pSLUV0wcSxMUUWZY= 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 changes some error messages in gdb to use variable_name_style. --- gdb/ada-exp.y | 4 +++- gdb/cli/cli-utils.c | 5 +++-- gdb/eval.c | 4 +++- gdb/findvar.c | 4 +++- gdb/valops.c | 6 ++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 0262ce74c85..5c5d4675eb6 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1349,7 +1349,9 @@ write_object_renaming (struct parser_state *par_state, block_symbol sym_info = ada_lookup_encoded_symbol (name, orig_left_context, SEARCH_VFT); if (sym_info.symbol == NULL) - error (_("Could not find renamed variable: %s"), ada_decode (name).c_str ()); + error (_("Could not find renamed variable: %ps"), + styled_string (variable_name_style.style (), + ada_decode (name).c_str ())); else if (sym_info.symbol->loc_class () == LOC_TYPEDEF) /* We have a renaming of an old-style renaming symbol. Don't trust the block information. */ diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c index 18f112c1aad..856768f38f4 100644 --- a/gdb/cli/cli-utils.c +++ b/gdb/cli/cli-utils.c @@ -52,8 +52,9 @@ get_ulongest (const char **pp, int trailer) std::string varname (start, p - start); if (!get_internalvar_integer (lookup_internalvar (varname.c_str ()), &retval)) - error (_("Convenience variable $%s does not have integer value."), - varname.c_str ()); + error (_("Convenience variable %p[$%s%p] does not have integer value."), + variable_name_style.style ().ptr (), + varname.c_str (), nullptr); } } else diff --git a/gdb/eval.c b/gdb/eval.c index 7beff554ed4..1ea7b4d17b4 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -41,6 +41,7 @@ #include "expop.h" #include "c-exp.h" #include "inferior.h" +#include "cli/cli-style.h" /* Parse the string EXP as a C expression, evaluate it, @@ -1119,7 +1120,8 @@ eval_op_func_static_var (struct type *expect_type, struct expression *exp, struct block_symbol sym = lookup_symbol (var, blk, SEARCH_VAR_DOMAIN, nullptr); if (sym.symbol == NULL) - error (_("No symbol \"%s\" in specified context."), var); + error (_("No symbol \"%ps\" in specified context."), + styled_string (variable_name_style.style (), var)); return evaluate_var_value (noside, sym.block, sym.symbol); } diff --git a/gdb/findvar.c b/gdb/findvar.c index 99b0d31d9d4..98351143e79 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -32,6 +32,7 @@ #include "block.h" #include "objfiles.h" #include "language.h" +#include "cli/cli-style.h" /* Basic byte-swapping routines. All 'extract' functions return a host-format integer from a target-format integer at ADDR which is @@ -299,7 +300,8 @@ language_defn::read_var_value (struct symbol *var, if (sym_need == SYMBOL_NEEDS_FRAME) gdb_assert (frame != NULL); else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers ()) - error (_("Cannot read `%s' without registers"), var->print_name ()); + error (_("Cannot read `%ps' without registers"), + styled_string (variable_name_style.style (), var->print_name ())); if (frame != NULL) frame = get_hosting_frame (var, var_block, frame); diff --git a/gdb/valops.c b/gdb/valops.c index a5f16dc88f0..207f7d878ef 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -40,6 +40,7 @@ #include "extension.h" #include "gdbsupport/byte-vector.h" #include "typeprint.h" +#include "cli/cli-style.h" /* Local functions. */ @@ -3985,8 +3986,9 @@ value_of_this (const struct language_defn *lang) sym = lookup_language_this (lang, b); if (sym.symbol == NULL) - error (_("current stack frame does not contain a variable named `%s'"), - lang->name_of_this ()); + error (_("current stack frame does not contain a variable named `%ps'"), + styled_string (variable_name_style.style (), + lang->name_of_this ())); return read_var_value (sym.symbol, sym.block, frame); } -- 2.49.0