From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oRKvAmcsc2neDhEAWB0awg (envelope-from ) for ; Fri, 23 Jan 2026 03:08:07 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=nq32ovau; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 013021E0E1; Fri, 23 Jan 2026 03:08:06 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,HTML_MESSAGE,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 19DE71E08D for ; Fri, 23 Jan 2026 03:08:06 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id AC3F34BCA427 for ; Fri, 23 Jan 2026 08:08:05 +0000 (GMT) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by sourceware.org (Postfix) with ESMTPS id 631E14BCA401 for ; Fri, 23 Jan 2026 08:05:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 631E14BCA401 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 631E14BCA401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769155555; cv=none; b=YCuqu9JHo1WQkJbUabvpqPq7ZnO4LLNwzfUg2HzA4sqOcJ3jwli61C3iIutOojNMgHzULoY7GxhtZfJ/lGr25QzOFOJcA5pjkswWkUmQjJ58oHa+qMDasiOxAIBbTxAA5l5/Pj2u302hCThoM2LZpGCbk0dw+fobmluXWiG7K6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769155555; c=relaxed/simple; bh=IsjfZs1BPCwGDnIdsOLZHy0lklsI5Zp8xRBiCtxFbMw=; h=DKIM-Signature:MIME-Version:From:To:Subject:Date:Message-Id: MIME-Version; b=q4H7IWjBDKnxyeFpQshwk4vUMmxIk42uQtjS0Zb67nmYwfVXuItIosJyVYAj2+cSE3jQ6qVCBVRP4alESbBXsfNUdT02pTO2iOsaAiYkzsez8ZebWxRAmh6OhENcrqWvWmBDqPLs3taoURvou0TjEIupRmXT3ZB438n7U99BF2I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769155555; x=1800691555; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=IsjfZs1BPCwGDnIdsOLZHy0lklsI5Zp8xRBiCtxFbMw=; b=nq32ovauTrz4jXQLGlAgFBUApt6cRnntOvcljSCgnwHy4C4HSEwjFoPQ YxrZJAlGKo8xbysjZ3iVer1q23amqepcHM0vvBm/JTzQBM4KO7n5dPTbV 0fyRh7pNbddWXw1NwftiuHQGPjNE9yPM7tIf73rsAp38esKzzNwuE7ypD OQLUPwFXAAOBPykOh6kUNQVT8VggSYYVC0CQOrydDH0o3QQW2QSSD4ciL rqqNDBRajsZLHuxebmdiK+6jIY4l+nYH3onNOkM6IZG6nFR9HLQmTrhOz /BQwsuzH6zPTzq6gThFB9VuKxtrgbELcees8ZzjE3F+z9fFuLVWFbPxx1 w==; X-CSE-ConnectionGUID: muYiqsdpQiSL1htyAe46nw== X-CSE-MsgGUID: fC9UZcWFQAWaRchjFdB2KA== X-IronPort-AV: E=McAfee;i="6800,10657,11679"; a="69603038" X-IronPort-AV: E=Sophos;i="6.21,248,1763452800"; d="scan'208";a="69603038" Content-Type: multipart/mixed; boundary="===============2516839593367197155==" MIME-Version: 1.0 Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2026 00:05:54 -0800 X-CSE-ConnectionGUID: LPadnHRiTRmTE88LN8u5ZA== X-CSE-MsgGUID: NPQKT4rTRvCeeayrgm6PyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,248,1763452800"; d="scan'208";a="206785293" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2026 00:05:52 -0800 From: Christina Schimpe To: gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org Subject: [PATCH v2 2/9] gdb: Refactor 'stack.c:print_frame'. Date: Fri, 23 Jan 2026 08:05:24 +0000 Message-Id: <20260123080532.878738-3-christina.schimpe@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260123080532.878738-1-christina.schimpe@intel.com> References: <20260123080532.878738-1-christina.schimpe@intel.com> MIME-Version: 1.0 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 --===============2516839593367197155== Content-Transfer-Encoding: 8bit Refactor the function 'stack.c:print_frame' by introducing several small functions. The functions will also be used in a later patch "gdb: Implement 'bt shadow' to print the shadow stack backtrace." Approved-By: Tom Tromey --- gdb/stack.c | 90 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 33 deletions(-) diff --git a/gdb/stack.c b/gdb/stack.c index 732d525083e..54935992ebf 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1320,6 +1320,60 @@ find_frame_funname (const frame_info_ptr &frame, enum language *funlang, return funname; } +/* Print the library LIB to UIOUT for the printing of frame + information. */ + +static void +print_lib (ui_out *uiout, const char *lib) +{ + annotate_frame_where (); + uiout->wrap_hint (2); + uiout->text (" from "); + uiout->field_string ("from", lib, file_name_style.style ()); +} + +/* Print the filenname of SAL to UIOUT for the printing of frame + information. */ + +static void +print_filename (ui_out *uiout, symtab_and_line sal) +{ + annotate_frame_source_begin (); + const char *filename_display; + + filename_display = symtab_to_filename_for_display (sal.symtab); + uiout->wrap_hint (3); + uiout->text (" at "); + annotate_frame_source_file (); + uiout->field_string ("file", filename_display, file_name_style.style ()); + + if (uiout->is_mi_like_p ()) + { + const char *fullname = symtab_to_fullname (sal.symtab); + uiout->field_string ("fullname", fullname); + } + + annotate_frame_source_file_end (); + uiout->text (":"); + annotate_frame_source_line (); + uiout->field_signed ("line", sal.line, line_number_style.style ()); + annotate_frame_source_end (); +} + +/* If available, print FUNNAME to UIOUT for the printing of frame + information. */ + +static void +print_funname (ui_out *uiout, + gdb::unique_xmalloc_ptr const &funname) +{ + annotate_frame_function_name (); + string_file stb; + gdb_puts (funname ? funname.get () : "??", &stb); + uiout->field_stream ("func", stb, function_name_style.style ()); + uiout->wrap_hint (3); +} + static void print_frame (struct ui_out *uiout, const frame_print_options &fp_opts, @@ -1365,12 +1419,8 @@ print_frame (struct ui_out *uiout, annotate_frame_address_end (); uiout->text (" in "); } - annotate_frame_function_name (); + print_funname (uiout, funname); - string_file stb; - gdb_puts (funname ? funname.get () : "??", &stb); - uiout->field_stream ("func", stb, function_name_style.style ()); - uiout->wrap_hint (3); annotate_frame_args (); uiout->text (" ("); @@ -1403,28 +1453,7 @@ print_frame (struct ui_out *uiout, } uiout->text (")"); if (print_what != SHORT_LOCATION && sal.symtab) - { - const char *filename_display; - - filename_display = symtab_to_filename_for_display (sal.symtab); - annotate_frame_source_begin (); - uiout->wrap_hint (3); - uiout->text (" at "); - annotate_frame_source_file (); - uiout->field_string ("file", filename_display, - file_name_style.style ()); - if (uiout->is_mi_like_p ()) - { - const char *fullname = symtab_to_fullname (sal.symtab); - - uiout->field_string ("fullname", fullname); - } - annotate_frame_source_file_end (); - uiout->text (":"); - annotate_frame_source_line (); - uiout->field_signed ("line", sal.line, line_number_style.style ()); - annotate_frame_source_end (); - } + print_filename (uiout, sal); if (print_what != SHORT_LOCATION && pc.has_value () && (funname == NULL || sal.symtab == NULL)) @@ -1434,12 +1463,7 @@ print_frame (struct ui_out *uiout, get_frame_address_in_block (frame)); if (lib) - { - annotate_frame_where (); - uiout->wrap_hint (2); - uiout->text (" from "); - uiout->field_string ("from", lib, file_name_style.style ()); - } + print_lib (uiout, lib); } if (uiout->is_mi_like_p ()) uiout->field_string ("arch", -- 2.34.1 --===============2516839593367197155== Content-Type: multipart/alternative; boundary="===============4961215504975845551==" MIME-Version: 1.0 Content-Disposition: inline --===============4961215504975845551== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Intel Deutschland GmbH Registered Address: Dornacher Stra=C3=9Fe 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 M=C3=BCnchen HRB 186928 --===============4961215504975845551== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable
Intel Deutschland GmbH
Registered Address: Dornacher Stra=C3= =9Fe 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.deManaging Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell<= div>Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: M= unich
Commercial Register: Amtsgericht M=C3=BCnchen HRB 186928 --===============4961215504975845551==-- --===============2516839593367197155==--