From 45a0b8946847278eb6106b4662d39089527de426 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 2 Oct 1994 19:36:30 +0000 Subject: [PATCH] Avoid ddb getting a panic if the code-segment isn't the usual one... --- sys/amd64/include/db_machdep.h | 4 ++-- sys/ddb/db_trap.c | 19 +++++++++++-------- sys/i386/include/db_machdep.h | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/sys/amd64/include/db_machdep.h b/sys/amd64/include/db_machdep.h index 8145d3a48e17..310c43bbffb2 100644 --- a/sys/amd64/include/db_machdep.h +++ b/sys/amd64/include/db_machdep.h @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. * - * $Id: db_machdep.h,v 1.3 1993/11/07 17:42:50 wollman Exp $ + * $Id: db_machdep.h,v 1.4 1994/09/08 11:49:04 bde Exp $ */ #ifndef _I386_DB_MACHDEP_H_ @@ -55,7 +55,7 @@ typedef struct i386_saved_state db_regs_t; extern db_regs_t ddb_regs; /* register state */ #define DDB_REGS (&ddb_regs) -#define PC_REGS(regs) ((db_addr_t)(regs)->tf_eip) +#define PC_REGS(regs) ((regs)->tf_cs == 0x08 ? (db_addr_t)(regs)->tf_eip : 0) #define BKPT_INST 0xcc /* breakpoint instruction */ #define BKPT_SIZE (1) /* size of breakpoint inst */ diff --git a/sys/ddb/db_trap.c b/sys/ddb/db_trap.c index 8d2941ab5f88..bc65ed976242 100644 --- a/sys/ddb/db_trap.c +++ b/sys/ddb/db_trap.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_trap.c,v 1.4 1994/08/13 03:49:24 wollman Exp $ + * $Id: db_trap.c,v 1.5 1994/08/18 22:34:27 wollman Exp $ */ /* @@ -57,14 +57,17 @@ db_trap(type, code) db_printf("After %d instructions (%d loads, %d stores),\n", db_inst_count, db_load_count, db_store_count); } - if (bkpt) - db_printf("Breakpoint at\t"); - else if (watchpt) - db_printf("Watchpoint at\t"); - else - db_printf("Stopped at\t"); db_dot = PC_REGS(DDB_REGS); - db_print_loc_and_inst(db_dot); + if(db_dot) { + if (bkpt) + db_printf("Breakpoint at\t"); + else if (watchpt) + db_printf("Watchpoint at\t"); + else + db_printf("Stopped at\t"); + + db_print_loc_and_inst(db_dot); + } db_command_loop(); } diff --git a/sys/i386/include/db_machdep.h b/sys/i386/include/db_machdep.h index 8145d3a48e17..310c43bbffb2 100644 --- a/sys/i386/include/db_machdep.h +++ b/sys/i386/include/db_machdep.h @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. * - * $Id: db_machdep.h,v 1.3 1993/11/07 17:42:50 wollman Exp $ + * $Id: db_machdep.h,v 1.4 1994/09/08 11:49:04 bde Exp $ */ #ifndef _I386_DB_MACHDEP_H_ @@ -55,7 +55,7 @@ typedef struct i386_saved_state db_regs_t; extern db_regs_t ddb_regs; /* register state */ #define DDB_REGS (&ddb_regs) -#define PC_REGS(regs) ((db_addr_t)(regs)->tf_eip) +#define PC_REGS(regs) ((regs)->tf_cs == 0x08 ? (db_addr_t)(regs)->tf_eip : 0) #define BKPT_INST 0xcc /* breakpoint instruction */ #define BKPT_SIZE (1) /* size of breakpoint inst */