From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id CECD4385697D for ; Sun, 5 Nov 2023 18:11:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CECD4385697D 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 CECD4385697D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207899; cv=none; b=q5nfvp6rZUIMez9E/F2pP/SIHUKSwoRbVdY6+7WW+wDay2UN9/yll2FwApBK2WpGvi0HTdVZpzqJIOPDm/bIVNnXw8IzDmEO8TzyJqR/8kTo2KRGv7krM/HZj7qL3ArZuPltx+n/y1Cach7pnM1rVXLleDo85cIzLQ50PLmv+XU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207899; c=relaxed/simple; bh=PxLUR/Ibkf7fO5TMfKiLrDSdBtaRg/sE116IoWr/EPs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=ZEeU4vDHm8RydkGp/tLQP+SIHBB91I6a8jkkmLOyDgql+kRz0ysMmczfGQv6hI+WaB27NC/I0knMsoeXzGd6ItjLOfx2gzqb/uwFSpm0GrZx170X9imiHel0C6SGGUUCKNKFBUrYjJCceiuDTyfup7hBGomG71DDnRUoI4hawN0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6005a.ext.cloudfilter.net ([10.0.30.201]) by cmsmtp with ESMTPS id zaYfquRnjKOkLzhaxqKH5g; Sun, 05 Nov 2023 18:11:35 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhawqTFZ6wuSEzhaxqZDs6; Sun, 05 Nov 2023 18:11:35 +0000 X-Authority-Analysis: v=2.4 cv=evvMc6lX c=1 sm=1 tr=0 ts=6547dad7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=BRfREQrth9rV_OVTpJIA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=Tg9cGCaFTKJkzZaYirVe369ZnhQHYvodMfVUgMxOJvM=; b=GJMeXYkERTydAu+r5UBvqoqD8y 4hpoHQFOfofuu+rI5HNeWAld8NIszt/GRFLRMCXhLe6NPfFGaqakrIrj5zyVWTKRuAaH8KWRarG+E SvJfNpYbYxiUu40I4NND2z5vS; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qzhaw-003Y66-1m for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:34 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:04 -0700 Subject: [PATCH v2 26/31] Change print_variable_and_value to take a block_symbol MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-26-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 97.122.77.73 X-Source-L: No X-Exim-ID: 1qzhaw-003Y66-1m X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:51014 X-Source-Auth: tom+tromey.com X-Email-Count: 27 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEOKYnD6Gba4nJFtWdeJKXUfJIgObBPFRapHRaySQ9hhyPd6z/Z6ZUv+CnWurTCiQNsKbzo2JSvR1jCHqHYbJLAe9pVdEmT1vYmiTzVOD0so679xlmy1 OVf6yEctWjhE1RN1jh9jRv1NVwHPIWKiljytzy6U/ORQJDhEs30Li+vOGSxEtJNsu0AO4p4LzUBM5TLywyek0OrRhXI0VdhxYkI= X-Spam-Status: No, score=-3024.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This changes print_variable_and_value to accept a block_symbol and to use the new read_var_value overload. --- gdb/printcmd.c | 9 +++------ gdb/stack.c | 6 +++++- gdb/value.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 57a7af67ffe..afbc4f0eb55 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2395,10 +2395,11 @@ clear_dangling_display_expressions (struct objfile *objfile) before printing the variable name. */ void -print_variable_and_value (const char *name, struct symbol *var, +print_variable_and_value (const char *name, block_symbol bvar, frame_info_ptr frame, struct ui_file *stream, int indent) { + symbol *var = bvar.symbol; if (!name) name = var->print_name (); @@ -2411,11 +2412,7 @@ print_variable_and_value (const char *name, struct symbol *var, struct value *val; struct value_print_options opts; - /* READ_VAR_VALUE needs a block in order to deal with non-local - references (i.e. to handle nested functions). In this context, we - print variables that are local to this frame, so we can avoid passing - a block to it. */ - val = read_var_value (var, NULL, frame); + val = read_var_value (bvar, frame); get_user_print_options (&opts); opts.deref_ref = true; common_val_print_checked (val, stream, indent, &opts, current_language); diff --git a/gdb/stack.c b/gdb/stack.c index 8d72949006c..27a932cfcaa 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2268,6 +2268,7 @@ struct print_variable_and_value_data int num_tabs; struct ui_file *stream; int values_printed; + const struct block *block; void operator() (const char *print_name, struct symbol *sym); }; @@ -2296,7 +2297,8 @@ print_variable_and_value_data::operator() (const char *print_name, return; } - print_variable_and_value (print_name, sym, frame, stream, num_tabs); + print_variable_and_value (print_name, { sym, block }, frame, + stream, num_tabs); /* print_variable_and_value invalidates FRAME. */ frame = NULL; @@ -2361,6 +2363,7 @@ print_frame_local_vars (frame_info_ptr frame, cb_data.num_tabs = 4 * num_tabs; cb_data.stream = stream; cb_data.values_printed = 0; + cb_data.block = block; /* Temporarily change the selected frame to the given FRAME. This allows routines that rely on the selected frame instead @@ -2525,6 +2528,7 @@ print_frame_arg_vars (frame_info_ptr frame, cb_data.num_tabs = 0; cb_data.stream = stream; cb_data.values_printed = 0; + cb_data.block = func->value_block (); iterate_over_block_arg_vars (func->value_block (), cb_data); diff --git a/gdb/value.h b/gdb/value.h index 7cb830110fc..81c53536416 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1534,7 +1534,7 @@ extern int val_print_string (struct type *elttype, const char *encoding, const struct value_print_options *options); extern void print_variable_and_value (const char *name, - struct symbol *var, + block_symbol var, frame_info_ptr frame, struct ui_file *stream, int indent); -- 2.41.0