Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Mar 2004 15:33:36 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 49408 for review
Message-ID:  <200403202333.i2KNXaAd069097@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=49408

Change 49408 by marcel@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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403202333.i2KNXaAd069097>