aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-09-04 13:29:30 +0100
committerMichael Brown <mcb30@ipxe.org>2024-09-05 13:00:39 +0100
commit2b82007571dbe02b85338dc9fa85251cd5d68028 (patch)
treeb99584c83a74fbeb298c1ff4c13e2c89f5eaf41c
parent804f35cb5a6ac7d35912822372b74fd8856f850b (diff)
downloadipxe-2b82007571dbe02b85338dc9fa85251cd5d68028.tar.gz
[gdb] Allow CPU architectures to omit support for GDB
Move the <gdbmach.h> file to <bits/gdbmach.h>, and provide a common dummy implementation for all architectures that have not yet implemented support for GDB. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/arch/arm64/include/gdbmach.h45
-rw-r--r--src/arch/i386/include/bits/gdbmach.h (renamed from src/arch/i386/include/gdbmach.h)0
-rw-r--r--src/arch/loong64/include/gdbmach.h45
-rw-r--r--src/arch/x86/core/gdbmach.c1
-rw-r--r--src/arch/x86_64/include/bits/gdbmach.h (renamed from src/arch/x86_64/include/gdbmach.h)0
-rw-r--r--src/core/gdbstub.c1
-rw-r--r--src/include/bits/gdbmach.h (renamed from src/arch/arm32/include/gdbmach.h)12
-rw-r--r--src/include/ipxe/gdbstub.h2
8 files changed, 7 insertions, 99 deletions
diff --git a/src/arch/arm64/include/gdbmach.h b/src/arch/arm64/include/gdbmach.h
deleted file mode 100644
index cd152eedd..000000000
--- a/src/arch/arm64/include/gdbmach.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef GDBMACH_H
-#define GDBMACH_H
-
-/** @file
- *
- * GDB architecture specifics
- *
- * This file declares functions for manipulating the machine state and
- * debugging context.
- *
- */
-
-#include <stdint.h>
-
-typedef unsigned long gdbreg_t;
-
-/* Register snapshot */
-enum {
- /* Not yet implemented */
- GDBMACH_NREGS,
-};
-
-#define GDBMACH_SIZEOF_REGS ( GDBMACH_NREGS * sizeof ( gdbreg_t ) )
-
-static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
- /* Not yet implemented */
- ( void ) regs;
- ( void ) pc;
-}
-
-static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
- /* Not yet implemented */
- ( void ) regs;
- ( void ) step;
-}
-
-static inline void gdbmach_breakpoint ( void ) {
- /* Not yet implemented */
-}
-
-extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len,
- int enable );
-extern void gdbmach_init ( void );
-
-#endif /* GDBMACH_H */
diff --git a/src/arch/i386/include/gdbmach.h b/src/arch/i386/include/bits/gdbmach.h
index 52cce7833..52cce7833 100644
--- a/src/arch/i386/include/gdbmach.h
+++ b/src/arch/i386/include/bits/gdbmach.h
diff --git a/src/arch/loong64/include/gdbmach.h b/src/arch/loong64/include/gdbmach.h
deleted file mode 100644
index cd152eedd..000000000
--- a/src/arch/loong64/include/gdbmach.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef GDBMACH_H
-#define GDBMACH_H
-
-/** @file
- *
- * GDB architecture specifics
- *
- * This file declares functions for manipulating the machine state and
- * debugging context.
- *
- */
-
-#include <stdint.h>
-
-typedef unsigned long gdbreg_t;
-
-/* Register snapshot */
-enum {
- /* Not yet implemented */
- GDBMACH_NREGS,
-};
-
-#define GDBMACH_SIZEOF_REGS ( GDBMACH_NREGS * sizeof ( gdbreg_t ) )
-
-static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
- /* Not yet implemented */
- ( void ) regs;
- ( void ) pc;
-}
-
-static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
- /* Not yet implemented */
- ( void ) regs;
- ( void ) step;
-}
-
-static inline void gdbmach_breakpoint ( void ) {
- /* Not yet implemented */
-}
-
-extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len,
- int enable );
-extern void gdbmach_init ( void );
-
-#endif /* GDBMACH_H */
diff --git a/src/arch/x86/core/gdbmach.c b/src/arch/x86/core/gdbmach.c
index af6abfedd..d4d187e35 100644
--- a/src/arch/x86/core/gdbmach.c
+++ b/src/arch/x86/core/gdbmach.c
@@ -31,7 +31,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/uaccess.h>
#include <ipxe/gdbstub.h>
#include <librm.h>
-#include <gdbmach.h>
/** @file
*
diff --git a/src/arch/x86_64/include/gdbmach.h b/src/arch/x86_64/include/bits/gdbmach.h
index 367405fd6..367405fd6 100644
--- a/src/arch/x86_64/include/gdbmach.h
+++ b/src/arch/x86_64/include/bits/gdbmach.h
diff --git a/src/core/gdbstub.c b/src/core/gdbstub.c
index 8b57ddf56..d668f454a 100644
--- a/src/core/gdbstub.c
+++ b/src/core/gdbstub.c
@@ -36,7 +36,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ctype.h>
#include <byteswap.h>
#include <ipxe/gdbstub.h>
-#include "gdbmach.h"
enum {
POSIX_EINVAL = 0x1c, /* used to report bad arguments to GDB */
diff --git a/src/arch/arm32/include/gdbmach.h b/src/include/bits/gdbmach.h
index cd152eedd..7e349856f 100644
--- a/src/arch/arm32/include/gdbmach.h
+++ b/src/include/bits/gdbmach.h
@@ -1,12 +1,12 @@
-#ifndef GDBMACH_H
-#define GDBMACH_H
+#ifndef _BITS_GDBMACH_H
+#define _BITS_GDBMACH_H
/** @file
*
- * GDB architecture specifics
+ * Dummy GDB architecture specifics
*
- * This file declares functions for manipulating the machine state and
- * debugging context.
+ * This file is included only if the architecture does not provide its
+ * own version of this file.
*
*/
@@ -42,4 +42,4 @@ extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len,
int enable );
extern void gdbmach_init ( void );
-#endif /* GDBMACH_H */
+#endif /* _BITS_GDBMACH_H */
diff --git a/src/include/ipxe/gdbstub.h b/src/include/ipxe/gdbstub.h
index 13ca33ddb..2240cca42 100644
--- a/src/include/ipxe/gdbstub.h
+++ b/src/include/ipxe/gdbstub.h
@@ -11,7 +11,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/tables.h>
-#include <gdbmach.h>
+#include <bits/gdbmach.h>
/**
* A transport mechanism for the GDB protocol