PERFORCE change 52703 for review

Marcel Moolenaar marcel at FreeBSD.org
Tue May 11 21:20:18 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=52703

Change 52703 by marcel at marcel_nfs on 2004/05/11 21:19:21

	Add kdb_reenter(). This function is called by the trap
	handler when a trap happens while in the debugger (i.e.
	kdb_active is non-zero). The advantage of a seperate
	function for this is that it can also be called from
	other places than trap handlers.

Affected files ...

.. //depot/projects/gdb/sys/kern/subr_kdb.c#13 edit
.. //depot/projects/gdb/sys/sys/kdb.h#10 edit

Differences ...

==== //depot/projects/gdb/sys/kern/subr_kdb.c#13 (text+ko) ====

@@ -259,6 +259,17 @@
 	return (old);
 }
 
+void
+kdb_reenter(void)
+{
+
+	if (!kdb_active || kdb_jmpbufp == NULL)
+		return;
+
+	longjmp(kdb_jmpbufp, 1);
+	/* NOTREACHED */
+}
+
 /*
  * Thread related support functions.
  */
@@ -333,14 +344,12 @@
 	if (kdb_dbbe == NULL || kdb_dbbe->dbbe_trap == NULL)
 		return (0);
 
+	/* We reenter the debugger through kdb_reenter(). */
+	if (kdb_active)
+		return (0);
+
 	critical_enter();
 
-	/* Check for recursion. */
-	if (kdb_active && kdb_jmpbufp != NULL) {
-		critical_exit();
-		longjmp(kdb_jmpbufp, 1);
-	}
-
 	kdb_active++;
 	kdb_thread = curthread;
 	kdb_frame = tf;

==== //depot/projects/gdb/sys/sys/kdb.h#10 (text+ko) ====

@@ -65,6 +65,7 @@
 void	kdb_enter(const char *);
 void	kdb_init(void);
 void *	kdb_jmpbuf(jmp_buf);
+void	kdb_reenter(void);
 struct thread *kdb_thr_first(void);
 struct thread *kdb_thr_lookup(pid_t);
 struct thread *kdb_thr_next(struct thread *);


More information about the p4-projects mailing list