From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IbEuAA1hTmqwcCwAWB0awg (envelope-from ) for ; Wed, 08 Jul 2026 10:39:09 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JrSZr8yj; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F0CC41E098; Wed, 08 Jul 2026 10:39:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8F1741E024 for ; Wed, 08 Jul 2026 10:39:08 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25CD64BA2E2B for ; Wed, 8 Jul 2026 14:39:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25CD64BA2E2B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JrSZr8yj Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by sourceware.org (Postfix) with ESMTPS id 5C6CD4BA2E2A for ; Wed, 8 Jul 2026 14:37:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C6CD4BA2E2A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C6CD4BA2E2A Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783521461; cv=none; b=i1/sw52jGrXel9ZFHoQGkCfUogNmjXuKXfaYGvcfmUrMN7ZcZANao+7AN+40SQa9iZelL0ccpIXE0sshnUYSutpaF+/YlO1fjS5r3hM1J3IxcimiB/WFeRL4H1BuA1eGQj5p1rTSwB/7qml17Qvw5n4xAcG3BvQmNIRdnRX5Sgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783521461; c=relaxed/simple; bh=aaCNwxsexwrUA6oYbkMOCmiOXsEytt9CDD34TF9hNrE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=S6DmWSYEB5JSWV5KVWBOE8a63NnpfoRoHMXZ6StVw6Hs/CbDiKzNu1qv6zy41/MTv+/DecCbK+StT/nNMETc10M0QHMArgDvdcvzG7HbZnJjGDeopGCfOD5WWdTBlLkf+UP+n5vdH0vJC13GggLx0Blf+nvdAEFqweReTWQaIiw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JrSZr8yj DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C6CD4BA2E2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783521462; x=1815057462; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aaCNwxsexwrUA6oYbkMOCmiOXsEytt9CDD34TF9hNrE=; b=JrSZr8yj2uBYY+pvccm+c4yts4NIebWjLwrdL299iWGgDYJfNJp499VJ P2dd3wb/ey0F5Sg424K0b8TDjZN+mwubPmlkocsEkDYZ1AwQ72G8yyS16 ehsCxI6PHcoSwx0XepxwzbODlFCPAx0nd8kdIwyg1eul20DythX9jBmmi 4a08Ty3MIZ3n6BdOgm+THs2GGtZ1RhQ3DMxUVO4vEs9Gvbe+pDjuDGuj1 3nIYCJsnuccPF99rdMILAQh3z8uKRxQdOrpAcSi/3cK8YfuwhyzcxfMxR zn7gRor0yEeLmUy8Vw44ZrXDcn5c95PWCfJ5Yi9kKQ1dROB+jy3fldKGl A==; X-CSE-ConnectionGUID: Io4kWPPAST+kvijF1pqJJw== X-CSE-MsgGUID: 7gYdoSRLQUiZvVb8kkI5Tg== X-IronPort-AV: E=McAfee;i="6800,10657,11841"; a="84375434" X-IronPort-AV: E=Sophos;i="6.25,153,1779174000"; d="scan'208";a="84375434" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2026 07:37:41 -0700 X-CSE-ConnectionGUID: VJ4p3OBlSa+ZDpun127UBQ== X-CSE-MsgGUID: 3FPk/srUT+edGr2gbfZ1xg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,153,1779174000"; d="scan'208";a="249864289" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2026 07:37:40 -0700 From: Christina Schimpe To: gdb-patches@sourceware.org Cc: tom@tromey.com, thiago.bauermann@linaro.org Subject: [PATCH v4 06/13] gdb: Refactor 'find_symbol_funname' and 'info_frame_command_core' in stack.c. Date: Wed, 8 Jul 2026 14:36:32 +0000 Message-Id: <20260708143639.2214689-7-christina.schimpe@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260708143639.2214689-1-christina.schimpe@intel.com> References: <20260708143639.2214689-1-christina.schimpe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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~public-inbox=simark.ca@sourceware.org To avoid code duplication, create a new function 'stack.c:find_symbol_funname', which will be used in 'stack.c:find_frame_funname'. The function will also be used in a following commit. Approved-By: Tom Tromey --- gdb/stack.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/gdb/stack.c b/gdb/stack.c index 61cd73b8367..f5196c384fd 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1211,6 +1211,33 @@ get_last_displayed_sal () return sal; } +/* Find the function name for the symbol SYM. */ + +static gdb::unique_xmalloc_ptr +find_symbol_funname (const symbol *sym) +{ + gdb::unique_xmalloc_ptr funname; + const char *print_name = sym->print_name (); + + if (sym->language () == language_cplus) + { + /* It seems appropriate to use print_name () here, + to display the demangled name that we already have + stored in the symbol table, but we stored a version + with DMGL_PARAMS turned on, and here we don't want to + display parameters. So remove the parameters. */ + funname = cp_remove_params (print_name); + } + + if (funname == nullptr) + { + /* If we didn't hit the C++ case above, set *funname here. */ + funname = make_unique_xstrdup (print_name); + } + + return funname; +} + /* Attempt to obtain the name, FUNLANG and optionally FUNCP of the function corresponding to FRAME. */ @@ -1229,25 +1256,10 @@ find_frame_funname (const frame_info_ptr &frame, enum language *funlang, func = get_frame_function (frame); if (func) { - const char *print_name = func->print_name (); - *funlang = func->language (); if (funcp) *funcp = func; - if (*funlang == language_cplus) - { - /* It seems appropriate to use print_name() here, - to display the demangled name that we already have - stored in the symbol table, but we stored a version - with DMGL_PARAMS turned on, and here we don't want to - display parameters. So remove the parameters. */ - funname = cp_remove_params (print_name); - } - - /* If we didn't hit the C++ case above, set *funname - here. */ - if (funname == NULL) - funname = make_unique_xstrdup (print_name); + funname = find_symbol_funname (func); } else { -- 2.34.1 Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 89 991 430, www.intel.de Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell Chairperson of the Supervisory Board: Nicole Lau Registered Seat: Munich Commercial Register: Amtsgericht Muenchen HRB 186928