* [PATCH] gdb: PowerPC fix gdb.base/break-interp.exp
@ 2021-11-16 17:00 Carl Love
2021-11-18 11:44 ` Ulrich Weigand
0 siblings, 1 reply; 2+ messages in thread
From: Carl Love @ 2021-11-16 17:00 UTC (permalink / raw)
To: gdb-patches, Ulrich Weigand; +Cc: cel, Will Schmidt, Rogerio Alves
GDB maintainers:
The following patch fixes errors seen on PowerPC with the
gdb.base/break-interp.exp test as described below in the commit log.
The patch has been tested on the latest mainline branch. The patch
fixed the 8 PowerPC regression errors and does not introduce any new
failures.
Please let me know if the patch is acceptable for mainline.
Thanks.
Carl
----------------------------------------------------------
gdb: PowerPC fix gdb.base/break-interp.exp
This patch fixes eight test failures on PowerPC for the test
gdb.base/break-interp.exp. The patch adds a funtion and registers it to
setup the displaced stepping for ppc-linux platform. The patch moves the
struct ppc_inferior_data to the ppc-tdep.h include file to make it visible
to the ppc-linux-tdep.c and rs6000-tdep.c files. Additionally the function
get_ppc_per_inferior is made external in ppc-tdep.h to make it visible in
both files.
gdb/ppc-linux-tdep.c: New function ppc_linux_displaced_step_prepare. Set
set_gdbarch_displaced_step_prepare to
ppc_linux_displaced_step_prepare.
gdb/rs6000-tdep.c: Move struct ppc_inferior_data to gdb/ppc-tdep.h.
Make function get_ppc_per_inferior externally visible.
gdb/ppc-tdep.h: Add struct ppc_inferior_data decaration.
Add extern decaration for function get_ppc_per_inferior.
Tested on Power 10 ppc64le-linux with no regressions.
---
gdb/ppc-linux-tdep.c | 22 ++++++++++++++++++++++
gdb/ppc-tdep.h | 10 ++++++++++
gdb/rs6000-tdep.c | 10 +---------
3 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index e2e1b1ec1d4..5fe44679fe2 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 1e0754f7692..a1f99656857 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 4830ed22593..e7a9010422c 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);
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gdb: PowerPC fix gdb.base/break-interp.exp
2021-11-16 17:00 [PATCH] gdb: PowerPC fix gdb.base/break-interp.exp Carl Love
@ 2021-11-18 11:44 ` Ulrich Weigand
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Weigand @ 2021-11-18 11:44 UTC (permalink / raw)
To: Carl Love; +Cc: gdb-patches, Rogerio Alves, Will Schmidt
"Carl Love" <cel@us.ibm.com> wrote on 16.11.2021 18:00:17:
> gdb: PowerPC fix gdb.base/break-interp.exp
>
> This patch fixes eight test failures on PowerPC for the test
> gdb.base/break-interp.exp. The patch adds a funtion and registers it to
> setup the displaced stepping for ppc-linux platform. The patch moves the
> struct ppc_inferior_data to the ppc-tdep.h include file to make it
visible
> to the ppc-linux-tdep.c and rs6000-tdep.c files. Additionally the
function
> get_ppc_per_inferior is made external in ppc-tdep.h to make it visible in
> both files.
> gdb/ppc-linux-tdep.c: New function ppc_linux_displaced_step_prepare. Set
> set_gdbarch_displaced_step_prepare to
> ppc_linux_displaced_step_prepare.
>
> gdb/rs6000-tdep.c: Move struct ppc_inferior_data to gdb/ppc-tdep.h.
> Make function get_ppc_per_inferior externally visible.
>
> gdb/ppc-tdep.h: Add struct ppc_inferior_data decaration.
> Add extern decaration for function get_ppc_per_inferior.
We don't use ChangeLog-style logs in the commit message
any more, so the above lines aren't really necessary.
Otherwise, this is OK.
Thanks,
Ulrich
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-18 11:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 17:00 [PATCH] gdb: PowerPC fix gdb.base/break-interp.exp Carl Love
2021-11-18 11:44 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).