From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qWc+NL6gS2rgwCkAWB0awg (envelope-from ) for ; Mon, 06 Jul 2026 08:34:06 -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=aYix12m+; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D25AC1E098; Mon, 06 Jul 2026 08:34:06 -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 630401E070 for ; Mon, 06 Jul 2026 08:34:06 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56C234BA2E1A for ; Mon, 6 Jul 2026 12:34:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56C234BA2E1A 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=aYix12m+ Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by sourceware.org (Postfix) with ESMTPS id ECDBF4BA23C3 for ; Mon, 6 Jul 2026 12:32:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECDBF4BA23C3 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 ECDBF4BA23C3 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783341135; cv=none; b=s08caFOi9VH9pn+5hrqgY1QBp4DiaQjzYuTO7ZuJO0xIQ48X9P7s1kADm3EmeTFee13ou6wp3Ywvf1KGq8SGB+1z6qQuHFYpKNBIkV//kEAvb++/iuZAE5ZZVr3VVgtSShqhkW6v/knxIHs8t3o8b3AlnF/OHWdH8qgFp/SQdfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783341135; c=relaxed/simple; bh=aaCNwxsexwrUA6oYbkMOCmiOXsEytt9CDD34TF9hNrE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=pcYybV8Cyg6ZGVeWiTGBKqSl8d/zyBxP9C+TGV1ax9zRLKnEcLKmgCUWmh1tKzQfT8NfYZelb1KItYAQYXV7Ya9k2Iw0qoWkB32jl+Rn/MGtKtTlFiFDsuwToHgBscilBpZ5jvCjrfiSBdJt90tOgyI2SXcWPcrYQxU+kBc0NsA= 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=aYix12m+ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECDBF4BA23C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783341135; x=1814877135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aaCNwxsexwrUA6oYbkMOCmiOXsEytt9CDD34TF9hNrE=; b=aYix12m+6MuwK9rGyB3YFZExyHzdHqyeOgMM3xiVVzcOygM260nuCuZ1 FqLIrrgf0r7XoQdeJrV+wA4NMeZAS029Aj1M0gEYLfxD/+GB8NAOQuwdG ufbcwkfnwwgzXb6RqOZav/YxvPis+ETO2Iz2jtVns2IaRrkmPI0nFed8o jHOKQTmkxOHQh3cUyb83IkYKjyCPqd7GHteN9RObXwIqf1fpFIiZHuXnC hteOKKdtKi+Bg7wtOkaNQizW4TKhYhzkKhWqfTrRnfAscrdl7umMCVZ/b X5hKzGTRrLTfh+onDAyYyvZhISItUslMe61UhIiiJwP1EOwT+kEGuW1ey w==; X-CSE-ConnectionGUID: MOJjoIDFTxGQIKEsoRx5HA== X-CSE-MsgGUID: LAv5kWbRRX+5UCw7Slllew== X-IronPort-AV: E=McAfee;i="6800,10657,11838"; a="94332617" X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="94332617" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:32:14 -0700 X-CSE-ConnectionGUID: /xuZPm0wQ/SBVD5nZMKjWg== X-CSE-MsgGUID: dhNzMxMeSDi2SAm4ysMFpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="247309628" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:32:14 -0700 From: Christina Schimpe To: gdb-patches@sourceware.org Cc: tom@tromey.com, thiago.bauermann@linaro.org Subject: [PATCH v3 06/12] gdb: Refactor 'find_symbol_funname' and 'info_frame_command_core' in stack.c. Date: Mon, 6 Jul 2026 12:31:27 +0000 Message-Id: <20260706123133.1990441-7-christina.schimpe@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260706123133.1990441-1-christina.schimpe@intel.com> References: <20260706123133.1990441-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