* [PATCH] gdb: rename gdbarch_software_single_step -> gdbarch_get_next_pcs
@ 2025-08-14 20:14 Simon Marchi
2025-08-16 3:09 ` Kevin Buettner
0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2025-08-14 20:14 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
From: Simon Marchi <simon.marchi@polymtl.ca>
I spotted this while reviewing a patch adding a new
gdbarch_software_single_step implementation. I find the name
"software_single_step" a bit misleading or unclear. It makes it sounds
as if the function executed a single step. In reality, this function
returns the possible next PCs for current instructions.
We have a similar concept in GDBserver:
linux_process_target::low_get_next_pcs. I like that name, it's clear
and straight to the point.
Rename gdbarch_software_single_step to gdbarch_get_next_pcs. I find
this name more indicative of what happens.
There is some code for ARM shared between GDB and GDBserver to implement
both sides, also called "get next pcs", so I think it all fits well
together.
Tested by rebuilding.
Change-Id: Ide74011a5034ba11117b7e7c865a093ef0b1dece
---
gdb/aarch64-tdep.c | 2 +-
gdb/alpha-netbsd-tdep.c | 2 +-
gdb/alpha-obsd-tdep.c | 2 +-
gdb/alpha-tdep.c | 2 +-
gdb/arc-linux-tdep.c | 2 +-
gdb/arch-utils.c | 2 +-
gdb/arm-fbsd-tdep.c | 2 +-
gdb/arm-linux-tdep.c | 2 +-
gdb/arm-netbsd-tdep.c | 2 +-
gdb/arm-obsd-tdep.c | 2 +-
gdb/arm-pikeos-tdep.c | 2 +-
gdb/arm-wince-tdep.c | 2 +-
gdb/breakpoint.c | 4 +---
gdb/cris-tdep.c | 2 +-
gdb/gdbarch-gen.c | 30 +++++++++++++++---------------
gdb/gdbarch-gen.h | 10 +++++-----
gdb/gdbarch_components.py | 4 ++--
gdb/infrun.c | 2 +-
gdb/linux-nat.c | 4 ++--
gdb/loongarch-tdep.c | 2 +-
gdb/mips-fbsd-tdep.c | 2 +-
gdb/mips-linux-tdep.c | 2 +-
gdb/mips-netbsd-tdep.c | 2 +-
gdb/moxie-tdep.c | 2 +-
gdb/or1k-linux-tdep.c | 2 +-
gdb/record-full.c | 4 ++--
gdb/riscv-fbsd-tdep.c | 2 +-
gdb/riscv-linux-tdep.c | 2 +-
gdb/rs6000-aix-tdep.c | 2 +-
gdb/rs6000-tdep.c | 2 +-
gdb/s390-tdep.c | 2 +-
gdb/sparc-sol2-tdep.c | 2 +-
gdb/sparc-tdep.c | 2 +-
gdb/sparc64-sol2-tdep.c | 2 +-
gdb/tic6x-tdep.c | 2 +-
gdb/z80-tdep.c | 2 +-
36 files changed, 57 insertions(+), 59 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index f2e3ce2a36c0..248aa3ab4dad 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -4638,7 +4638,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sw_breakpoint_from_kind (gdbarch,
aarch64_breakpoint::bp_from_kind);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
- set_gdbarch_software_single_step (gdbarch, aarch64_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, aarch64_software_single_step);
/* Information about registers, etc. */
set_gdbarch_sp_regnum (gdbarch, AARCH64_SP_REGNUM);
diff --git a/gdb/alpha-netbsd-tdep.c b/gdb/alpha-netbsd-tdep.c
index 0f5e3051cc20..56143eeedf7d 100644
--- a/gdb/alpha-netbsd-tdep.c
+++ b/gdb/alpha-netbsd-tdep.c
@@ -261,7 +261,7 @@ alphanbsd_init_abi (struct gdbarch_info info,
/* NetBSD/alpha does not provide single step support via ptrace(2); we
must use software single-stepping. */
- set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, alpha_software_single_step);
/* NetBSD/alpha has SVR4-style shared libraries. */
set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
diff --git a/gdb/alpha-obsd-tdep.c b/gdb/alpha-obsd-tdep.c
index 63f90506af18..a84dfa82b8e3 100644
--- a/gdb/alpha-obsd-tdep.c
+++ b/gdb/alpha-obsd-tdep.c
@@ -106,7 +106,7 @@ alphaobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
/* OpenBSD/alpha 3.0 and earlier does not provide single step
support via ptrace(2); use software single-stepping for now. */
- set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, alpha_software_single_step);
/* OpenBSD/alpha has SVR4-style shared libraries. */
set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index d655c13b8293..59e01620ae6d 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1797,7 +1797,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
/* Handles single stepping of atomic sequences. */
- set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, alpha_software_single_step);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
index edbb3f87a5e9..6a4f4b13a234 100644
--- a/gdb/arc-linux-tdep.c
+++ b/gdb/arc-linux-tdep.c
@@ -728,7 +728,7 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
arc_linux_sw_breakpoint_from_kind);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- set_gdbarch_software_single_step (gdbarch, arc_linux_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arc_linux_software_single_step);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, arc_linux_skip_solib_resolver);
set_gdbarch_iterate_over_regset_sections
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index f320d3d73656..96fb2c4836e5 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -48,7 +48,7 @@
bool
default_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
{
- return !gdbarch_software_single_step_p (gdbarch);
+ return !gdbarch_get_next_pcs_p (gdbarch);
}
CORE_ADDR
diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c
index a37d8b76e1d8..fc81818ac873 100644
--- a/gdb/arm-fbsd-tdep.c
+++ b/gdb/arm-fbsd-tdep.c
@@ -318,7 +318,7 @@ arm_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
}
INIT_GDB_FILE (arm_fbsd_tdep)
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 08526d8e39dd..cc10679a51c8 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1805,7 +1805,7 @@ arm_linux_init_abi (struct gdbarch_info info,
set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_linux_software_single_step);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, arm_linux_skip_trampoline_code);
diff --git a/gdb/arm-netbsd-tdep.c b/gdb/arm-netbsd-tdep.c
index 82ba0c607a79..571d6f2f28d7 100644
--- a/gdb/arm-netbsd-tdep.c
+++ b/gdb/arm-netbsd-tdep.c
@@ -139,7 +139,7 @@ arm_netbsd_init_abi_common (struct gdbarch_info info,
set_gdbarch_iterate_over_regset_sections
(gdbarch, arm_nbsd_iterate_over_regset_sections);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
}
static void
diff --git a/gdb/arm-obsd-tdep.c b/gdb/arm-obsd-tdep.c
index 00e4bfd0b595..8a48b95f2017 100644
--- a/gdb/arm-obsd-tdep.c
+++ b/gdb/arm-obsd-tdep.c
@@ -96,7 +96,7 @@ armobsd_init_abi (struct gdbarch_info info,
tdep->struct_return = pcc_struct_return;
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
/* Breakpoints. */
switch (info.byte_order)
diff --git a/gdb/arm-pikeos-tdep.c b/gdb/arm-pikeos-tdep.c
index 12fd9c34c348..8d24342aeefe 100644
--- a/gdb/arm-pikeos-tdep.c
+++ b/gdb/arm-pikeos-tdep.c
@@ -26,7 +26,7 @@ static void
arm_pikeos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
}
/* The ARM PikeOS OSABI sniffer (see gdbarch_register_osabi_sniffer).
diff --git a/gdb/arm-wince-tdep.c b/gdb/arm-wince-tdep.c
index b9ea59c738f2..f14c8e8d1f86 100644
--- a/gdb/arm-wince-tdep.c
+++ b/gdb/arm-wince-tdep.c
@@ -135,7 +135,7 @@ arm_wince_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, arm_pe_skip_trampoline_code);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
/* Skip call to __gccmain that gcc places in main. */
set_gdbarch_skip_main_prologue (gdbarch, arm_wince_skip_main_prologue);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index d704ad1e3e20..460934299a82 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -14004,9 +14004,7 @@ int
insert_single_step_breakpoints (struct gdbarch *gdbarch)
{
regcache *regcache = get_thread_regcache (inferior_thread ());
- std::vector<CORE_ADDR> next_pcs;
-
- next_pcs = gdbarch_software_single_step (gdbarch, regcache);
+ std::vector<CORE_ADDR> next_pcs = gdbarch_get_next_pcs (gdbarch, regcache);
if (!next_pcs.empty ())
{
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index b49e641fa780..9cfc1ebd6fb3 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3993,7 +3993,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_cannot_store_register (gdbarch, cris_cannot_store_register);
set_gdbarch_cannot_fetch_register (gdbarch, cris_cannot_fetch_register);
- set_gdbarch_software_single_step (gdbarch, cris_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, cris_software_single_step);
break;
case 32:
diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
index fc570d37a8dc..8f7d3596309b 100644
--- a/gdb/gdbarch-gen.c
+++ b/gdb/gdbarch-gen.c
@@ -153,7 +153,7 @@ struct gdbarch
gdbarch_set_memtags_ftype *set_memtags = default_set_memtags;
gdbarch_get_memtag_ftype *get_memtag = default_get_memtag;
CORE_ADDR memtag_granule_size = 0;
- gdbarch_software_single_step_ftype *software_single_step = nullptr;
+ gdbarch_get_next_pcs_ftype *get_next_pcs = nullptr;
gdbarch_single_step_through_delay_ftype *single_step_through_delay = nullptr;
gdbarch_print_insn_ftype *print_insn = default_print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code = generic_skip_trampoline_code;
@@ -421,7 +421,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of set_memtags, invalid_p == 0. */
/* Skip verify of get_memtag, invalid_p == 0. */
/* Skip verify of memtag_granule_size, invalid_p == 0. */
- /* Skip verify of software_single_step, has predicate. */
+ /* Skip verify of get_next_pcs, has predicate. */
/* Skip verify of single_step_through_delay, has predicate. */
/* Skip verify of print_insn, invalid_p == 0. */
/* Skip verify of skip_trampoline_code, invalid_p == 0. */
@@ -948,11 +948,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: memtag_granule_size = %s\n",
core_addr_to_string_nz (gdbarch->memtag_granule_size));
gdb_printf (file,
- "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
- gdbarch_software_single_step_p (gdbarch));
+ "gdbarch_dump: gdbarch_get_next_pcs_p() = %d\n",
+ gdbarch_get_next_pcs_p (gdbarch));
gdb_printf (file,
- "gdbarch_dump: software_single_step = <%s>\n",
- host_address_to_string (gdbarch->software_single_step));
+ "gdbarch_dump: get_next_pcs = <%s>\n",
+ host_address_to_string (gdbarch->get_next_pcs));
gdb_printf (file,
"gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
gdbarch_single_step_through_delay_p (gdbarch));
@@ -3388,27 +3388,27 @@ set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch,
}
bool
-gdbarch_software_single_step_p (struct gdbarch *gdbarch)
+gdbarch_get_next_pcs_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->software_single_step != NULL;
+ return gdbarch->get_next_pcs != NULL;
}
std::vector<CORE_ADDR>
-gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache)
+gdbarch_get_next_pcs (struct gdbarch *gdbarch, struct regcache *regcache)
{
gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->software_single_step != NULL);
+ gdb_assert (gdbarch->get_next_pcs != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_software_single_step called\n");
- return gdbarch->software_single_step (regcache);
+ gdb_printf (gdb_stdlog, "gdbarch_get_next_pcs called\n");
+ return gdbarch->get_next_pcs (regcache);
}
void
-set_gdbarch_software_single_step (struct gdbarch *gdbarch,
- gdbarch_software_single_step_ftype software_single_step)
+set_gdbarch_get_next_pcs (struct gdbarch *gdbarch,
+ gdbarch_get_next_pcs_ftype get_next_pcs)
{
- gdbarch->software_single_step = software_single_step;
+ gdbarch->get_next_pcs = get_next_pcs;
}
bool
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 281b97b7aa8c..148abfab2012 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -792,11 +792,11 @@ extern void set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch, CORE_ADDR
the condition is true, so that we ensure forward progress when stepping
past a conditional branch to self. */
-extern bool gdbarch_software_single_step_p (struct gdbarch *gdbarch);
+extern bool gdbarch_get_next_pcs_p (struct gdbarch *gdbarch);
-typedef std::vector<CORE_ADDR> (gdbarch_software_single_step_ftype) (struct regcache *regcache);
-extern std::vector<CORE_ADDR> gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache);
-extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step);
+typedef std::vector<CORE_ADDR> (gdbarch_get_next_pcs_ftype) (struct regcache *regcache);
+extern std::vector<CORE_ADDR> gdbarch_get_next_pcs (struct gdbarch *gdbarch, struct regcache *regcache);
+extern void set_gdbarch_get_next_pcs (struct gdbarch *gdbarch, gdbarch_get_next_pcs_ftype *get_next_pcs);
/* Return non-zero if the processor is executing a delay slot and a
further single-step is needed before the instruction finishes. */
@@ -1148,7 +1148,7 @@ extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbar
the displaced instruction buffer).
The default implementation returns false on all targets that provide a
- gdbarch_software_single_step routine, and true otherwise. */
+ gdbarch_get_next_pcs routine, and true otherwise. */
typedef bool (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch);
extern bool gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch);
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index 91c867e69bfb..ae9e14a024f4 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -1395,7 +1395,7 @@ the condition is true, so that we ensure forward progress when stepping
past a conditional branch to self.
""",
type="std::vector<CORE_ADDR>",
- name="software_single_step",
+ name="get_next_pcs",
params=[("struct regcache *", "regcache")],
predicate=True,
)
@@ -1891,7 +1891,7 @@ receive control again (e.g. by placing a software breakpoint instruction into
the displaced instruction buffer).
The default implementation returns false on all targets that provide a
-gdbarch_software_single_step routine, and true otherwise.
+gdbarch_get_next_pcs routine, and true otherwise.
""",
type="bool",
name="displaced_step_hw_singlestep",
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9d3e1b7782e4..051236e24e71 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2370,7 +2370,7 @@ maybe_software_singlestep (struct gdbarch *gdbarch)
bool hw_step = true;
if (execution_direction == EXEC_FORWARD
- && gdbarch_software_single_step_p (gdbarch))
+ && gdbarch_get_next_pcs_p (gdbarch))
hw_step = !insert_single_step_breakpoints (gdbarch);
return hw_step;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index f3179279d92f..c3c5ddf4e40b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -549,8 +549,8 @@ linux_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
/* Note that we consult the parent's architecture instead of
the child's because there's no inferior for the child at
this point. */
- if (!gdbarch_software_single_step_p (target_thread_architecture
- (parent_ptid)))
+ if (!gdbarch_get_next_pcs_p (target_thread_architecture
+ (parent_ptid)))
{
int status;
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index cc75cd4a3d30..3bf47d2c6d28 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -1895,7 +1895,7 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_align (gdbarch, loongarch_frame_align);
/* Breakpoint manipulation. */
- set_gdbarch_software_single_step (gdbarch, loongarch_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, loongarch_software_single_step);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, loongarch_breakpoint::kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, loongarch_breakpoint::bp_from_kind);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index c1b5f9c20bc5..879058c0c8d3 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -580,7 +580,7 @@ mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);
- set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, mips_software_single_step);
switch (abi)
{
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index e4fa2438a9fc..08dbd6890902 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -1605,7 +1605,7 @@ mips_linux_init_abi (struct gdbarch_info info,
set_gdbarch_skip_solib_resolver (gdbarch, mips_linux_skip_resolver);
- set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, mips_software_single_step);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
diff --git a/gdb/mips-netbsd-tdep.c b/gdb/mips-netbsd-tdep.c
index 42eb515bc212..e72ed7b1f17e 100644
--- a/gdb/mips-netbsd-tdep.c
+++ b/gdb/mips-netbsd-tdep.c
@@ -399,7 +399,7 @@ mipsnbsd_init_abi (struct gdbarch_info info,
set_gdbarch_cannot_fetch_register (gdbarch, mipsnbsd_cannot_fetch_register);
set_gdbarch_cannot_store_register (gdbarch, mipsnbsd_cannot_store_register);
- set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, mips_software_single_step);
/* NetBSD/mips has SVR4-style shared libraries. */
set_solib_svr4_ops (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 22394066b90f..bb4887799bd3 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -1088,7 +1088,7 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
frame_unwind_append_unwinder (gdbarch, &moxie_frame_unwind);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, moxie_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, moxie_software_single_step);
/* Support simple overlay manager. */
set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
diff --git a/gdb/or1k-linux-tdep.c b/gdb/or1k-linux-tdep.c
index afefefe9c0e9..9fbf75feeaf9 100644
--- a/gdb/or1k-linux-tdep.c
+++ b/gdb/or1k-linux-tdep.c
@@ -153,7 +153,7 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
- set_gdbarch_software_single_step (gdbarch, or1k_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, or1k_software_single_step);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 7e3da277998e..c55e3b9180d8 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1091,7 +1091,7 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
if (!step)
{
/* This is not hard single step. */
- if (!gdbarch_software_single_step_p (gdbarch))
+ if (!gdbarch_get_next_pcs_p (gdbarch))
{
/* This is a normal continue. */
step = 1;
@@ -1266,7 +1266,7 @@ record_full_wait_1 (struct target_ops *ops,
process_stratum_target *proc_target
= current_inferior ()->process_target ();
- if (gdbarch_software_single_step_p (gdbarch))
+ if (gdbarch_get_next_pcs_p (gdbarch))
{
/* Try to insert the software single step breakpoint.
If insert success, set step to 0. */
diff --git a/gdb/riscv-fbsd-tdep.c b/gdb/riscv-fbsd-tdep.c
index 7bdc6e75ccb2..7999bd3f3e19 100644
--- a/gdb/riscv-fbsd-tdep.c
+++ b/gdb/riscv-fbsd-tdep.c
@@ -189,7 +189,7 @@ riscv_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);
- set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, riscv_software_single_step);
set_solib_svr4_ops (gdbarch, (riscv_isa_xlen (gdbarch) == 4
? make_svr4_ilp32_solib_ops
diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c
index e5d77e7f2080..982273a0b9da 100644
--- a/gdb/riscv-linux-tdep.c
+++ b/gdb/riscv-linux-tdep.c
@@ -511,7 +511,7 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
linux_init_abi (info, gdbarch, 0);
- set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, riscv_software_single_step);
set_solib_svr4_ops (gdbarch, (riscv_isa_xlen (gdbarch) == 4
? make_linux_ilp32_svr4_solib_ops
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 853a66e65054..6322bbc62cfd 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -1362,7 +1362,7 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
/* RS6000/AIX does not support PT_STEP. Has to be simulated. */
- set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, rs6000_software_single_step);
/* Displaced stepping is currently not supported in combination with
software single-stepping. These override the values set by
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 1c75bb76fa12..75079b9e211c 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -8458,7 +8458,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sofun_address_maybe_missing (gdbarch, 1);
/* Handles single stepping of atomic sequences. */
- set_gdbarch_software_single_step (gdbarch, ppc_deal_with_atomic_sequence);
+ set_gdbarch_get_next_pcs (gdbarch, ppc_deal_with_atomic_sequence);
/* Not sure on this. FIXMEmgo */
set_gdbarch_frame_args_skip (gdbarch, 8);
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 8a2b405b8b4f..c5fa24eb2314 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -7300,7 +7300,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
s390_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, s390_displaced_step_fixup);
set_gdbarch_displaced_step_hw_singlestep (gdbarch, s390_displaced_step_hw_singlestep);
- set_gdbarch_software_single_step (gdbarch, s390_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, s390_software_single_step);
set_gdbarch_max_insn_length (gdbarch, S390_MAX_INSTR_SIZE);
/* Prologue analysis. */
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index 337b9293dd95..8de7439e4932 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -214,7 +214,7 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->plt_entry_size = 12;
/* Solaris has kernel-assisted single-stepping support. */
- set_gdbarch_software_single_step (gdbarch, NULL);
+ set_gdbarch_get_next_pcs (gdbarch, NULL);
frame_unwind_append_unwinder (gdbarch, &sparc32_sol2_sigtramp_frame_unwind);
}
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 4a1251625253..914a568c98b9 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1874,7 +1874,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_software_single_step (gdbarch, sparc_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, sparc_software_single_step);
set_gdbarch_write_pc (gdbarch, sparc_write_pc);
set_gdbarch_dummy_id (gdbarch, sparc_dummy_id);
diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c
index 6d091f58d324..cb3ba6ba5358 100644
--- a/gdb/sparc64-sol2-tdep.c
+++ b/gdb/sparc64-sol2-tdep.c
@@ -221,7 +221,7 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->plt_entry_size = 16;
/* Solaris has kernel-assisted single-stepping support. */
- set_gdbarch_software_single_step (gdbarch, NULL);
+ set_gdbarch_get_next_pcs (gdbarch, NULL);
}
INIT_GDB_FILE (sparc64_sol2_tdep)
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 2ab8dacbf61a..56d309871ea2 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -1267,7 +1267,7 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
dwarf2_frame_set_init_reg (gdbarch, tic6x_dwarf2_frame_init_reg);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, tic6x_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, tic6x_software_single_step);
/* Call dummy code. */
set_gdbarch_frame_align (gdbarch, tic6x_frame_align);
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index abba50b9ce63..8f3924d5cad3 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -1173,7 +1173,7 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, z80_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan); // falling stack
- set_gdbarch_software_single_step (gdbarch, z80_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, z80_software_single_step);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, z80_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, z80_sw_breakpoint_from_kind);
set_gdbarch_insn_is_call (gdbarch, z80_insn_is_call);
base-commit: 713b99a9398cfe9ba7d96467afc600cf1f756bd2
--
2.50.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] gdb: rename gdbarch_software_single_step -> gdbarch_get_next_pcs
2025-08-14 20:14 [PATCH] gdb: rename gdbarch_software_single_step -> gdbarch_get_next_pcs Simon Marchi
@ 2025-08-16 3:09 ` Kevin Buettner
2025-08-18 23:24 ` Luis
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2025-08-16 3:09 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches, Simon Marchi
On Thu, 14 Aug 2025 16:14:17 -0400
Simon Marchi <simon.marchi@efficios.com> wrote:
> From: Simon Marchi <simon.marchi@efficios.com>
> To: gdb-patches@sourceware.org
> Cc: Simon Marchi <simon.marchi@polymtl.ca>
> Subject: [PATCH] gdb: rename gdbarch_software_single_step ->
> gdbarch_get_next_pcs Date: Thu, 14 Aug 2025 16:14:17 -0400
>
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> I spotted this while reviewing a patch adding a new
> gdbarch_software_single_step implementation. I find the name
> "software_single_step" a bit misleading or unclear. It makes it sounds
> as if the function executed a single step. In reality, this function
> returns the possible next PCs for current instructions.
>
> We have a similar concept in GDBserver:
> linux_process_target::low_get_next_pcs. I like that name, it's clear
> and straight to the point.
>
> Rename gdbarch_software_single_step to gdbarch_get_next_pcs. I find
> this name more indicative of what happens.
>
> There is some code for ARM shared between GDB and GDBserver to implement
> both sides, also called "get next pcs", so I think it all fits well
> together.
>
> Tested by rebuilding.
This one makes sense to me too.
Approved-by: Kevin Buettner <kevinb@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: rename gdbarch_software_single_step -> gdbarch_get_next_pcs
2025-08-16 3:09 ` Kevin Buettner
@ 2025-08-18 23:24 ` Luis
2025-08-19 13:48 ` Simon Marchi
0 siblings, 1 reply; 4+ messages in thread
From: Luis @ 2025-08-18 23:24 UTC (permalink / raw)
To: Kevin Buettner, Simon Marchi; +Cc: gdb-patches, Simon Marchi
On 8/16/25 04:09, Kevin Buettner wrote:
> On Thu, 14 Aug 2025 16:14:17 -0400
> Simon Marchi <simon.marchi@efficios.com> wrote:
>
>> From: Simon Marchi <simon.marchi@efficios.com>
>> To: gdb-patches@sourceware.org
>> Cc: Simon Marchi <simon.marchi@polymtl.ca>
>> Subject: [PATCH] gdb: rename gdbarch_software_single_step ->
>> gdbarch_get_next_pcs Date: Thu, 14 Aug 2025 16:14:17 -0400
>>
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>
>> I spotted this while reviewing a patch adding a new
>> gdbarch_software_single_step implementation. I find the name
>> "software_single_step" a bit misleading or unclear. It makes it sounds
>> as if the function executed a single step. In reality, this function
>> returns the possible next PCs for current instructions.
>>
>> We have a similar concept in GDBserver:
>> linux_process_target::low_get_next_pcs. I like that name, it's clear
>> and straight to the point.
>>
>> Rename gdbarch_software_single_step to gdbarch_get_next_pcs. I find
>> this name more indicative of what happens.
>>
>> There is some code for ARM shared between GDB and GDBserver to implement
>> both sides, also called "get next pcs", so I think it all fits well
>> together.
>>
>> Tested by rebuilding.
>
> This one makes sense to me too.
>
> Approved-by: Kevin Buettner <kevinb@redhat.com>
>
Agreed. The naming has confused me in the past as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: rename gdbarch_software_single_step -> gdbarch_get_next_pcs
2025-08-18 23:24 ` Luis
@ 2025-08-19 13:48 ` Simon Marchi
0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2025-08-19 13:48 UTC (permalink / raw)
To: Luis, Kevin Buettner; +Cc: gdb-patches, Simon Marchi
On 8/18/25 7:24 PM, Luis wrote:
> On 8/16/25 04:09, Kevin Buettner wrote:
>> On Thu, 14 Aug 2025 16:14:17 -0400
>> Simon Marchi <simon.marchi@efficios.com> wrote:
>>
>>> From: Simon Marchi <simon.marchi@efficios.com>
>>> To: gdb-patches@sourceware.org
>>> Cc: Simon Marchi <simon.marchi@polymtl.ca>
>>> Subject: [PATCH] gdb: rename gdbarch_software_single_step ->
>>> gdbarch_get_next_pcs Date: Thu, 14 Aug 2025 16:14:17 -0400
>>>
>>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>>
>>> I spotted this while reviewing a patch adding a new
>>> gdbarch_software_single_step implementation. I find the name
>>> "software_single_step" a bit misleading or unclear. It makes it sounds
>>> as if the function executed a single step. In reality, this function
>>> returns the possible next PCs for current instructions.
>>>
>>> We have a similar concept in GDBserver:
>>> linux_process_target::low_get_next_pcs. I like that name, it's clear
>>> and straight to the point.
>>>
>>> Rename gdbarch_software_single_step to gdbarch_get_next_pcs. I find
>>> this name more indicative of what happens.
>>>
>>> There is some code for ARM shared between GDB and GDBserver to implement
>>> both sides, also called "get next pcs", so I think it all fits well
>>> together.
>>>
>>> Tested by rebuilding.
>>
>> This one makes sense to me too.
>>
>> Approved-by: Kevin Buettner <kevinb@redhat.com>
>>
>
> Agreed. The naming has confused me in the past as well.
Thanks, it's nice to have two opinions that confirm my feeling. I
translated your (Luis') acknowledgement to an Acked-by and pushed the
patch.
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-19 13:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-14 20:14 [PATCH] gdb: rename gdbarch_software_single_step -> gdbarch_get_next_pcs Simon Marchi
2025-08-16 3:09 ` Kevin Buettner
2025-08-18 23:24 ` Luis
2025-08-19 13:48 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox