aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ppc-linux-tdep.c22
-rw-r--r--gdb/ppc-tdep.h10
-rw-r--r--gdb/rs6000-tdep.c10
3 files changed, 33 insertions, 9 deletions
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 6df2411..9e89542 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -2014,6 +2014,23 @@ ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
return "";
}
+static displaced_step_prepare_status
+ppc_linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
+ CORE_ADDR &displaced_pc)
+{
+ ppc_inferior_data *per_inferior = get_ppc_per_inferior (thread->inf);
+ if (!per_inferior->disp_step_buf.has_value ())
+ {
+ /* Figure out where the displaced step buffer is. */
+ CORE_ADDR disp_step_buf_addr
+ = linux_displaced_step_location (thread->inf->gdbarch);
+
+ per_inferior->disp_step_buf.emplace (disp_step_buf_addr);
+ }
+
+ return per_inferior->disp_step_buf->prepare (thread, displaced_pc);
+}
+
static void
ppc_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
@@ -2190,6 +2207,11 @@ ppc_linux_init_abi (struct gdbarch_info info,
ppc_init_linux_record_tdep (&ppc_linux_record_tdep, 4);
ppc_init_linux_record_tdep (&ppc64_linux_record_tdep, 8);
+
+ /* Setup displaced stepping. */
+ set_gdbarch_displaced_step_prepare (gdbarch,
+ ppc_linux_displaced_step_prepare);
+
}
void _initialize_ppc_linux_tdep ();
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index 6b305c4..cfd0aac 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -438,4 +438,14 @@ extern int ppc_process_record (struct gdbarch *gdbarch,
/* Estimate for the maximum number of instructions in a function epilogue. */
#define PPC_MAX_EPILOGUE_INSTRUCTIONS 52
+struct ppc_inferior_data
+{
+ /* This is an optional in case we add more fields to ppc_inferior_data, we
+ don't want it instantiated as soon as we get the ppc_inferior_data for an
+ inferior. */
+ gdb::optional<displaced_step_buffers> disp_step_buf;
+};
+
+extern ppc_inferior_data * get_ppc_per_inferior (inferior *inf);
+
#endif /* ppc-tdep.h */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 0d61894..87a494e 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -155,19 +155,11 @@ static const char *powerpc_vector_abi_string = "auto";
/* PowerPC-related per-inferior data. */
-struct ppc_inferior_data
-{
- /* This is an optional in case we add more fields to ppc_inferior_data, we
- don't want it instantiated as soon as we get the ppc_inferior_data for an
- inferior. */
- gdb::optional<displaced_step_buffers> disp_step_buf;
-};
-
static inferior_key<ppc_inferior_data> ppc_inferior_data_key;
/* Get the per-inferior PowerPC data for INF. */
-static ppc_inferior_data *
+ppc_inferior_data *
get_ppc_per_inferior (inferior *inf)
{
ppc_inferior_data *per_inf = ppc_inferior_data_key.get (inf);