Improvements from Bruce Evans
This commit is contained in:
parent
a48bd49079
commit
e1889269a7
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user