diff options
| author | Paul Traina <pst@FreeBSD.org> | 1996-08-30 17:03:46 +0000 |
|---|---|---|
| committer | Paul Traina <pst@FreeBSD.org> | 1996-08-30 17:03:46 +0000 |
| commit | e1889269a7da430d7dc64cdd39377d396fb01b1f (patch) | |
| tree | a26b4a6d62ea569c1e8f57d5b8bc16760546ff68 | |
| parent | a48bd4907980df59f928acd3ee37ac95343bdca5 (diff) | |
Notes
| -rw-r--r-- | sys/amd64/amd64/amd64-gdbstub.c | 28 | ||||
| -rw-r--r-- | sys/amd64/amd64/db_interface.c | 18 | ||||
| -rw-r--r-- | sys/i386/i386/db_interface.c | 18 | ||||
| -rw-r--r-- | sys/i386/i386/i386-gdbstub.c | 28 |
4 files changed, 58 insertions, 34 deletions
diff --git a/sys/amd64/amd64/amd64-gdbstub.c b/sys/amd64/amd64/amd64-gdbstub.c index 41b72afaff3c..7ac17a07c6d3 100644 --- a/sys/amd64/amd64/amd64-gdbstub.c +++ b/sys/amd64/amd64/amd64-gdbstub.c @@ -90,23 +90,20 @@ * ****************************************************************************/ -#include <sys/types.h> +#include <sys/param.h> +#include <sys/systm.h> + +#include <machine/cons.h> + +#include <ddb/ddb.h> + #include <setjmp.h> -#include <stdio.h> -#include <string.h> -#include <machine/db_machdep.h> -#include <machine/trap.h> -#include <machine/psl.h> /************************************************************************/ void gdb_handle_exception (db_regs_t *, int, int); extern jmp_buf db_jmpbuf; -extern void db_read_bytes (vm_offset_t addr, int size, char *data); -extern void db_write_bytes (vm_offset_t addr, int size, char *data); -extern void siocnputc (dev_t, int c); -extern int siocngetc (dev_t); /************************************************************************/ /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ @@ -116,6 +113,10 @@ extern int siocngetc (dev_t); /* Create private copies of common functions used by the stub. This prevents nasty interactions between app code and the stub (for instance if user steps into strlen, etc..) */ +/* XXX this is fairly bogus. strlen() and strcpy() should be reentrant, + and are reentrant under FreeBSD. In any case, our versions should not + be named the same as the standard versions, so that the address `strlen' + is unambiguous... */ static int strlen (const char *s) @@ -137,17 +138,20 @@ strcpy (char *dst, const char *src) return retval; } +/* XXX sio always uses its major with minor 0 no matter what we specify. */ +#define REMOTE_DEV 0 + static int putDebugChar (int c) /* write a single character */ { - siocnputc (NULL, c); + siocnputc (REMOTE_DEV, c); return 1; } static int getDebugChar (void) /* read and return a single char */ { - return siocngetc (NULL); + return siocngetc (REMOTE_DEV); } static const char hexchars[]="0123456789abcdef"; diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c index 284d2e9d4529..7055d285a0db 100644 --- a/sys/amd64/amd64/db_interface.c +++ b/sys/amd64/amd64/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.20 1996/08/27 19:45:56 pst Exp $ + * $Id: db_interface.c,v 1.21 1996/08/28 17:49:33 pst Exp $ */ /* @@ -90,7 +90,15 @@ kdb_trap(type, code, regs) break; default: - db_printf("kernel: type %d trap, code=%x\n", type, code); + /* + * XXX this is almost useless now. In most cases, + * trap_fatal() has already printed a much more verbose + * message. However, it is dangerous to print things in + * trap_fatal() - printf() might be reentered and trap. + * The debugger should be given control first. + */ + if (ddb_mode) + db_printf("kernel: type %d trap, code=%x\n", type, code); if (db_nofault) { jmp_buf *no_fault = db_nofault; @@ -105,7 +113,7 @@ kdb_trap(type, code, regs) ddb_regs = *regs; /* - * Kernel mode - esp and ss not saved, so dummy them up + * If in kernel mode, esp and ss are not saved, so dummy them up. */ if (ISPL(regs->tf_cs) == 0) { ddb_regs.tf_esp = (int)®s->tf_esp; @@ -129,7 +137,7 @@ kdb_trap(type, code, regs) regs->tf_ebx = ddb_regs.tf_ebx; /* - * If in user mode, the saved ESP and SS were valid, restore them + * If in user mode, the saved ESP and SS were valid, restore them. */ if (ISPL(regs->tf_cs)) { regs->tf_esp = ddb_regs.tf_esp; @@ -192,7 +200,7 @@ db_write_bytes(addr, size, data) addr1 = trunc_page(addr + size - 1); - /* data crosses a page boundary */ + /* Map another page if the data crosses a page boundary. */ if (trunc_page(addr) != addr1) { ptep1 = pmap_pte(kernel_pmap, addr1); oldmap1 = *ptep1; diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 284d2e9d4529..7055d285a0db 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.20 1996/08/27 19:45:56 pst Exp $ + * $Id: db_interface.c,v 1.21 1996/08/28 17:49:33 pst Exp $ */ /* @@ -90,7 +90,15 @@ kdb_trap(type, code, regs) break; default: - db_printf("kernel: type %d trap, code=%x\n", type, code); + /* + * XXX this is almost useless now. In most cases, + * trap_fatal() has already printed a much more verbose + * message. However, it is dangerous to print things in + * trap_fatal() - printf() might be reentered and trap. + * The debugger should be given control first. + */ + if (ddb_mode) + db_printf("kernel: type %d trap, code=%x\n", type, code); if (db_nofault) { jmp_buf *no_fault = db_nofault; @@ -105,7 +113,7 @@ kdb_trap(type, code, regs) ddb_regs = *regs; /* - * Kernel mode - esp and ss not saved, so dummy them up + * If in kernel mode, esp and ss are not saved, so dummy them up. */ if (ISPL(regs->tf_cs) == 0) { ddb_regs.tf_esp = (int)®s->tf_esp; @@ -129,7 +137,7 @@ kdb_trap(type, code, regs) regs->tf_ebx = ddb_regs.tf_ebx; /* - * If in user mode, the saved ESP and SS were valid, restore them + * If in user mode, the saved ESP and SS were valid, restore them. */ if (ISPL(regs->tf_cs)) { regs->tf_esp = ddb_regs.tf_esp; @@ -192,7 +200,7 @@ db_write_bytes(addr, size, data) addr1 = trunc_page(addr + size - 1); - /* data crosses a page boundary */ + /* Map another page if the data crosses a page boundary. */ if (trunc_page(addr) != addr1) { ptep1 = pmap_pte(kernel_pmap, addr1); oldmap1 = *ptep1; diff --git a/sys/i386/i386/i386-gdbstub.c b/sys/i386/i386/i386-gdbstub.c index 41b72afaff3c..7ac17a07c6d3 100644 --- a/sys/i386/i386/i386-gdbstub.c +++ b/sys/i386/i386/i386-gdbstub.c @@ -90,23 +90,20 @@ * ****************************************************************************/ -#include <sys/types.h> +#include <sys/param.h> +#include <sys/systm.h> + +#include <machine/cons.h> + +#include <ddb/ddb.h> + #include <setjmp.h> -#include <stdio.h> -#include <string.h> -#include <machine/db_machdep.h> -#include <machine/trap.h> -#include <machine/psl.h> /************************************************************************/ void gdb_handle_exception (db_regs_t *, int, int); extern jmp_buf db_jmpbuf; -extern void db_read_bytes (vm_offset_t addr, int size, char *data); -extern void db_write_bytes (vm_offset_t addr, int size, char *data); -extern void siocnputc (dev_t, int c); -extern int siocngetc (dev_t); /************************************************************************/ /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ @@ -116,6 +113,10 @@ extern int siocngetc (dev_t); /* Create private copies of common functions used by the stub. This prevents nasty interactions between app code and the stub (for instance if user steps into strlen, etc..) */ +/* XXX this is fairly bogus. strlen() and strcpy() should be reentrant, + and are reentrant under FreeBSD. In any case, our versions should not + be named the same as the standard versions, so that the address `strlen' + is unambiguous... */ static int strlen (const char *s) @@ -137,17 +138,20 @@ strcpy (char *dst, const char *src) return retval; } +/* XXX sio always uses its major with minor 0 no matter what we specify. */ +#define REMOTE_DEV 0 + static int putDebugChar (int c) /* write a single character */ { - siocnputc (NULL, c); + siocnputc (REMOTE_DEV, c); return 1; } static int getDebugChar (void) /* read and return a single char */ { - return siocngetc (NULL); + return siocngetc (REMOTE_DEV); } static const char hexchars[]="0123456789abcdef"; |
