From patchwork Sun Oct 29 23:23:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78717 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 996BF3831E1D for ; Sun, 29 Oct 2023 23:25:02 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 9B82E3861936 for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B82E3861936 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 9B82E3861936 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; cv=none; b=i7AtN6+5IQheIy2VkekcvKtM7f1u87gUAYASza4/r6/J4/nhy2m7IfoB0XLb/GgJivp314cRY1WBdGE3EFWtwSqA6sb9x/QX478tTpnRcGbDFxmvOUU3+2JL8ZBaR4wxLw8jUb4uE3jntSEcV97luGNHEgn/sQPLcH6IpQFl0eE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; c=relaxed/simple; bh=FhklEKR4gi35PvUI+dq2r6E2JEyaRQKCmanPh4iWXDc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=KsN/SIFKAvlMBR6U+xetBCSDhrQgXjky1n4jPPKBBIL7/qr17dIhxB2xyPuT4ooXb9B9bYbUqPM2drDkRjY9CBym3P7MR4mouYCs4ac68c5J5iIJI3uWba/BZLIAUK+x4mhpOmT/a2uRsyDBgjh/cUI70Cs7lKBf5inr4H+etQ4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6003a.ext.cloudfilter.net ([10.0.30.151]) by cmsmtp with ESMTPS id x8gAq1GZJhqFdxF7dqZuU9; Sun, 29 Oct 2023 23:23:09 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqJcfSRqxCxF7cqwDwj; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=IY2U5Ema 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=zMMbdkV51knYF0lJCw0A:9 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=jM6DCd68ONcyHipwLBjwge6Z2g3ZYg8IGT9HgotbGK4=; b=bzbW9kdf7RU+m19nTWXBiv51ek Ad6M515uvIlcasdZB2tV1mIgMZs9SRFamlVo+1BMRWcGxm2qVDFbatdKGVeFlm9vzKykqEB5GNqvI rSCidYPP+3uU4tn+VSfQGMGpr; 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 1qxF7c-0042zY-1g for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:40 -0600 Subject: [PATCH 19/30] Return a block_symbol from get_frame_function MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-19-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: 1qxF7c-0042zY-1g 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: 20 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCYECl7A8G9VtTR9WvKCEzQTmDDvpWmOE89rJ8fwW0MONnRybnWwIR76dDGaMDYwm1Djg9WA0slSHrorzrUYK8HIQKg1AkLoBpsPFYP6d5qSmdbD4TLF Wy5UyQQyNuKEAN1yswa/yNd58YAuedlkFlEVkRI/9gTBnl0t4e6FR24WRSE6F6MqOW5vIF11hK4fT4XqTiG5jxtfkr0+H2PN994= 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 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 get_frame_function to return a block_symbol, allowing updates in other places. Like some earlier patches, this change is the direction the code should go anyway -- the return value will eventually carry an objfile along with it. --- gdb/blockframe.c | 6 +++--- gdb/breakpoint.c | 2 +- gdb/findvar.c | 2 +- gdb/frame.c | 2 +- gdb/frame.h | 3 ++- gdb/infcmd.c | 4 ++-- gdb/infrun.c | 4 ++-- gdb/inline-frame.c | 2 +- gdb/skip.c | 2 +- gdb/stack.c | 8 ++++---- 10 files changed, 18 insertions(+), 17 deletions(-) diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 981094803ed..3977ecd6229 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -114,18 +114,18 @@ get_pc_function_start (CORE_ADDR pc) /* Return the symbol for the function executing in frame FRAME. */ -struct symbol * +block_symbol get_frame_function (frame_info_ptr frame) { const struct block *bl = get_frame_block (frame, 0); if (bl == NULL) - return NULL; + return {}; while (bl->function () == NULL && bl->superblock () != NULL) bl = bl->superblock (); - return bl->function (); + return { bl->function (), bl }; } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 60ba22c3257..311d21f02c5 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5287,7 +5287,7 @@ watchpoint_check (bpstat *bs) { struct symbol *function; - function = get_frame_function (fr); + function = get_frame_function (fr).symbol; if (function == NULL || !function->value_block ()->contains (b->exp_valid_block)) within_current_scope = false; diff --git a/gdb/findvar.c b/gdb/findvar.c index 909dca65532..f3be783ec24 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -408,7 +408,7 @@ follow_static_link (frame_info_ptr frame, in. */ for (; frame != NULL; frame = get_prev_frame (frame)) { - struct symbol *framefunc = get_frame_function (frame); + struct symbol *framefunc = get_frame_function (frame).symbol; /* Stacks can be quite deep: give the user a chance to stop this. */ QUIT; diff --git a/gdb/frame.c b/gdb/frame.c index 7077016ccba..315b94e4447 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2833,7 +2833,7 @@ find_frame_sal (frame_info_ptr frame) function, which can not be inferred from get_frame_pc. */ next_frame = get_next_frame (frame); if (next_frame) - sym = get_frame_function (next_frame); + sym = get_frame_function (next_frame).symbol; else sym = inline_skipped_symbol (inferior_thread ()); diff --git a/gdb/frame.h b/gdb/frame.h index 1d7422cac32..0f1640c4a68 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -69,6 +69,7 @@ */ +#include "block-symbol.h" #include "cli/cli-option.h" #include "frame-id.h" #include "gdbsupport/common-debug.h" @@ -856,7 +857,7 @@ extern const struct block *get_frame_block (frame_info_ptr, extern const struct block *get_selected_block (CORE_ADDR *addr_in_block); -extern struct symbol *get_frame_function (frame_info_ptr); +extern block_symbol get_frame_function (frame_info_ptr); extern CORE_ADDR get_pc_function_start (CORE_ADDR); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 03e54438686..2e9d913c41c 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -957,7 +957,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) frame = get_current_frame (); sal = find_frame_sal (frame); - sym = get_frame_function (frame); + sym = get_frame_function (frame).symbol; if (sym != nullptr) fn = sym->print_name (); @@ -1085,7 +1085,7 @@ jump_command (const char *arg, int from_tty) resolve_sal_pc (&sal); /* May error out. */ /* See if we are trying to jump to another function. */ - fn = get_frame_function (get_current_frame ()); + fn = get_frame_function (get_current_frame ()).symbol; sfn = find_pc_sect_containing_function (sal.pc, find_pc_mapped_section (sal.pc)); if (fn != nullptr && sfn != fn) diff --git a/gdb/infrun.c b/gdb/infrun.c index 2a004690e67..3c85cb5f481 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4846,7 +4846,7 @@ inline_frame_is_marked_for_skip (bool prev_frame, struct thread_info *tp) break; sal = find_frame_sal (frame); - sym = get_frame_function (frame); + sym = get_frame_function (frame).symbol; if (sym != nullptr) fn = sym->print_name (); @@ -8390,7 +8390,7 @@ check_exception_resume (struct execution_control_state *ecs, return; } - func = get_frame_function (frame); + func = get_frame_function (frame).symbol; if (!func) return; diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c index 80765d5cca5..48ada3597bf 100644 --- a/gdb/inline-frame.c +++ b/gdb/inline-frame.c @@ -179,7 +179,7 @@ inline_frame_this_id (frame_info_ptr this_frame, which generates DW_AT_entry_pc for inlined functions when possible. If this attribute is available, we should use it in the frame ID (and eventually, to set breakpoints). */ - func = get_frame_function (this_frame); + func = get_frame_function (this_frame).symbol; gdb_assert (func != NULL); (*this_id).code_addr = func->value_block ()->entry_pc (); (*this_id).artificial_depth++; diff --git a/gdb/skip.c b/gdb/skip.c index 28902a6d326..a11a35314e3 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -205,7 +205,7 @@ skip_function_command (const char *arg, int from_tty) if (arg == NULL) { frame_info_ptr fi = get_selected_frame (_("No default function now.")); - struct symbol *sym = get_frame_function (fi); + struct symbol *sym = get_frame_function (fi).symbol; const char *name = NULL; if (sym != NULL) diff --git a/gdb/stack.c b/gdb/stack.c index 0b35d62f82f..52448ff98a5 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1266,7 +1266,7 @@ find_frame_funname (frame_info_ptr frame, enum language *funlang, if (funcp) *funcp = NULL; - func = get_frame_function (frame); + func = get_frame_function (frame).symbol; if (func) { const char *print_name = func->print_name (); @@ -1498,7 +1498,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p) pc_regname = "pc"; frame_pc_p = get_frame_pc_if_available (fi, &frame_pc); - func = get_frame_function (fi); + func = get_frame_function (fi).symbol; symtab_and_line sal = find_frame_sal (fi); s = sal.symtab; gdb::unique_xmalloc_ptr func_only; @@ -2514,7 +2514,7 @@ print_frame_arg_vars (frame_info_ptr frame, return; } - func = get_frame_function (frame); + func = get_frame_function (frame).symbol; if (func == NULL) { if (!quiet) @@ -2699,7 +2699,7 @@ return_command (const char *retval_exp, int from_tty) std::string query_prefix; thisframe = get_selected_frame ("No selected frame."); - thisfun = get_frame_function (thisframe); + thisfun = get_frame_function (thisframe).symbol; gdbarch = get_frame_arch (thisframe); if (get_frame_type (get_current_frame ()) == INLINE_FRAME)