wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 1 | #ifndef __KGDB_H__ |
| 2 | #define __KGDB_H__ |
| 3 | |
| 4 | #include <asm/ptrace.h> |
| 5 | |
| 6 | #define KGDBERR_BADPARAMS 1 |
| 7 | #define KGDBERR_NOTHEXDIG 2 |
| 8 | #define KGDBERR_MEMFAULT 3 |
| 9 | #define KGDBERR_NOSPACE 4 |
| 10 | #define KGDBERR_ALIGNFAULT 5 |
| 11 | |
| 12 | #define KGDBDATA_MAXREGS 8 |
| 13 | #define KGDBDATA_MAXPRIV 8 |
| 14 | |
| 15 | #define KGDBEXIT_TYPEMASK 0xff |
| 16 | |
| 17 | #define KGDBEXIT_KILL 0 |
| 18 | #define KGDBEXIT_CONTINUE 1 |
| 19 | #define KGDBEXIT_SINGLE 2 |
| 20 | |
| 21 | #define KGDBEXIT_WITHADDR 0x100 |
| 22 | |
| 23 | typedef |
| 24 | struct { |
| 25 | int num; |
| 26 | unsigned long val; |
| 27 | } |
| 28 | kgdb_reg; |
| 29 | |
| 30 | typedef |
| 31 | struct { |
| 32 | int sigval; |
| 33 | int extype; |
| 34 | unsigned long exaddr; |
| 35 | int nregs; |
| 36 | kgdb_reg regs[KGDBDATA_MAXREGS]; |
| 37 | unsigned long private[KGDBDATA_MAXPRIV]; |
| 38 | } |
| 39 | kgdb_data; |
| 40 | |
| 41 | /* these functions are provided by the generic kgdb support */ |
Ovidiu Panait | 78fc039 | 2022-01-01 19:13:27 +0200 | [diff] [blame] | 42 | /** |
| 43 | * kgdb_init() |
| 44 | * |
| 45 | * Perform initializations to allow debugging U-Boot with gdb over a serial |
| 46 | * link. It is called during the generic board init sequence. |
| 47 | * |
| 48 | * Return: 0 if OK |
| 49 | */ |
| 50 | int kgdb_init(void); |
| 51 | |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 52 | extern void kgdb_error(int); |
| 53 | extern int kgdb_output_string(const char *, unsigned int); |
| 54 | extern void breakpoint(void); |
| 55 | |
| 56 | /* these functions are provided by the platform specific kgdb support */ |
| 57 | extern void kgdb_flush_cache_range(void *, void *); |
| 58 | extern void kgdb_flush_cache_all(void); |
| 59 | extern int kgdb_setjmp(long *); |
| 60 | extern void kgdb_longjmp(long *, int); |
| 61 | extern void kgdb_enter(struct pt_regs *, kgdb_data *); |
| 62 | extern void kgdb_exit(struct pt_regs *, kgdb_data *); |
| 63 | extern int kgdb_getregs(struct pt_regs *, char *, int); |
| 64 | extern void kgdb_putreg(struct pt_regs *, int, char *, int); |
| 65 | extern void kgdb_putregs(struct pt_regs *, char *, int); |
| 66 | extern int kgdb_trap(struct pt_regs *); |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 67 | void kgdb_breakpoint(int argc, char *const argv[]); |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 68 | |
| 69 | /* these functions are provided by the platform serial driver */ |
| 70 | extern void kgdb_serial_init(void); |
| 71 | extern int getDebugChar(void); |
| 72 | extern void putDebugChar(int); |
| 73 | extern void putDebugStr(const char *); |
| 74 | extern void kgdb_interruptible(int); |
| 75 | |
| 76 | /* this is referenced in the trap handler for the platform */ |
| 77 | extern int (*debugger_exception_handler)(struct pt_regs *); |
| 78 | |
| 79 | #endif /* __KGDB_H__ */ |