From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EeEuCLzgtGqL3zsAWB0awg (envelope-from ) for ; Thu, 24 Sep 2026 04:35:08 -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=bMu4J5v6; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1E22D1E06B; Thu, 24 Sep 2026 04:35: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=-3.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,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 5DC741E033 for ; Thu, 24 Sep 2026 04:35:07 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBABC4BB3BCC for ; Thu, 24 Sep 2026 08:35:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBABC4BB3BCC 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=bMu4J5v6 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by sourceware.org (Postfix) with ESMTPS id 518E14BB5882 for ; Thu, 24 Sep 2026 08:34:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 518E14BB5882 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 518E14BB5882 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790238876; cv=none; b=Te4rVMqVrVdMjlKHizcjxK/mj54yEJI8DFQqJXiIohn5jQtzCTYdaCEtih7q4pGwMgw5i03ZLZumU8J07dnFpjy+jmTWGFhvRyBwTPtyXRYTxEBDNBRpjXXJxVpQAJgDotE5fedHXln2cAyb2f1OnCmBxrlPZfZATJzqMWZLGpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790238876; c=relaxed/simple; bh=lkMnIKXYawrMA/VAIQSXtC6IOtSfkzaqeecF3gr5560=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GJi5mBTMY0A76SeMaAhtPgKT5O0CUo9OWWQjTJoAmJ4k3zPxjSUWnReDcNlBJ1n9LUaVCsGw7XKYlms9SK4vCUjVS6WWq1+SfclNbl1rgZV++skraqAmnw9P4+nUZq5VRbFEjrPz84gwoLfVWiavuzMFC0KDBBdCoXYREXWr7yI= 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=bMu4J5v6 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 518E14BB5882 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1790238876; x=1821774876; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lkMnIKXYawrMA/VAIQSXtC6IOtSfkzaqeecF3gr5560=; b=bMu4J5v6tKOjsVPnz/E092+XVt2adDnT08FgcC3DrCBmQDMkHcaje/PC hdxRtcsCX5olgfjBKB4flCvwJdr0NN3M5b1ObBj+Ppj9/mjPk+vzEkJRp anCO3JYNaOSLhXPhVaFFzgQWSYKby46NKbmf6XromOymg35hOu06hB4EI gE3JRAM5/zc8BDERlOJzF9F/XW7MofDwjD0qn9SXrJDgXlxcQIfPYXslT EEUTU/0ZHYneOZyi4dmow/wPBZWfNgEs71BR6dJZoBOK59atiwPJwOnFo UgDowf+qZY8vCQl/ZYAp+w/MkgwbTJqnSp2/ndabxjS4T+hSworjd1m+0 w==; X-CSE-ConnectionGUID: jDOh1L7wQ9moS67db3ILAw== X-CSE-MsgGUID: z2HDGxtHSXWamqzlVh2LuQ== X-IronPort-AV: E=McAfee;i="6800,10657,11914"; a="91021345" X-IronPort-AV: E=Sophos;i="6.27,120,1787036400"; d="scan'208";a="91021345" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2026 01:34:33 -0700 X-CSE-ConnectionGUID: ev00ZVaRTbmu4qRMHaXLMw== X-CSE-MsgGUID: xtKnSINDTD6/xGesQeJzGg== X-ExtLoop1: 1 Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2026 01:34:32 -0700 From: Christina Joos To: gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org, tom@tromey.com, luis.machado.foss@gmail.com Subject: [PATCH v5 06/13] gdb: Refactor 'find_symbol_funname' and 'info_frame_command_core' in stack.c. Date: Thu, 24 Sep 2026 10:33:03 +0200 Message-ID: <20260924083311.1961530-7-christina.joos@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260924083311.1961530-1-christina.joos@intel.com> References: <20260924083311.1961530-1-christina.joos@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 49dfa246631..958db4dfe12 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1248,6 +1248,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. */ @@ -1266,25 +1293,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.53.0 ________________________________________ Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 (89) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.