From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id 173213856943 for ; Sun, 5 Nov 2023 18:11:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 173213856943 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 173213856943 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207900; cv=none; b=YVjusQNMfzwglhz2YFGas50MFtDwsGAFlLczOmX5May/Wv4mxJiD6YxXMM236ymJ9vyRC28G6qFANAY48G6gYqjvVoZXEIy4EwoA8vIC699mjLn9yfKhXY72910+CKDRSpAovJ/MhQUvR0M/pKw7uzmtu7s67v3qN/pKWG2xHuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207900; c=relaxed/simple; bh=vkdTZBomzVNQwPtpcPKkjZ0d8gDLOXPq9h8saPwwjE4=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=an+J3yAiaP+IwuQQm4X/IwM9Yc8t5cfkw1TShI+ah92ArDMiewEnO9nRsn6HFlgAKvS+6PtT+iQMY3ugTgEIWCqj6ERsQPaKBTpUdcwCWTEm9HxPmHZlyIytp05SSKN2sbmHXd6SpjY7ddXpupI4aqF8A596hnDPk581gcCJjA0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5002a.ext.cloudfilter.net ([10.0.29.215]) by cmsmtp with ESMTPS id zY39qGVO38Htezhawq8aBj; Sun, 05 Nov 2023 18:11:34 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhavqkL3RF1O4zhavqlfnB; Sun, 05 Nov 2023 18:11:34 +0000 X-Authority-Analysis: v=2.4 cv=CcwbWZnl c=1 sm=1 tr=0 ts=6547dad6 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=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=5OBvBmo47+acEDFxMY9Xq3m5T7Iif1oYPYsh4vFixMY=; b=xZ08U3dIycGruIk9VVQOobOVzP +mXewjVA3HNiJar3pxgCJ61Pjb3g/KOcNpjeg9T/AnMQuzFnmAcrzwWnW362KFkiipMVChCT/h7Mj WqRyMrwYJWQpbu2XUoXEASxi3; 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 1qzhav-003Y66-0c for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:33 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:58 -0700 Subject: [PATCH v2 20/31] Return a block_symbol from get_frame_function 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-20-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: 1qzhav-003Y66-0c 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: 21 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEidLy//I2LHt2aprT+9QkF3/XlUJPHZzxkKSict5cxJEVwW6oTlDxciP8gsoQZ51L6Q2qfSMvCWHTc+h8wZd18Zz9LNTYAmgPGhCDIDmoNuH9LWK0Kc 2TbxGBBRUiCHNcCeWxUrzo3I+aZrZhZmdHWUL1RBKrdpEJUQdLs5uxPNEpmALX3qGzouxK/yeIX8IrRTl2haLo5qmTkHD6u1eSA= 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 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 52ce63afade..e9dd942da4e 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 39dcefa87b8..a2ea7301394 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; @@ -2510,7 +2510,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) @@ -2692,7 +2692,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) -- 2.41.0