diff mbox series

[v3,11/24] gdbstub: rationalise signal mapping in softmmu

Message ID 20230221225227.3735319-12-alex.bennee@linaro.org
State Superseded
Headers show
Series gdbstub: re-organise to for better compilation behaviour | expand

Commit Message

Alex Bennée Feb. 21, 2023, 10:52 p.m. UTC
We don't really need a table for mapping two symbols.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
---
 gdbstub/softmmu.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Comments

Richard Henderson Feb. 22, 2023, 12:32 a.m. UTC | #1
On 2/21/23 12:52, Alex Bennée wrote:
> We don't really need a table for mapping two symbols.
> 
> Signed-off-by: Alex Bennée<alex.bennee@linaro.org>
> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> ---
>   gdbstub/softmmu.c | 19 +++++++------------
>   1 file changed, 7 insertions(+), 12 deletions(-)

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

r~
diff mbox series

Patch

diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c
index 864ecee38f..79674b8bea 100644
--- a/gdbstub/softmmu.c
+++ b/gdbstub/softmmu.c
@@ -499,21 +499,16 @@  enum {
     TARGET_SIGTRAP = 5
 };
 
-static int gdb_signal_table[] = {
-    -1,
-    -1,
-    TARGET_SIGINT,
-    -1,
-    -1,
-    TARGET_SIGTRAP
-};
-
 int gdb_signal_to_target (int sig)
 {
-    if (sig < ARRAY_SIZE (gdb_signal_table))
-        return gdb_signal_table[sig];
-    else
+    switch (sig) {
+    case 2:
+        return TARGET_SIGINT;
+    case 5:
+        return TARGET_SIGTRAP;
+    default:
         return -1;
+    }
 }
 
 /*