diff mbox series

[v1,7/8] gdbstub: tidy away reverse debugging check into function

Message ID 20210520174303.12310-8-alex.bennee@linaro.org
State Superseded
Headers show
Series various misc fixes (gitlab, gdbstub, plugins) | expand

Commit Message

Alex Bennée May 20, 2021, 5:43 p.m. UTC
In theory we don't need an actual record/replay to enact reverse
debugging on a purely deterministic system (i.e one with no external
inputs running under icount). Tidy away the logic into a little
function.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 gdbstub.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Richard Henderson May 24, 2021, 9:08 p.m. UTC | #1
On 5/20/21 10:43 AM, Alex Bennée wrote:
> In theory we don't need an actual record/replay to enact reverse

> debugging on a purely deterministic system (i.e one with no external

> inputs running under icount). Tidy away the logic into a little

> function.

> 

> Signed-off-by: Alex Bennée<alex.bennee@linaro.org>

> ---

>   gdbstub.c | 13 +++++++++++--

>   1 file changed, 11 insertions(+), 2 deletions(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
Philippe Mathieu-Daudé May 25, 2021, 3:57 a.m. UTC | #2
Hi Alex,

On 5/20/21 7:43 PM, Alex Bennée wrote:
> In theory we don't need an actual record/replay to enact reverse

> debugging on a purely deterministic system (i.e one with no external

> inputs running under icount). Tidy away the logic into a little

> function.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  gdbstub.c | 13 +++++++++++--

>  1 file changed, 11 insertions(+), 2 deletions(-)

> 

> diff --git a/gdbstub.c b/gdbstub.c

> index 84ce770a04..52bde5bdc9 100644

> --- a/gdbstub.c

> +++ b/gdbstub.c

> @@ -465,6 +465,15 @@ int use_gdb_syscalls(void)

>      return gdb_syscall_mode == GDB_SYS_ENABLED;

>  }

>  

> +static bool stub_can_reverse(void)


Do you mind renaming it gdbstub_can_reverse()?

Otherwise:

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/gdbstub.c b/gdbstub.c
index 84ce770a04..52bde5bdc9 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -465,6 +465,15 @@  int use_gdb_syscalls(void)
     return gdb_syscall_mode == GDB_SYS_ENABLED;
 }
 
+static bool stub_can_reverse(void)
+{
+#ifdef CONFIG_USER_ONLY
+    return false;
+#else
+    return replay_mode == REPLAY_MODE_PLAY;
+#endif
+}
+
 /* Resume execution.  */
 static inline void gdb_continue(void)
 {
@@ -1880,7 +1889,7 @@  static void handle_step(GArray *params, void *user_ctx)
 
 static void handle_backward(GArray *params, void *user_ctx)
 {
-    if (replay_mode != REPLAY_MODE_PLAY) {
+    if (!stub_can_reverse()) {
         put_packet("E22");
     }
     if (params->len == 1) {
@@ -2153,7 +2162,7 @@  static void handle_query_supported(GArray *params, void *user_ctx)
         g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+");
     }
 
-    if (replay_mode == REPLAY_MODE_PLAY) {
+    if (stub_can_reverse()) {
         g_string_append(gdbserver_state.str_buf,
             ";ReverseStep+;ReverseContinue+");
     }