diff options
author | John Baldwin <jhb@FreeBSD.org> | 2001-04-06 21:41:52 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2001-04-06 21:41:52 +0000 |
commit | ed55a19f67241835da09b3fd8c415b1a83493ddc (patch) | |
tree | 2dda238a0488f293a83f697beabe9b65911d36a8 /sys/i386/i386/db_interface.c | |
parent | 3dcb6789d7169a0182dd7915d9eea429086e9fc8 (diff) | |
download | src-ed55a19f67241835da09b3fd8c415b1a83493ddc.tar.gz src-ed55a19f67241835da09b3fd8c415b1a83493ddc.zip |
Add a new ddb command 'show pcpu' which lists some of the per-cpu data.
Specifically, the cpuid, curproc, curpcb, npxproc, and idleproc members.
Also, if witness is compiled into the kernel, then a list of all the spin
locks held by this CPU is displayed. By default the information for the
current CPU is displayed, but a decimal cpu id may be specified as a
parameter to obtain information on a specific CPU.
Notes
Notes:
svn path=/head/; revision=75274
Diffstat (limited to 'sys/i386/i386/db_interface.c')
-rw-r--r-- | sys/i386/i386/db_interface.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index ea2b8625cc74..1e2d37fabd6e 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -33,8 +33,10 @@ #include <sys/systm.h> #include <sys/reboot.h> #include <sys/cons.h> -#include <sys/linker_set.h> #include <sys/ktr.h> +#include <sys/linker_set.h> +#include <sys/lock.h> +#include <sys/proc.h> #include <machine/cpu.h> #ifdef SMP @@ -328,3 +330,45 @@ Debugger(msg) atomic_store_rel_int(&in_Debugger, 0); } } + +DB_SHOW_COMMAND(pcpu, db_show_pcpu) +{ + struct globaldata *gd; + int id; + + if (have_addr) + id = ((addr >> 4) % 16) * 10 + (addr % 16); + else + id = PCPU_GET(cpuid); + SLIST_FOREACH(gd, &cpuhead, gd_allcpu) { + if (gd->gd_cpuid == id) + break; + } + if (gd == NULL) + db_printf("CPU %d not found\n", id); + else { + db_printf("cpuid\t = %d\ncurproc\t = ", gd->gd_cpuid); + if (gd->gd_curproc != NULL) + db_printf("%p: pid %d \"%s\"\n", gd->gd_curproc, + gd->gd_curproc->p_pid, gd->gd_curproc->p_comm); + else + db_printf("none\n"); + db_printf("curpcb\t = %p\nnpxproc\t = ", gd->gd_curpcb); + if (gd->gd_npxproc != NULL) + db_printf("%p: pid %d \"%s\"\n", gd->gd_npxproc, + gd->gd_npxproc->p_pid, gd->gd_npxproc->p_comm); + else + db_printf("none\n"); + db_printf("idleproc = "); + if (gd->gd_idleproc != NULL) + db_printf("%p: pid %d \"%s\"\n", gd->gd_idleproc, + gd->gd_idleproc->p_pid, gd->gd_idleproc->p_comm); + else + db_printf("none\n"); + +#ifdef WITNESS + db_printf("spin locks held:\n"); + witness_list_locks(&gd->gd_spinlocks); +#endif + } +} |