[v5,05/13] gdb: Introduce 'stack.c:print_pc' function without frame argument.

Message ID 20260924083311.1961530-6-christina.joos@intel.com
State New
Headers
Series Add new command to print the shadow stack backtrace |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply

Commit Message

Joos, Christina Sept. 24, 2026, 8:33 a.m. UTC
  The function will be used in a later patch "gdb: Implement 'bt shadow'
to print the shadow stack backtrace.".

Approved-By: Tom Tromey <tom@tromey.com>
---
 gdb/stack.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
  

Patch

diff --git a/gdb/stack.c b/gdb/stack.c
index cfbb22ee193..49dfa246631 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -960,15 +960,14 @@  print_frame_info_to_print_what (const char *print_frame_info)
 		  print_frame_info);
 }
 
-/* Print the PC from FRAME, plus any flags, to UIOUT.  */
+/* Print the PC, plus any FLAGS (if non-empty), to UIOUT.  */
 
 static void
-print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, const frame_info_ptr &frame,
+print_pc (ui_out *uiout, gdbarch *gdbarch, const std::string &flags,
 	  CORE_ADDR pc)
 {
   uiout->field_core_addr ("addr", gdbarch, pc);
 
-  std::string flags = gdbarch_get_pc_address_flags (gdbarch, frame, pc);
   if (!flags.empty ())
     {
       uiout->text (" [");
@@ -977,6 +976,16 @@  print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, const frame_info_ptr &f
     }
 }
 
+/* Print the PC from FRAME, plus any flags, to UIOUT.  */
+
+static void
+print_pc (ui_out *uiout, gdbarch *gdbarch, const frame_info_ptr &frame,
+	  CORE_ADDR pc)
+{
+  std::string flags = gdbarch_get_pc_address_flags (gdbarch, frame, pc);
+  print_pc (uiout, gdbarch, flags, pc);
+}
+
 /* See stack.h.  */
 
 void