From patchwork Thu Sep 24 08:33:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joos, Christina" X-Patchwork-Id: 144554 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7C434BB3BFD for ; Thu, 24 Sep 2026 08:35:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7C434BB3BFD 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 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, TXREP, T_SPF_TEMPERROR shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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 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 {