From patchwork Sun Oct 29 23:23:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78716 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 5EEA838323FD for ; Sun, 29 Oct 2023 23:24:58 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 5F62A386192F for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F62A386192F 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 5F62A386192F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; cv=none; b=fCTLTSYANDQG8/LUuciLrBFqdMufNevOPZp/YaN9UFH+C1pFBtyX4knl/20Og7WAbzJiD43oW8nTtWQvBIiZZqbhKrDE5IqMw2XDPC/R7vq7a56XHcsRWm6qcjavnLqibuPmVFIkpCYbS5OhQbrvuazzqai+sWRLxocEwBo+PlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; c=relaxed/simple; bh=WuAMfLN0g5TeZiiPqh0dpOc3k+CDWmlfAerGjPGQfbI=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=DWyF2jjT4LU58E1T+q7CK/dYwuWriprcZV5r8dXRmp4wVspl53AtprQG9xd9qMF8o+hml2kH92LLRPBIsAU9Hwt4wvRW9Kqg1sM24yELUm3J/nFp4LpvMSKcdjphJaby+XAzeo90aKmoGp5uHz3j+UxJ4EWuoIvFqnZSnbw7bxI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5001a.ext.cloudfilter.net ([10.0.29.139]) by cmsmtp with ESMTPS id xC6jqhsMJgpyExF7eqEFAM; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dqy0JGkmEdxF7eqWc9f; Sun, 29 Oct 2023 23:23:10 +0000 X-Authority-Analysis: v=2.4 cv=AsL9YcxP c=1 sm=1 tr=0 ts=653ee95e 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=hhQC6KFsvGt_RSI_mqIA: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=gYgpVUedhz6HkubQwCuS/DwMNonXdNjw9IV4aiU/Nc4=; b=lGmb349WMV8bsn31mAzJrkcfMw 4OSIa3tZwfE8YQE8Y/qzu5eQr1UM2anhRLULEXSJy2XKLAFj54v8Rhqc9HJeTN5Wn6PHmRgJ0N+JZ KUZ+XY/j12/TsCroVAxh3lO8G; 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-1V for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:47 -0600 Subject: [PATCH 26/30] Change find_frame_funname to return a block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-26-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-1V 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: 27 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfLNosiGt5TMTWgo53a6YCic7cq3j9vlD9ZULOygyo+bqfF2FvlKNttkOQhJi/63wfaZ+xUNGKd8AVWrVSk1dcUvdms57oqV6yPQboUPl9rkV407rjKek 4C6DI4P0pP/u9VHITtO1DqtR+xXAPNsEmXMmz00HfJDGooM/lBqC2E+vOVv1KiWEcyd9hCM4ZnIsgaceJLt/Wzd9dBph+cdZbSQ= 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_DNSWL_NONE, 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 the out parameter of find_frame_funname to be a block_symbol. This helps a later patch. --- gdb/python/py-frame.c | 4 +++- gdb/python/py-unwind.c | 4 +++- gdb/stack.c | 19 ++++++++++--------- gdb/stack.h | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 1a55e514e39..555354df920 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -316,6 +316,7 @@ frapy_block (PyObject *self, PyObject *args) static PyObject * frapy_function (PyObject *self, PyObject *args) { + block_symbol bsym = {}; struct symbol *sym = NULL; frame_info_ptr frame; @@ -326,7 +327,8 @@ frapy_function (PyObject *self, PyObject *args) FRAPY_REQUIRE_VALID (self, frame); gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &sym); + = find_frame_funname (frame, &funlang, &bsym); + sym = bsym.symbol; } catch (const gdb_exception &except) { diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index ee50c51b531..97035c5a140 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -658,6 +658,7 @@ pending_framepy_function (PyObject *self, PyObject *args) PENDING_FRAMEPY_REQUIRE_VALID (pending_frame); struct symbol *sym = nullptr; + block_symbol bsym = {}; try { @@ -665,7 +666,8 @@ pending_framepy_function (PyObject *self, PyObject *args) frame_info_ptr frame = pending_frame->frame_info; gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &sym); + = find_frame_funname (frame, &funlang, &bsym); + sym = bsym.symbol; } catch (const gdb_exception &except) { diff --git a/gdb/stack.c b/gdb/stack.c index 6916df77929..8b76a1d524d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1258,21 +1258,21 @@ get_last_displayed_sal () gdb::unique_xmalloc_ptr find_frame_funname (frame_info_ptr frame, enum language *funlang, - struct symbol **funcp) + block_symbol *funcp) { - struct symbol *func; + block_symbol func; gdb::unique_xmalloc_ptr funname; *funlang = language_unknown; if (funcp) - *funcp = NULL; + *funcp = {}; - func = get_frame_function (frame).symbol; - if (func) + func = get_frame_function (frame); + if (func.symbol != nullptr) { - const char *print_name = func->print_name (); + const char *print_name = func.symbol->print_name (); - *funlang = func->language (); + *funlang = func.symbol->language (); if (funcp) *funcp = func; if (*funlang == language_cplus) @@ -1319,14 +1319,15 @@ print_frame (const frame_print_options &fp_opts, struct ui_out *uiout = current_uiout; enum language funlang = language_unknown; struct value_print_options opts; - struct symbol *func; CORE_ADDR pc = 0; int pc_p; pc_p = get_frame_pc_if_available (frame, &pc); + block_symbol bfunc; gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &func); + = find_frame_funname (frame, &funlang, &bfunc); + struct symbol *func = bfunc.symbol; annotate_frame_begin (print_level ? frame_relative_level (frame) : 0, gdbarch, pc); diff --git a/gdb/stack.h b/gdb/stack.h index 1b0c2b342a4..616eb9a93d4 100644 --- a/gdb/stack.h +++ b/gdb/stack.h @@ -22,7 +22,7 @@ gdb::unique_xmalloc_ptr find_frame_funname (frame_info_ptr frame, enum language *funlang, - struct symbol **funcp); + block_symbol *funcp); typedef gdb::function_view iterate_over_block_arg_local_vars_cb;