[PATCH v2 3/9] gdb: Introduce 'stack.c:print_pc' function without frame argument.

Christina Schimpe
2026-01-23T08:06:14Z

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

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(-)

diff --git a/gdb/stack.c b/gdb/stack.c
index 54935992ebf..ffca1cb0865 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -983,15 +983,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 (" [");
@@ -1000,6 +999,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
--
2.34.1

[-- Attachment #2.1: Type: text/plain, Size: 329 bytes --]

Intel Deutschland GmbH
Registered Address: Dornacher Straße 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ünchen HRB 186928

[-- Attachment #2.2: Type: text/html, Size: 357 bytes --]