From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 06/24] target/arm: Drop checks for singlestep_enabled
Date: Sat, 16 Oct 2021 11:14:56 -0700 [thread overview]
Message-ID: <20211016181514.3165661-7-richard.henderson@linaro.org> (raw)
In-Reply-To: <20211016181514.3165661-1-richard.henderson@linaro.org>
GDB single-stepping is now handled generically.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate-a64.c | 10 ++--------
target/arm/translate.c | 36 ++++++------------------------------
2 files changed, 8 insertions(+), 38 deletions(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 717afd481c..cec672f229 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -404,8 +404,6 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
gen_a64_set_pc_im(dest);
if (s->ss_active) {
gen_step_complete_exception(s);
- } else if (s->base.singlestep_enabled) {
- gen_exception_internal(EXCP_DEBUG);
} else {
tcg_gen_lookup_and_goto_ptr();
s->base.is_jmp = DISAS_NORETURN;
@@ -14879,7 +14877,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
{
DisasContext *dc = container_of(dcbase, DisasContext, base);
- if (unlikely(dc->base.singlestep_enabled || dc->ss_active)) {
+ if (unlikely(dc->ss_active)) {
/* Note that this means single stepping WFI doesn't halt the CPU.
* For conditional branch insns this is harmless unreachable code as
* gen_goto_tb() has already handled emitting the debug exception
@@ -14891,11 +14889,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
/* fall through */
case DISAS_EXIT:
case DISAS_JUMP:
- if (dc->base.singlestep_enabled) {
- gen_exception_internal(EXCP_DEBUG);
- } else {
- gen_step_complete_exception(dc);
- }
+ gen_step_complete_exception(dc);
break;
case DISAS_NORETURN:
break;
diff --git a/target/arm/translate.c b/target/arm/translate.c
index f7086c66a5..d6af5b1b03 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -341,7 +341,7 @@ static void gen_exception_internal(int excp)
tcg_temp_free_i32(tcg_excp);
}
-static void gen_step_complete_exception(DisasContext *s)
+static void gen_singlestep_exception(DisasContext *s)
{
/* We just completed step of an insn. Move from Active-not-pending
* to Active-pending, and then also take the swstep exception.
@@ -357,30 +357,6 @@ static void gen_step_complete_exception(DisasContext *s)
s->base.is_jmp = DISAS_NORETURN;
}
-static void gen_singlestep_exception(DisasContext *s)
-{
- /* Generate the right kind of exception for singlestep, which is
- * either the architectural singlestep or EXCP_DEBUG for QEMU's
- * gdb singlestepping.
- */
- if (s->ss_active) {
- gen_step_complete_exception(s);
- } else {
- gen_exception_internal(EXCP_DEBUG);
- }
-}
-
-static inline bool is_singlestepping(DisasContext *s)
-{
- /* Return true if we are singlestepping either because of
- * architectural singlestep or QEMU gdbstub singlestep. This does
- * not include the command line '-singlestep' mode which is rather
- * misnamed as it only means "one instruction per TB" and doesn't
- * affect the code we generate.
- */
- return s->base.singlestep_enabled || s->ss_active;
-}
-
void clear_eci_state(DisasContext *s)
{
/*
@@ -837,7 +813,7 @@ static inline void gen_bx_excret_final_code(DisasContext *s)
/* Is the new PC value in the magic range indicating exception return? */
tcg_gen_brcondi_i32(TCG_COND_GEU, cpu_R[15], min_magic, excret_label);
/* No: end the TB as we would for a DISAS_JMP */
- if (is_singlestepping(s)) {
+ if (s->ss_active) {
gen_singlestep_exception(s);
} else {
tcg_gen_exit_tb(NULL, 0);
@@ -2606,7 +2582,7 @@ static void gen_goto_tb(DisasContext *s, int n, target_ulong dest)
/* Jump, specifying which TB number to use if we gen_goto_tb() */
static inline void gen_jmp_tb(DisasContext *s, uint32_t dest, int tbno)
{
- if (unlikely(is_singlestepping(s))) {
+ if (unlikely(s->ss_active)) {
/* An indirect jump so that we still trigger the debug exception. */
gen_set_pc_im(s, dest);
s->base.is_jmp = DISAS_JUMP;
@@ -9459,7 +9435,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
dc->page_start = dc->base.pc_first & TARGET_PAGE_MASK;
/* If architectural single step active, limit to 1. */
- if (is_singlestepping(dc)) {
+ if (dc->ss_active) {
dc->base.max_insns = 1;
}
@@ -9794,7 +9770,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
* insn codepath itself.
*/
gen_bx_excret_final_code(dc);
- } else if (unlikely(is_singlestepping(dc))) {
+ } else if (unlikely(dc->ss_active)) {
/* Unconditional and "condition passed" instruction codepath. */
switch (dc->base.is_jmp) {
case DISAS_SWI:
@@ -9889,7 +9865,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
/* "Condition failed" instruction codepath for the branch/trap insn */
gen_set_label(dc->condlabel);
gen_set_condexec(dc);
- if (unlikely(is_singlestepping(dc))) {
+ if (unlikely(dc->ss_active)) {
gen_set_pc_im(dc, dc->base.pc_next);
gen_singlestep_exception(dc);
} else {
--
2.25.1
next prev parent reply other threads:[~2021-10-16 18:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-16 18:14 [PULL 00/24] tcg patch queue Richard Henderson
2021-10-16 18:14 ` [PULL 01/24] accel/tcg: Handle gdb singlestep in cpu_tb_exec Richard Henderson
2021-10-16 18:14 ` [PULL 02/24] target/alpha: Drop checks for singlestep_enabled Richard Henderson
2021-10-16 18:14 ` [PULL 03/24] target/avr: " Richard Henderson
2021-10-16 18:14 ` [PULL 04/24] target/cris: " Richard Henderson
2021-10-16 18:14 ` [PULL 05/24] target/hexagon: " Richard Henderson
2021-10-16 18:14 ` Richard Henderson [this message]
2021-10-16 18:14 ` [PULL 07/24] target/hppa: " Richard Henderson
2021-10-16 18:14 ` [PULL 08/24] target/i386: Check CF_NO_GOTO_TB for dc->jmp_opt Richard Henderson
2021-10-16 18:14 ` [PULL 09/24] target/i386: Drop check for singlestep_enabled Richard Henderson
2021-10-16 18:15 ` [PULL 10/24] target/m68k: Drop checks " Richard Henderson
2021-10-16 18:15 ` [PULL 11/24] target/microblaze: Check CF_NO_GOTO_TB for DISAS_JUMP Richard Henderson
2021-10-16 18:15 ` [PULL 12/24] target/microblaze: Drop checks for singlestep_enabled Richard Henderson
2021-10-16 18:15 ` [PULL 13/24] target/mips: Fix single stepping Richard Henderson
2021-10-16 18:15 ` [PULL 14/24] target/mips: Drop exit checks for singlestep_enabled Richard Henderson
2021-10-16 18:15 ` [PULL 15/24] target/openrisc: Drop " Richard Henderson
2021-10-16 18:15 ` [PULL 16/24] target/ppc: Drop exit " Richard Henderson
2021-10-16 18:15 ` [PULL 17/24] target/riscv: Remove dead code after exception Richard Henderson
2021-10-16 18:15 ` [PULL 18/24] target/riscv: Remove exit_tb and lookup_and_goto_ptr Richard Henderson
2021-10-16 18:15 ` [PULL 19/24] target/rx: Drop checks for singlestep_enabled Richard Henderson
2021-10-16 18:15 ` [PULL 20/24] target/s390x: Drop check " Richard Henderson
2021-10-16 18:15 ` [PULL 21/24] target/sh4: " Richard Henderson
2021-10-16 18:15 ` [PULL 22/24] target/tricore: " Richard Henderson
2021-10-16 18:15 ` [PULL 23/24] target/xtensa: " Richard Henderson
2021-10-16 18:15 ` [PULL 24/24] Revert "cpu: Move cpu_common_props to hw/core/cpu.c" Richard Henderson
2021-10-16 23:49 ` [PULL 00/24] tcg patch queue Richard Henderson
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=20211016181514.3165661-7-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 NNTP newsgroup(s).