From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <pedro@palves.net>, Simon Marchi <simark@simark.ca>,
Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv3 0/3] AMD64 Displaced Stepping Fix
Date: Mon, 27 Mar 2023 13:32:18 +0100 [thread overview]
Message-ID: <cover.1679919937.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1678984664.git.aburgess@redhat.com>
In V3:
- Change of direction since v2. As Pedro pointed out, using the $pc
value to decide if the displaced step succeeded is not good
enough. This new version switches back to using the
target_waitstatus value.
- The target_waitstatus is examined, and the result (a bool) is
passed to each architecture's fixup routine.
- Just like in v2, each fixup routine is updated, with amd64 being
"fixed", while aarch64, ppc, and s390 (which aren't broken) just
have an early return case added to handle the unsuccessful
displaced step case.
- As with v2, ARM is left broken, though this is no more broken than
it was before this patch series.
- As Simon suggested, the debug has now moved to
displaced_step_prepare_throw, so the (not yet upstreamed)
displaced stepping for the AMD GPU target should still see the
debug output,
- The debug code now handles a failure to disassemble better:
there's nothing worse than enabling debug to try and solve a
problem, and having GDB crash in a different way. If an
instruction fails to disassemble GDB will now print a basic debug
message and skip the rest of the debug output,
- As suggested, I've moved the displaced_step_dump_bytes helper
function into gdbsupport/ and given it a better name,
- I have NOT tried to implement the improvement Simon suggested
where the architecture backend tells GDB core how many bytes the
replacement instruction(s) occupied. This still means that in
some cases we will disassemble the entire displaced step buffer
unnecessarily, but I don't see that as a huge problem. Fixing
this just to reduce some debug output a little seems excessive.
Let me know if you feel this is a blocker for this work being
merged and I can take another look at it.
Thanks,
Andrew
---
Andrew Burgess (3):
gdb: more debug output for displaced stepping
gdb: move displaced_step_dump_bytes into gdbsupport (and rename)
gdb: fix reg corruption from displaced stepping on amd64
gdb/aarch64-tdep.c | 17 ++-
gdb/aarch64-tdep.h | 2 +-
gdb/amd64-tdep.c | 29 +++--
gdb/amd64-tdep.h | 2 +-
gdb/arm-tdep.c | 26 ++++-
gdb/arm-tdep.h | 3 +-
gdb/displaced-stepping.c | 26 ++---
gdb/gdbarch-gen.h | 25 +++--
gdb/gdbarch.c | 4 +-
gdb/gdbarch_components.py | 22 +++-
gdb/i386-tdep.c | 26 ++---
gdb/i386-tdep.h | 2 +-
gdb/infrun.c | 101 +++++++++++------
gdb/infrun.h | 3 -
gdb/rs6000-tdep.c | 14 ++-
gdb/s390-tdep.c | 16 ++-
.../amd64-disp-step-self-call-alarm.c | 24 ++++
.../gdb.arch/amd64-disp-step-self-call.S | 50 +++++++++
.../gdb.arch/amd64-disp-step-self-call.exp | 81 +++++++++++++
.../gdb.arch/amd64-disp-step-signal.c | 30 +++++
gdb/testsuite/gdb.arch/amd64-disp-step.S | 15 +++
gdb/testsuite/gdb.arch/amd64-disp-step.exp | 106 +++++++++++++++---
.../gdb.arch/i386-disp-step-self-call-alarm.c | 24 ++++
.../gdb.arch/i386-disp-step-self-call.S | 50 +++++++++
.../gdb.arch/i386-disp-step-self-call.exp | 81 +++++++++++++
gdbsupport/array-view.h | 1 +
gdbsupport/common-utils.cc | 18 +++
gdbsupport/common-utils.h | 15 +++
28 files changed, 679 insertions(+), 134 deletions(-)
create mode 100644 gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c
create mode 100644 gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S
create mode 100644 gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
create mode 100644 gdb/testsuite/gdb.arch/amd64-disp-step-signal.c
create mode 100644 gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c
create mode 100644 gdb/testsuite/gdb.arch/i386-disp-step-self-call.S
create mode 100644 gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
base-commit: 1770eca698ad0018cd504b9744306fc9928d9a86
--
2.25.4
next prev parent reply other threads:[~2023-03-27 12:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 15:46 [PATCH " Andrew Burgess
2023-02-23 15:46 ` [PATCH 1/3] gdb: more debug output for displaced stepping Andrew Burgess
2023-02-23 15:46 ` [PATCH 2/3] gdb: remove gdbarch_displaced_step_fixup_p Andrew Burgess
2023-02-23 15:46 ` [PATCH 3/3] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-03-16 16:39 ` [PATCHv2 0/4] AMD64 Displaced Stepping Fix Andrew Burgess
2023-03-16 16:39 ` [PATCHv2 1/4] gdb: more debug output for displaced stepping Andrew Burgess
2023-03-21 12:29 ` Pedro Alves
2023-03-21 14:41 ` Simon Marchi
2023-03-22 21:17 ` [PATCHv2 0/2] displaced stepping debug improvements Andrew Burgess
2023-03-22 21:17 ` [PATCHv2 1/2] gdb: more debug output for displaced stepping Andrew Burgess
2023-03-22 21:17 ` [PATCHv2 2/2] gdb: move displaced_step_dump_bytes into gdbsupport (and rename) Andrew Burgess
2023-03-27 12:35 ` [PATCHv2 0/2] displaced stepping debug improvements Andrew Burgess
2023-03-21 14:45 ` [PATCHv2 1/4] gdb: more debug output for displaced stepping Simon Marchi
2023-03-16 16:39 ` [PATCHv2 2/4] gdb: remove gdbarch_displaced_step_fixup_p Andrew Burgess
2023-03-21 13:10 ` Pedro Alves
2023-03-22 21:22 ` Andrew Burgess
2023-03-16 16:39 ` [PATCHv2 3/4] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-03-21 13:23 ` Pedro Alves
2023-03-16 16:39 ` [PATCHv2 4/4] gdb: remove redundant signal passing Andrew Burgess
2023-03-27 12:32 ` Andrew Burgess [this message]
2023-03-27 12:32 ` [PATCHv3 1/3] gdb: more debug output for displaced stepping Andrew Burgess
2023-03-28 13:05 ` Simon Marchi
2023-03-28 15:08 ` Andrew Burgess
2023-03-28 15:11 ` Simon Marchi
2023-03-29 9:42 ` Andrew Burgess
2023-03-27 12:32 ` [PATCHv3 2/3] gdb: move displaced_step_dump_bytes into gdbsupport (and rename) Andrew Burgess
2023-03-28 13:10 ` Simon Marchi
2023-03-29 9:43 ` Andrew Burgess
2023-03-27 12:32 ` [PATCHv3 3/3] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-03-29 9:43 ` Pedro Alves
2023-03-28 12:33 ` [PATCHv3 0/3] AMD64 Displaced Stepping Fix Simon Marchi
2023-03-28 15:29 ` Andrew Burgess
2023-03-29 13:46 ` [PATCHv4] gdb: fix reg corruption from displaced stepping on amd64 Andrew Burgess
2023-04-04 13:03 ` Pedro Alves
2023-04-06 13:29 ` Andrew Burgess
2023-04-06 15:38 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1679919937.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).