From patchwork Sun Oct 29 23:23:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78720 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A548B3831E17 for ; Sun, 29 Oct 2023 23:25:13 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id A6A793861939 for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6A793861939 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 A6A793861939 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621796; cv=none; b=Y7Dfa2uOYU27rmd9zfZMsov0AICgj2IXic5YZJEnkZerHW+Rn6QWf1VpXJlg5W3UJNJgXPdRkn228DlUu9zNXU/Imyby+im7+mCnlyWIWFIVlkUernrquSF8RBZcBOlyCKS7XyJL+rzvgJosHTOAM//rSb+T4gmUoFm6hjEPL24= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621796; c=relaxed/simple; bh=fgRlSGMoFif+Dy6EvRNrC//EBEBX1Hz/UGvEgw2+PVs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=tPRQriguIm8rUoHdx5WpWjbSVjuJM5YmGQpe7ysP3d/aB5dqz+TbGFiXvamdS5YezAtHjjQ9mxWnVZBp/uaKfnKkY+35/meUBTzlhUm/Bs/3WDvdIUwhH3Iu/BGpEIVSPpSJPbKldjD79qNzvOGaSVcWEHr9447ci/mUq2bETTI= 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 wroiqbpIAjtZ3xF7fqTyKW; Sun, 29 Oct 2023 23:23:11 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dqTxzQwuSExF7dqv3PT; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=evvMc6lX c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA: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=fHu9pL51716CVDQb9t5nMeB96JbkBwhUbrMV2e7wxA0=; b=etDA2+Ylkor4EcpTGLm3PvOhGZ Uw9hVb0Ub4cM/YsCrP6MCS5IBLyhPu1q/NItjgI7xKyPifN4bGdhLzkcy96RG6JspHP7EVQIHm3S6 FoVIHwL70p+KySw5M3VautgwT; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 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 1qxF7d-0042zY-14 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:46 -0600 Subject: [PATCH 25/30] Change print_variable_and_value to take a block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-25-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@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: 1qxF7d-0042zY-14 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]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 26 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDXHShLiGJFiyLxnrDvmlZeozWHZINvW9MJ98VJyzMO6S1Vtr2/pnLG5AH7OT0/GIk0Qx3KyB6yS+ni0Ajns2075uoeIeuPKIzYxqocIi5EuRrZAMpip L/2gqucwHpwc+mE4Nam0yCalsLEDSp0AcYoh2x3CtmyUjngV7hWiFIQ4E5Icm1IC1s6bLaRPZC97xIguzSq+/kCXXqjHlqqM2lc= X-Spam-Status: No, score=-3024.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+patchwork=sourceware.org@sourceware.org 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 cb7023b1880..886361dff89 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2398,10 +2398,11 @@ clear_dangling_display_expressions (struct objfile *objfile) This function invalidates FRAME. */ 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 (); @@ -2414,11 +2415,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 0bf2b19fad7..6916df77929 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; @@ -2363,6 +2365,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 @@ -2529,6 +2532,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);