Re: [patch] KGDB for Real-Time Preemption systems

From: Serge Noiraud
Date: Mon Sep 05 2005 - 07:23:42 EST


mercredi 17 Août 2005 02:53, George Anzinger wrote/a écrit :
> I have put a version of KGDB for x86 RT kernels here:
> http://source.mvista.com/~ganzinger/
>
> The common_kgdb_cfi_.... stuff creates debug records for entry.S and
> friends so that you can "bt" through them. Apply in this order:
> Ingo's patch
> kgdb-ga-rt.patch
> common_kgdb_cfi_annotations.patch
>
> This is, more or less, the same kgdb that is in Andrew's mm tree changed
> to fix the RT issues.

Hi, everybody

I found two bugs in kgdb-ga-rt patch.

The first one : if CONFIG_SMP is not set, we have a compile error
The second one : if CONFIG_KGDB is not set, we have a link error
I send you a diff patch to correct this. I am not sure the last patch is
correct, but it works.
--- kgdb-ga-rt.patch.org 2005-09-05 12:00:17.103019648 +0200
+++ kgdb-ga-rt.patch 2005-09-05 12:08:04.561955088 +0200
@@ -1861,11 +1861,11 @@
+ gdb_i386errcode = err_code;
+ kgdb_info.called_from = __builtin_return_address(0);
+ kgdb_info.why = str;
++#ifdef CONFIG_SMP
+ kgdb_info.cpus_waiting[trap_cpu].regs = linux_regs;
+ kgdb_info.cpus_waiting[trap_cpu].task = current;
+ kgdb_info.cpus_waiting[trap_cpu].pid =
+ (current->pid) ? : (PID_MAX + trap_cpu);
-+#ifdef CONFIG_SMP
+ /*
+ * OK, we can now communicate, lets tell gdb about the sync.
+ * but only if we had a problem.
@@ -5078,7 +5078,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.13-rc/include/asm-i386/kgdb_local.h
-@@ -0,0 +1,174 @@
+@@ -0,0 +1,178 @@
+#ifndef __KGDB_LOCAL
+#define ___KGDB_LOCAL
+#include <linux/config.h>
@@ -5248,7 +5248,11 @@
+#endif
+#define INIT_KDEBUG putDebugChar("+");
+extern struct notifier_block kgdb_notify_struct;
++#ifdef CONFIG_KGDB
+#define KGDB_NOTIFY {&kgdb_notify_struct}
++#else /* CONFIG_KGDB */
++#define KGDB_NOTIFY {NULL}
++#endif /* CONFIG_KGDB */
+#else
+#define KGDB_NOTIFY {NULL}
+#endif /* __ASSEMBLY__ */