Skip to contentSkip to conversation

gdbstub: Have syscall_complete/[gs]et_reg to target agnostic typedefs

PATCH Applied Philippe Mathieu-Daudé 3 participants 4 messages Dec 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gdbstub: Have syscall_complete/[gs]et_reg to target agnostic typedefs

Prototypes using gdb_syscall_complete_cb() or gdb_?et_reg_cb() don't depend on "cpu.h", thus are not target-specific.

---
 include/exec/gdbstub.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
include/exec/gdbstub.h +4 -3
index f667014888..1636fb3841 100644
@@ -71,9 +71,6 @@ struct gdb_timeval {
   uint64_t tv_usec;   /* microsecond */
 } QEMU_PACKED;
 
-#ifdef NEED_CPU_H
-#include "cpu.h"
-
 typedef void (*gdb_syscall_complete_cb)(CPUState *cpu, uint64_t ret, int err);
 
 /**
@@ -126,6 +123,7 @@ int gdb_handlesig(CPUState *, int);
 void gdb_signalled(CPUArchState *, int);
 void gdbserver_fork(CPUState *);
 #endif
+
 /* Get or set a register.  Returns the size of the register.  */
 typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg);
 typedef int (*gdb_set_reg_cb)(CPUArchState *env, uint8_t *buf, int reg);
@@ -133,6 +131,9 @@ void gdb_register_coprocessor(CPUState *cpu,
                               gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg,
                               int num_regs, const char *xml, int g_pos);
 
+#ifdef NEED_CPU_H
+#include "cpu.h"
+
 /*
  * The GDB remote protocol transfers values in target byte order. As
  * the gdbstub may be batching up several register values we always
Signature · 1 line
2.38.1
#1 lore raw
Quoted 7 lines · Philippe Mathieu-Daudé

Prototypes using gdb_syscall_complete_cb() or gdb_?et_reg_cb() don't depend on "cpu.h", thus are not target-specific.

---
  include/exec/gdbstub.h | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

Subject should be:
"gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs"

Quoted 32 lines
include/exec/gdbstub.h +4 -3
index f667014888..1636fb3841 100644
@@ -71,9 +71,6 @@ struct gdb_timeval {
    uint64_t tv_usec;   /* microsecond */
  } QEMU_PACKED;
 
-#ifdef NEED_CPU_H
-#include "cpu.h"
-
  typedef void (*gdb_syscall_complete_cb)(CPUState *cpu, uint64_t ret, int err);
 
  /**
@@ -126,6 +123,7 @@ int gdb_handlesig(CPUState *, int);
  void gdb_signalled(CPUArchState *, int);
  void gdbserver_fork(CPUState *);
  #endif
+
  /* Get or set a register.  Returns the size of the register.  */
  typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg);
  typedef int (*gdb_set_reg_cb)(CPUArchState *env, uint8_t *buf, int reg);
@@ -133,6 +131,9 @@ void gdb_register_coprocessor(CPUState *cpu,
                                gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg,
                                int num_regs, const char *xml, int g_pos);
 
+#ifdef NEED_CPU_H
+#include "cpu.h"
+
  /*
   * The GDB remote protocol transfers values in target byte order. As
   * the gdbstub may be batching up several register values we always
Reviewed-by
#2 lore raw
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Prototypes using gdb_syscall_complete_cb() or gdb_?et_reg_cb() don't depend on "cpu.h", thus are not target-specific.

---
  include/exec/gdbstub.h | 7 ++++---

  1 file changed, 4 insertions(+), 3 deletions(-)

Subject should be:
"gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs"

r~

Applied
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

Prototypes using gdb_syscall_complete_cb() or gdb_?et_reg_cb() don't depend on "cpu.h", thus are not target-specific.

---
  include/exec/gdbstub.h | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

Subject should be:
"gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs"

Queued to gdbstub/next, thanks.

Quoted 30 lines
Quoted 30 lines
include/exec/gdbstub.h +3 -2
index f667014888..1636fb3841 100644
@@ -71,9 +71,6 @@ struct gdb_timeval {
    uint64_t tv_usec;   /* microsecond */
  } QEMU_PACKED;
  -#ifdef NEED_CPU_H
-#include "cpu.h"
-
  typedef void (*gdb_syscall_complete_cb)(CPUState *cpu, uint64_t ret, int err);
    /**
@@ -126,6 +123,7 @@ int gdb_handlesig(CPUState *, int);
  void gdb_signalled(CPUArchState *, int);
  void gdbserver_fork(CPUState *);
  #endif
+
  /* Get or set a register.  Returns the size of the register.  */
  typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg);
  typedef int (*gdb_set_reg_cb)(CPUArchState *env, uint8_t *buf, int reg);
@@ -133,6 +131,9 @@ void gdb_register_coprocessor(CPUState *cpu,
                                gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg,
                                int num_regs, const char *xml, int g_pos);
  +#ifdef NEED_CPU_H
+#include "cpu.h"
+
  /*
   * The GDB remote protocol transfers values in target byte order. As
   * the gdbstub may be batching up several register values we always
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro