From 469014c2cde959fa2ff8648427da5d79587b93e3 Mon Sep 17 00:00:00 2001 From: pk Date: Tue, 7 Jan 2003 15:15:06 +0000 Subject: [PATCH] * Maintain a pointer to the cpu_info structure of the CPU being examined. * Force cpu_Debugger() to have a stack frame, so tracing can at least start off matching arguments and function calls correctly. --- sys/arch/sparc/include/db_machdep.h | 4 +++- sys/arch/sparc/sparc/db_interface.c | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/arch/sparc/include/db_machdep.h b/sys/arch/sparc/include/db_machdep.h index 778ee7aa242a..ee959d6dd188 100644 --- a/sys/arch/sparc/include/db_machdep.h +++ b/sys/arch/sparc/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.17 2001/11/09 06:52:24 thorpej Exp $ */ +/* $NetBSD: db_machdep.h,v 1.18 2003/01/07 15:15:06 pk Exp $ */ /* * Mach Operating System @@ -63,6 +63,8 @@ db_regs_t ddb_regs; /* register state */ #define DDB_FR (&ddb_regs.db_fr) #endif +extern struct cpu_info *ddb_cpuinfo; + #if defined(lint) #define PC_REGS(regs) ((regs)->db_tf.tf_pc) #else diff --git a/sys/arch/sparc/sparc/db_interface.c b/sys/arch/sparc/sparc/db_interface.c index c93bf254b0f2..239b56f5cd4a 100644 --- a/sys/arch/sparc/sparc/db_interface.c +++ b/sys/arch/sparc/sparc/db_interface.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.47 2002/12/23 00:42:37 pk Exp $ */ +/* $NetBSD: db_interface.c,v 1.48 2003/01/07 15:15:06 pk Exp $ */ /* * Mach Operating System @@ -111,10 +111,12 @@ db_write_bytes(addr, size, data) /* * Data and functions used by DDB only. */ + void cpu_Debugger() { asm("ta 0x81"); + sparc_noop(); /* Force this function to allocate a stack frame */ } static int nil; @@ -217,6 +219,9 @@ kdb_kbd_trap(tf) } } +/* struct cpu_info of CPU being investigated */ +struct cpu_info *ddb_cpuinfo; + #ifdef MULTIPROCESSOR #define NOCPU -1 @@ -311,6 +316,7 @@ kdb_trap(type, tf) } curcpu()->ci_ddb_regs = ddb_regp = &dbreg; #endif + ddb_cpuinfo = curcpu(); /* Should switch to kdb`s own stack here. */ @@ -530,6 +536,7 @@ db_cpu_cmd(addr, have_addr, count, modif) } db_printf("using cpu %ld", addr); ddb_regp = (void *)ci->ci_ddb_regs; + ddb_cpuinfo = ci; } #endif /* MULTIPROCESSOR */