PERFORCE change 49408 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sat Mar 20 15:33:38 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=49408
Change 49408 by marcel at marcel_nfs on 2004/03/20 15:33:06
Turn the debugger into a critical section and stop any
other CPU in SMP configurations.
Affected files ...
.. //depot/projects/gdb/sys/kern/subr_kdb.c#6 edit
Differences ...
==== //depot/projects/gdb/sys/kern/subr_kdb.c#6 (text+ko) ====
@@ -31,6 +31,8 @@
#include <sys/systm.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
+#include <sys/pcpu.h>
+#include <sys/smp.h>
int kdb_active = 0;
struct kdb_dbbe *kdb_cur = NULL;
@@ -156,11 +158,24 @@
{
int handled;
- if (kdb_cur != NULL && kdb_cur->dbbe_trap != NULL) {
- kdb_active = 1;
- handled = kdb_cur->dbbe_trap(type, code, tf);
- kdb_active = 0;
- } else
- handled = 0;
+ if (kdb_cur == NULL || kdb_cur->dbbe_trap == NULL)
+ return (0);
+
+ critical_enter();
+
+#ifdef SMP
+ stop_cpus(PCPU_GET(other_cpus));
+#endif
+
+ kdb_active++;
+ handled = kdb_cur->dbbe_trap(type, code, tf);
+ kdb_active--;
+
+#ifdef SMP
+ restart_cpus(stopped_cpus);
+#endif
+
+ critical_exit();
+
return (handled);
}
More information about the p4-projects
mailing list