From owner-p4-projects@FreeBSD.ORG Wed Mar 10 00:01:08 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0F35A16A4D3; Wed, 10 Mar 2004 00:01:08 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B6BCC16A4CF for ; Wed, 10 Mar 2004 00:01:07 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F60243D31 for ; Wed, 10 Mar 2004 00:01:07 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i2A817Ge071876 for ; Wed, 10 Mar 2004 00:01:07 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i2A810eC071863 for perforce@freebsd.org; Wed, 10 Mar 2004 00:01:00 -0800 (PST) (envelope-from marcel@freebsd.org) Date: Wed, 10 Mar 2004 00:01:00 -0800 (PST) Message-Id: <200403100801.i2A810eC071863@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 48556 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2004 08:01:08 -0000 http://perforce.freebsd.org/chv.cgi?CH=48556 Change 48556 by marcel@marcel_nfs on 2004/03/10 00:00:12 Revamp the kernel debugger support. There's a non-optional front-end which constitutes the interface. Behind it are the debugger back-ends. The back-ends, currently only DDB and GDB, are optional and selectable at runtime. This commit replaces Debugger() and backtrace() references with kdb_enter() and kdb_backtrace() respectively. Where appropriate, is included. Note that most #ifdef DDB instances have to be replaced with #ifdef DEBUG, because DDB is specific to a single back-end, not to having debugging support in general. A new option, GDB, has been added to add support for gdb. This has to be worked-out still. More to come... Affected files ... .. //depot/projects/gdb/sys/alpha/alpha/db_interface.c#2 edit .. //depot/projects/gdb/sys/alpha/alpha/machdep.c#3 edit .. //depot/projects/gdb/sys/alpha/tlsb/zs_tlsb.c#3 edit .. //depot/projects/gdb/sys/amd64/amd64/db_interface.c#3 edit .. //depot/projects/gdb/sys/amd64/amd64/machdep.c#5 edit .. //depot/projects/gdb/sys/cam/scsi/scsi_low.h#2 edit .. //depot/projects/gdb/sys/compat/ndis/subr_ntoskrnl.c#4 edit .. //depot/projects/gdb/sys/conf/NOTES#5 edit .. //depot/projects/gdb/sys/conf/files#5 edit .. //depot/projects/gdb/sys/conf/files.alpha#2 edit .. //depot/projects/gdb/sys/conf/files.amd64#4 edit .. //depot/projects/gdb/sys/conf/files.i386#4 edit .. //depot/projects/gdb/sys/conf/files.ia64#2 edit .. //depot/projects/gdb/sys/conf/files.pc98#4 edit .. //depot/projects/gdb/sys/conf/options#5 edit .. //depot/projects/gdb/sys/ddb/db_elf.c#2 edit .. //depot/projects/gdb/sys/ddb/db_kld.c#2 edit .. //depot/projects/gdb/sys/ddb/ddb.h#2 edit .. //depot/projects/gdb/sys/dev/acpica/Osd/OsdDebug.c#2 edit .. //depot/projects/gdb/sys/dev/en/midway.c#3 edit .. //depot/projects/gdb/sys/dev/syscons/syscons.c#4 edit .. //depot/projects/gdb/sys/dev/vinum/vinumhdr.h#2 edit .. //depot/projects/gdb/sys/dev/vinum/vinuminterrupt.c#2 edit .. //depot/projects/gdb/sys/dev/vinum/vinumioctl.c#2 edit .. //depot/projects/gdb/sys/dev/vinum/vinummemory.c#2 edit .. //depot/projects/gdb/sys/fs/devfs/devfs_devs.c#3 edit .. //depot/projects/gdb/sys/fs/nullfs/null_vfsops.c#2 edit .. //depot/projects/gdb/sys/fs/smbfs/smbfs_node.c#3 edit .. //depot/projects/gdb/sys/i386/i386/db_interface.c#3 edit .. //depot/projects/gdb/sys/i386/i386/machdep.c#3 edit .. //depot/projects/gdb/sys/i386/i386/trap.c#3 edit .. //depot/projects/gdb/sys/i386/include/frame.h#2 edit .. //depot/projects/gdb/sys/i386/isa/pcvt/pcvt_hdr.h#3 edit .. //depot/projects/gdb/sys/i386/isa/pcvt/pcvt_kbd.c#2 edit .. //depot/projects/gdb/sys/ia64/ia64/db_interface.c#2 edit .. //depot/projects/gdb/sys/ia64/ia64/machdep.c#3 edit .. //depot/projects/gdb/sys/kern/kern_clock.c#3 edit .. //depot/projects/gdb/sys/kern/kern_malloc.c#3 edit .. //depot/projects/gdb/sys/kern/kern_shutdown.c#3 edit .. //depot/projects/gdb/sys/kern/kern_switch.c#3 edit .. //depot/projects/gdb/sys/kern/sched_ule.c#4 edit .. //depot/projects/gdb/sys/kern/subr_kdb.c#1 add .. //depot/projects/gdb/sys/kern/subr_mbuf.c#2 edit .. //depot/projects/gdb/sys/kern/subr_witness.c#4 edit .. //depot/projects/gdb/sys/kern/vfs_subr.c#3 edit .. //depot/projects/gdb/sys/kern/vfs_vnops.c#2 edit .. //depot/projects/gdb/sys/netgraph/ng_base.c#3 edit .. //depot/projects/gdb/sys/netgraph/ng_socket.c#3 edit .. //depot/projects/gdb/sys/pc98/i386/machdep.c#2 edit .. //depot/projects/gdb/sys/pci/ncr.c#2 edit .. //depot/projects/gdb/sys/powerpc/powermac/pswitch.c#2 edit .. //depot/projects/gdb/sys/powerpc/powerpc/db_interface.c#2 edit .. //depot/projects/gdb/sys/powerpc/powerpc/machdep.c#4 edit .. //depot/projects/gdb/sys/security/mac_test/mac_test.c#4 edit .. //depot/projects/gdb/sys/sparc64/pci/psycho.c#2 edit .. //depot/projects/gdb/sys/sparc64/sparc64/machdep.c#2 edit .. //depot/projects/gdb/sys/sparc64/sparc64/trap.c#2 edit .. //depot/projects/gdb/sys/sys/kdb.h#1 add .. //depot/projects/gdb/sys/sys/systm.h#4 edit .. //depot/projects/gdb/sys/ufs/ffs/ffs_softdep.c#3 edit .. //depot/projects/gdb/sys/vm/uma_core.c#4 edit Differences ... ==== //depot/projects/gdb/sys/alpha/alpha/db_interface.c#2 (text+ko) ==== @@ -156,7 +156,7 @@ /* * Don't bother checking for usermode, since a benign entry - * by the kernel (call to Debugger() or a breakpoint) has + * by the kernel (call to kdb_enter() or a breakpoint) has * already checked for usermode. If neither of those * conditions exist, something Bad has happened. */ @@ -267,17 +267,6 @@ db_nofault = 0; } -void -Debugger(const char* msg) -{ - u_int saveintr; - - printf("%s\n", msg); - saveintr = alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH); - __asm("call_pal 0x81"); /* XXX bugchk */ - alpha_pal_swpipl(saveintr); -} - /* * Alpha-specific ddb commands: * ==== //depot/projects/gdb/sys/alpha/alpha/machdep.c#3 (text+ko) ==== @@ -2226,14 +2226,6 @@ return (0); } -#ifndef DDB -void -Debugger(const char *msg) -{ - printf("Debugger(\"%s\") called.\n", msg); -} -#endif /* no DDB */ - static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS) { ==== //depot/projects/gdb/sys/alpha/tlsb/zs_tlsb.c#3 (text+ko) ==== @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -524,9 +525,9 @@ while (zs_get_status(base, 0) & 1) { c = zs_get_data(base, 0); -#ifdef DDB +#ifdef DEBUG if (c == CTRL('\\')) - Debugger("manual escape to debugger"); + kdb_enter("manual escape to debugger"); #endif if (tp && (tp->t_state & TS_ISOPEN)) (*linesw[tp->t_line].l_rint)(c, tp); @@ -539,9 +540,9 @@ while (zs_get_status(base, 1) & 1) { c = zs_get_data(base, 1); -#ifdef DDB +#ifdef DEBUG if (c == CTRL('\\')) - Debugger("manual escape to debugger"); + kdb_enter("manual escape to debugger"); #endif if (tp && (tp->t_state & TS_ISOPEN)) (*linesw[tp->t_line].l_rint)(c, tp); ==== //depot/projects/gdb/sys/amd64/amd64/db_interface.c#3 (text+ko) ==== @@ -311,32 +311,6 @@ } } -/* - * XXX - * Move this to machdep.c and allow it to be called if any debugger is - * installed. - */ -void -Debugger(const char *msg) -{ - static volatile u_int in_Debugger; - - /* - * XXX - * Do nothing if the console is in graphics mode. This is - * OK if the call is for the debugger hotkey but not if the call - * is a weak form of panicing. - */ - if (cnunavailable() != 0 && !(boothowto & RB_GDB)) - return; - - if (atomic_cmpset_acq_int(&in_Debugger, 0, 1)) { - db_printf("Debugger(\"%s\")\n", msg); - breakpoint(); - atomic_store_rel_int(&in_Debugger, 0); - } -} - void db_show_mdpcpu(struct pcpu *pc) { ==== //depot/projects/gdb/sys/amd64/amd64/machdep.c#5 (text+ko) ==== @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -1213,10 +1214,11 @@ atpic_startup(); #endif -#ifdef DDB kdb_init(); + +#ifdef DEBUG if (boothowto & RB_KDB) - Debugger("Boot flags requested debugger"); + kdb_enter("Boot flags requested debugger"); #endif identify_cpu(); /* Final stage of CPU initialization */ @@ -1772,14 +1774,6 @@ return 0; } -#ifndef DDB -void -Debugger(const char *msg) -{ - printf("Debugger(\"%s\") called.\n", msg); -} -#endif /* no DDB */ - #ifdef DDB /* ==== //depot/projects/gdb/sys/cam/scsi/scsi_low.h#2 (text+ko) ==== @@ -66,6 +66,7 @@ #ifdef __FreeBSD__ #include +#include #include #include #include @@ -86,7 +87,7 @@ #ifdef __FreeBSD__ #undef MSG_IDENTIFY -#define SCSI_LOW_DEBUGGER(dev) Debugger((dev)) +#define SCSI_LOW_DEBUGGER(dev) kdb_enter(dev) #define SCSI_LOW_DELAY(mu) DELAY((mu)) #define SCSI_LOW_SPLSCSI splcam #define SCSI_LOW_BZERO(pt, size) bzero((pt), (size)) ==== //depot/projects/gdb/sys/compat/ndis/subr_ntoskrnl.c#4 (text+ko) ==== @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -1643,8 +1644,8 @@ __stdcall static void ntoskrnl_debugger(void) { - Debugger("ntoskrnl_debugger(): breakpoint"); - return; + + kdb_enter("ntoskrnl_debugger(): breakpoint"); } static void ==== //depot/projects/gdb/sys/conf/NOTES#5 (text+ko) ==== @@ -179,13 +179,13 @@ # MUTEX_DEBUG enables various extra assertions in the mutex code. # WITNESS enables the witness code which detects deadlocks and cycles # during locking operations. -# WITNESS_DDB causes the witness code to drop into the kernel debugger if +# WITNESS_KDB causes the witness code to drop into the kernel debugger if # a lock heirarchy violation occurs or if locks are held when going to # sleep. # WITNESS_SKIPSPIN disables the witness checks on spin mutexes. options MUTEX_DEBUG options WITNESS -options WITNESS_DDB +options WITNESS_KDB options WITNESS_SKIPSPIN # MUTEX_PROFILING - Profiling mutual exclusion locks (mutexes). See @@ -229,7 +229,19 @@ # DEBUGGING OPTIONS # -# Enable the kernel debugger. +# Print a stack trace of the current thread on the console for a panic. +# +options KDB_TRACE + +# +# Don't enter the debugger for a panic. Intended for unattended operation +# where you may want to enter the debugger from the console, but still want +# the machine to recover from a panic. +# +options KDB_UNATTENDED + +# +# Enable the ddb debugger backend. # options DDB @@ -248,25 +260,9 @@ options DDB_NUMSYM # -# Print a stack trace of the current thread out on the console for a panic. +# Enable the remote gdb debugger backend. # -options DDB_TRACE - -# -# Don't drop into DDB for a panic. Intended for unattended operation -# where you may want to drop to DDB from the console, but still want -# the machine to recover from a panic -# -options DDB_UNATTENDED - -# -# If using GDB remote mode to debug the kernel, there's a non-standard -# extension to the remote protocol that can be used to use the serial -# port as both the debugging port and the system console. It's non- -# standard and you're on your own if you enable it. See also the -# "remotechat" variables in the FreeBSD specific version of gdb. -# -options GDB_REMOTE_CHAT +options GDB # # KTRACE enables the system-call tracing facility ktrace(2). To be more @@ -1143,7 +1139,7 @@ options SC_ALT_MOUSE_IMAGE # simplified mouse cursor in text mode options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp850 -options SC_DISABLE_DDBKEY # disable `debug' key +options SC_DISABLE_KDBKEY # disable `debug' key options SC_DISABLE_REBOOT # disable reboot key sequence options SC_HISTORY_SIZE=200 # number of history buffer lines options SC_MOUSE_CHAR=0x3 # char code for text mode mouse cursor ==== //depot/projects/gdb/sys/conf/files#5 (text+ko) ==== @@ -238,7 +238,6 @@ ddb/db_ps.c optional ddb ddb/db_run.c optional ddb ddb/db_sym.c optional ddb -ddb/db_sysctl.c optional ddb ddb/db_trap.c optional ddb ddb/db_variables.c optional ddb ddb/db_watch.c optional ddb @@ -1142,6 +1141,7 @@ kern/subr_disk.c standard kern/subr_eventhandler.c standard kern/subr_hints.c standard +kern/subr_kdb.c standard kern/subr_kobj.c standard kern/subr_log.c standard kern/subr_mbpool.c optional libmbpool ==== //depot/projects/gdb/sys/conf/files.alpha#2 (text+ko) ==== @@ -35,7 +35,7 @@ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # -alpha/alpha/alpha-gdbstub.c optional ddb +alpha/alpha/alpha-gdbstub.c optional gdb alpha/alpha/api_up1000.c optional api_up1000 alpha/alpha/atomic.s standard alpha/alpha/autoconf.c standard ==== //depot/projects/gdb/sys/conf/files.amd64#4 (text+ko) ==== @@ -39,7 +39,7 @@ amd64/acpica/acpi_machdep.c optional acpi amd64/acpica/acpi_wakeup.c optional acpi amd64/acpica/madt.c optional acpi -amd64/amd64/amd64-gdbstub.c optional ddb +amd64/amd64/amd64-gdbstub.c optional gdb amd64/amd64/amd64_mem.c standard amd64/amd64/apic_vector.S standard amd64/amd64/atomic.c standard ==== //depot/projects/gdb/sys/conf/files.i386#4 (text+ko) ==== @@ -205,7 +205,7 @@ i386/i386/elf_machdep.c standard i386/i386/exception.s standard i386/i386/geode.c optional cpu_geode -i386/i386/i386-gdbstub.c optional ddb +i386/i386/i386-gdbstub.c optional gdb i386/i386/i686_mem.c standard i386/i386/identcpu.c standard i386/i386/in_cksum.c optional inet ==== //depot/projects/gdb/sys/conf/files.ia64#2 (text+ko) ==== @@ -102,7 +102,7 @@ ia64/ia64/eficlock.c standard ia64/ia64/elf_machdep.c standard ia64/ia64/exception.S standard -ia64/ia64/ia64-gdbstub.c optional ddb +ia64/ia64/ia64-gdbstub.c optional gdb ia64/ia64/in_cksum.c optional inet ia64/ia64/interrupt.c standard ia64/ia64/locore.S standard no-obj ==== //depot/projects/gdb/sys/conf/files.pc98#4 (text+ko) ==== @@ -146,7 +146,7 @@ i386/i386/dump_machdep.c standard i386/i386/elf_machdep.c standard i386/i386/exception.s standard -i386/i386/i386-gdbstub.c optional ddb +i386/i386/i386-gdbstub.c optional gdb i386/i386/i686_mem.c standard i386/i386/identcpu.c standard i386/i386/in_cksum.c optional inet ==== //depot/projects/gdb/sys/conf/options#5 (text+ko) ==== @@ -71,6 +71,15 @@ ADW_ALLOW_MEMIO opt_adw.h # Allow PCI devices to use memory # mapped I/O +# Debugging options. +DDB +DDB_NOKLDSYM opt_ddb.h +DDB_NUMSYM opt_ddb.h +GDB +GDBSPEED opt_gdb.h +KDB_TRACE opt_kdb.h +KDB_UNATTENDED opt_kdb.h + # Miscellaneous options. ADAPTIVE_MUTEXES ALQ @@ -81,14 +90,7 @@ COMPILING_LINT opt_global.h CONSPEED opt_comconsole.h CY_PCI_FASTINTR -DDB -DDB_NOKLDSYM opt_ddb.h -DDB_NUMSYM opt_ddb.h -DDB_TRACE -DDB_UNATTENDED DIRECTIO opt_directio.h -GDB_REMOTE_CHAT opt_ddb.h -GDBSPEED opt_ddb.h GEOM_AES opt_geom.h GEOM_APPLE opt_geom.h GEOM_BDE opt_geom.h @@ -579,7 +581,7 @@ KTR_ENTRIES opt_global.h KTR_VERBOSE opt_ktr.h WITNESS opt_global.h -WITNESS_DDB opt_witness.h +WITNESS_KDB opt_witness.h WITNESS_SKIPSPIN opt_witness.h # options for ACPI support @@ -632,7 +634,7 @@ SC_CUT_SEPCHARS opt_syscons.h SC_DEBUG_LEVEL opt_syscons.h SC_DFLT_FONT opt_syscons.h -SC_DISABLE_DDBKEY opt_syscons.h +SC_DISABLE_KDBKEY opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_KERNEL_CONS_ATTR opt_syscons.h ==== //depot/projects/gdb/sys/ddb/db_elf.c#2 (text+ko) ==== @@ -382,7 +382,7 @@ #endif void -kdb_init(void) +db_init(void) { static Elf_Ehdr elf; static Elf_Shdr sh[2]; ==== //depot/projects/gdb/sys/ddb/db_kld.c#2 (text+ko) ==== @@ -125,7 +125,7 @@ * Initialization routine for a.out files. */ void -kdb_init() +db_init() { db_add_symbol_table(0, 0, "kernel", 0); } ==== //depot/projects/gdb/sys/ddb/ddb.h#2 (text+ko) ==== @@ -115,7 +115,7 @@ /* machine-dependent */ void db_stack_thread(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif); -void kdb_init(void); +void db_init(void); db_cmdfcn_t db_breakpoint_cmd; db_cmdfcn_t db_continue_cmd; ==== //depot/projects/gdb/sys/dev/acpica/Osd/OsdDebug.c#2 (text+ko) ==== @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -86,12 +87,12 @@ fatal = (ACPI_SIGNAL_FATAL_INFO *)Info; printf("ACPI fatal signal, type 0x%x code 0x%x argument 0x%x", fatal->Type, fatal->Code, fatal->Argument); - Debugger("AcpiOsSignal"); + kdb_enter("AcpiOsSignal"); break; case ACPI_SIGNAL_BREAKPOINT: message = (char *)Info; - Debugger(message); + kdb_enter(message); break; default: ==== //depot/projects/gdb/sys/dev/en/midway.c#3 (text+ko) ==== @@ -127,6 +127,7 @@ #include #include +#include #include #include #include @@ -2442,9 +2443,7 @@ if_printf(&sc->ifatm.ifnet, "unexpected interrupt=0x%b, " "resetting\n", reg, MID_INTBITS); #ifdef EN_DEBUG -#ifdef DDB - Debugger("en: unexpected error"); -#endif /* DDB */ + kdb_enter("en: unexpected error"); sc->ifatm.ifnet.if_flags &= ~IFF_RUNNING; /* FREEZE! */ #else en_reset_ul(sc); ==== //depot/projects/gdb/sys/dev/syscons/syscons.c#4 (text+ko) ==== @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -3343,15 +3344,9 @@ break; case DBG: -#ifndef SC_DISABLE_DDBKEY -#ifdef DDB - Debugger("manual escape to debugger"); -#else - printf("No debugger in kernel\n"); +#ifndef SC_DISABLE_KDBKEY + kdb_enter("manual escape to debugger"); #endif -#else /* SC_DISABLE_DDBKEY */ - /* do nothing */ -#endif /* SC_DISABLE_DDBKEY */ break; case PNC: ==== //depot/projects/gdb/sys/dev/vinum/vinumhdr.h#2 (text+ko) ==== @@ -44,6 +44,7 @@ #ifdef _KERNEL #include "opt_vinum.h" #include +#include #include #include #include ==== //depot/projects/gdb/sys/dev/vinum/vinuminterrupt.c#2 (text+ko) ==== @@ -210,7 +210,7 @@ #ifdef VINUMDEBUG if (debug & DEBUG_RESID) { if (ubp->b_resid != 0) /* still something to transfer? */ - Debugger("resid"); + kdb_enter("resid"); } #endif ==== //depot/projects/gdb/sys/dev/vinum/vinumioctl.c#2 (text+ko) ==== @@ -201,7 +201,7 @@ boothowto |= RB_GDB; /* serial debug line */ else boothowto &= ~RB_GDB; /* local ddb */ - Debugger("vinum debug"); + kdb_enter("vinum debug"); } ioctl_reply = (struct _ioctl_reply *) data; /* reinstate the address to reply to */ ioctl_reply->error = 0; ==== //depot/projects/gdb/sys/dev/vinum/vinummemory.c#2 (text+ko) ==== @@ -175,7 +175,7 @@ for (i = 0; i < malloccount; i++) { if (((result + size) > malloced[i].address) && (result < malloced[i].address + malloced[i].size)) /* overlap */ - Debugger("Malloc overlap"); + kdb_enter("Malloc overlap"); } if (result) { char *f = basename(file); @@ -238,7 +238,7 @@ mem, file, line); - Debugger("Free"); + kdb_enter("Free"); } void ==== //depot/projects/gdb/sys/fs/devfs/devfs_devs.c#3 (text+ko) ==== @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -395,12 +396,12 @@ /* see if it was occupied */ dp = devfs_itod(ino); if (dp == NULL) - Debugger("dp == NULL\n"); + kdb_enter("dp == NULL\n"); if (*dp != NULL) continue; ip = devfs_itor(ino); if (ip == NULL) - Debugger("ip == NULL\n"); + kdb_enter("ip == NULL\n"); if (*ip != 0) continue; ==== //depot/projects/gdb/sys/fs/nullfs/null_vfsops.c#2 (text+ko) ==== @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -264,7 +265,7 @@ #ifdef NULLFS_DEBUG if (VOP_ISLOCKED(vp, NULL)) { - Debugger("root vnode is locked.\n"); + kdb_enter("root vnode is locked.\n"); vrele(vp); return (EDEADLK); } ==== //depot/projects/gdb/sys/fs/smbfs/smbfs_node.c#3 (text+ko) ==== @@ -33,6 +33,7 @@ */ #include #include +#include #include #include #include @@ -140,7 +141,7 @@ cp--; if (*cp != 0xfc) { printf("First byte of name entry '%s' corrupted\n", name); - Debugger("ditto"); + kdb_enter("ditto"); } cp -= sizeof(int); nmlen = *(int*)cp; @@ -148,11 +149,11 @@ if (nmlen != slen) { printf("Name length mismatch: was %d, now %d name '%s'\n", nmlen, slen, name); - Debugger("ditto"); + kdb_enter("ditto"); } if (name[nmlen] != 0xfe) { printf("Last byte of name entry '%s' corrupted\n", name); - Debugger("ditto"); + kdb_enter("ditto"); } free(cp, M_SMBNODENAME); #else ==== //depot/projects/gdb/sys/i386/i386/db_interface.c#3 (text+ko) ==== @@ -53,12 +53,14 @@ static jmp_buf *db_nofault = 0; extern jmp_buf db_jmpbuf; +#if 0 extern void gdb_handle_exception(db_regs_t *, int, int); +static jmp_buf db_global_jmpbuf; +#endif int db_active; db_regs_t ddb_regs; -static jmp_buf db_global_jmpbuf; static __inline u_short rss(void) @@ -72,11 +74,12 @@ return ss; } +#if 0 /* - * kdb_trap - field a TRACE or BPT trap + * ddb_trap - field a TRACE or BPT trap */ int -kdb_trap(int type, int code, struct i386_saved_state *regs) +ddb_trap(int type, int code, struct i386_saved_state *regs) { u_int ef; volatile int ddb_mode = !(boothowto & RB_GDB); @@ -226,6 +229,7 @@ return (1); } +#endif /* * Read bytes from kernel address space for debugger. @@ -304,32 +308,6 @@ } } -/* - * XXX - * Move this to machdep.c and allow it to be called if any debugger is - * installed. - */ -void -Debugger(const char *msg) -{ - static volatile u_int in_Debugger; - - /* - * XXX - * Do nothing if the console is in graphics mode. This is - * OK if the call is for the debugger hotkey but not if the call - * is a weak form of panicing. - */ - if (cnunavailable() != 0 && !(boothowto & RB_GDB)) - return; - - if (atomic_cmpset_acq_int(&in_Debugger, 0, 1)) { - db_printf("Debugger(\"%s\")\n", msg); - breakpoint(); - atomic_store_rel_int(&in_Debugger, 0); - } -} - void db_show_mdpcpu(struct pcpu *pc) { ==== //depot/projects/gdb/sys/i386/i386/machdep.c#3 (text+ko) ==== @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -2098,10 +2099,11 @@ atpic_startup(); #endif -#ifdef DDB kdb_init(); + +#ifdef DEBUG if (boothowto & RB_KDB) - Debugger("Boot flags requested debugger"); + kdb_enter("Boot flags requested debugger"); #endif finishidentcpu(); /* Final stage of CPU initialization */ @@ -2744,14 +2746,6 @@ return 0; } -#ifndef DDB -void -Debugger(const char *msg) -{ - printf("Debugger(\"%s\") called.\n", msg); -} -#endif /* no DDB */ - #ifndef DEV_APIC #include ==== //depot/projects/gdb/sys/i386/i386/trap.c#3 (text+ko) ==== @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include ==== //depot/projects/gdb/sys/i386/include/frame.h#2 (text+ko) ==== @@ -153,8 +153,6 @@ int cf_ss; }; -int kdb_trap(int, int, struct trapframe *); - #define INTR_TO_TRAPFRAME(frame) ((struct trapframe *)&(frame)->if_fs) #endif /* _MACHINE_FRAME_H_ */ ==== //depot/projects/gdb/sys/i386/isa/pcvt/pcvt_hdr.h#3 (text+ko) ==== @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include ==== //depot/projects/gdb/sys/i386/isa/pcvt/pcvt_kbd.c#2 (text+ko) ==== @@ -945,27 +945,20 @@ shutdown_nice(0); #endif /* PCVT_CTRL_ALT_DEL */ -#if defined(DDB) /* Check for cntl-alt-esc */ +#if defined(DEBUG) /* Check for cntl-alt-esc */ if((key == 110) && ctrl_down && (meta_down || altgr_down)) { - static u_char in_Debugger; - - if(!in_Debugger) - { - in_Debugger = 1; - - /* the string is actually not used... */ - Debugger("kbd"); - - in_Debugger = 0; - if(noblock) - return NULL; - else - goto loop; - } - } -#endif /* defined(DDB) */ + if (!kdb_active) + { + kdb_enter("kbd"); + if(noblock) + return NULL; + else + goto loop; + } + } +#endif /* defined(DEBUG) */ /* look for keys with special handling */ if(key == 128) ==== //depot/projects/gdb/sys/ia64/ia64/db_interface.c#2 (text+ko) ==== @@ -428,13 +428,6 @@ db_nofault = 0; } -void -Debugger(const char* msg) -{ - printf("%s\n", msg); - __asm("break 0x80100"); -} - u_long db_register_value(db_regs_t *regs, int regno) { ==== //depot/projects/gdb/sys/ia64/ia64/machdep.c#3 (text+ko) ==== @@ -753,13 +753,13 @@ /* * Initialize debuggers, and break into them if appropriate. */ -#ifdef DDB kdb_init(); - if (boothowto & RB_KDB) { - printf("Boot flags requested debugger\n"); - breakpoint(); - } + +#ifdef DEBUG + if (boothowto & RB_KDB) + kdb_enter("Boot flags requested debugger\n"); #endif + ia64_set_tpr(0); /* @@ -1350,14 +1350,6 @@ return (1); } -#ifndef DDB -void -Debugger(const char *msg) -{ - printf("Debugger(\"%s\") called.\n", msg); -} -#endif /* no DDB */ - int sysbeep(int pitch, int period) { ==== //depot/projects/gdb/sys/kern/kern_clock.c#3 (text+ko) ==== @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -547,12 +548,12 @@ } >>> TRUNCATED FOR MAIL (1000 lines) <<<