diff mbox series

[v5,4/6] x86/gdbstub: Clean up includes

Message ID 20220420141307.24153-5-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series Clean up common/arch split for debugger.h | expand

Commit Message

Andrew Cooper April 20, 2022, 2:13 p.m. UTC
common/gdbstub.c wants struct gdb_context but only gets it transitively
through asm/debugger.h.  None of */gdbstub.c should include asm/debugger.h so
include xen/gdbstub.h instead.

Forward declare struct cpu_user_regs in xen/gdbstub.h so it doesn't depend on
the include order to compile.

x86/setup.c doesn't need xen/gdbstub.h at all, so drop it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>

v5:
 * New
---
 xen/arch/x86/gdbstub.c        | 5 ++++-
 xen/arch/x86/setup.c          | 1 -
 xen/arch/x86/x86_64/gdbstub.c | 2 +-
 xen/common/gdbstub.c          | 3 ++-
 xen/include/xen/gdbstub.h     | 2 ++
 5 files changed, 9 insertions(+), 4 deletions(-)

Comments

Jan Beulich April 21, 2022, 1:09 p.m. UTC | #1
On 20.04.2022 16:13, Andrew Cooper wrote:
> common/gdbstub.c wants struct gdb_context but only gets it transitively
> through asm/debugger.h.  None of */gdbstub.c should include asm/debugger.h so
> include xen/gdbstub.h instead.
> 
> Forward declare struct cpu_user_regs in xen/gdbstub.h so it doesn't depend on
> the include order to compile.
> 
> x86/setup.c doesn't need xen/gdbstub.h at all, so drop it.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/arch/x86/gdbstub.c b/xen/arch/x86/gdbstub.c
index 8f4f49fd3b54..961cae0be74f 100644
--- a/xen/arch/x86/gdbstub.c
+++ b/xen/arch/x86/gdbstub.c
@@ -18,7 +18,10 @@ 
  * You should have received a copy of the GNU General Public License
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
-#include <asm/debugger.h>
+#include <asm/uaccess.h>
+#include <asm/x86-defns.h>
+
+#include <xen/gdbstub.h>
 
 u16
 gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6f20e178929f..53a73010e029 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -15,7 +15,6 @@ 
 #include <xen/multiboot.h>
 #include <xen/domain_page.h>
 #include <xen/version.h>
-#include <xen/gdbstub.h>
 #include <xen/hypercall.h>
 #include <xen/keyhandler.h>
 #include <xen/numa.h>
diff --git a/xen/arch/x86/x86_64/gdbstub.c b/xen/arch/x86/x86_64/gdbstub.c
index 2626519c89c7..8287124dfb1d 100644
--- a/xen/arch/x86/x86_64/gdbstub.c
+++ b/xen/arch/x86/x86_64/gdbstub.c
@@ -17,7 +17,7 @@ 
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <asm/debugger.h>
+#include <xen/gdbstub.h>
 
 #define GDB_REG64(r) gdb_write_to_packet_hex(r, sizeof(u64), ctx)
 #define GDB_REG32(r)  gdb_write_to_packet_hex(r, sizeof(u32), ctx)
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c
index d6872721dc0d..df8d122bce8d 100644
--- a/xen/common/gdbstub.c
+++ b/xen/common/gdbstub.c
@@ -38,13 +38,14 @@ 
 #include <xen/serial.h>
 #include <xen/irq.h>
 #include <xen/watchdog.h>
-#include <asm/debugger.h>
 #include <xen/init.h>
 #include <xen/param.h>
 #include <xen/smp.h>
 #include <xen/console.h>
 #include <xen/errno.h>
 #include <xen/delay.h>
+#include <xen/gdbstub.h>
+
 #include <asm/byteorder.h>
 
 /* Printk isn't particularly safe just after we've trapped to the
diff --git a/xen/include/xen/gdbstub.h b/xen/include/xen/gdbstub.h
index 0b2041095d88..18c960969b76 100644
--- a/xen/include/xen/gdbstub.h
+++ b/xen/include/xen/gdbstub.h
@@ -25,6 +25,8 @@ 
 
 #ifdef CONFIG_CRASH_DEBUG
 
+struct cpu_user_regs;
+
 struct gdb_context {
     int                 serhnd;           /* handle on our serial line */
     int                 console_steal_id; /* handle on stolen console */