core.patch

来自「Linux-2.6.18内核调试工具补丁程序KGDB。」· PATCH 代码 · 共 103 行

PATCH
103
字号
Signed off by: Milind Dumbare <milind@linsyssoft.com> include/linux/kgdb.h |    1 + kernel/kgdb.c        |    5 +++++ kernel/softlockup.c  |    4 ++++ kernel/timer.c       |    9 ++++++++- 4 files changed, 18 insertions(+), 1 deletion(-)Index: linux-2.6.16/kernel/kgdb.c===================================================================--- linux-2.6.16.orig/kernel/kgdb.c	2006-04-25 11:33:57.000000000 +0530+++ linux-2.6.16/kernel/kgdb.c	2006-04-25 11:44:01.000000000 +0530@@ -123,6 +123,8 @@ /* to keep track of the CPU which is doing the single stepping*/ atomic_t cpu_doing_single_step = ATOMIC_INIT(-1); +atomic_t  kgdb_sync_softlockup[NR_CPUS] = {ATOMIC_INIT(0)};+ /* reboot notifier block */ static struct notifier_block kgdb_reboot_notifier = { 	.notifier_call  = kgdb_notify_reboot,@@ -743,6 +745,7 @@ 	kgdb_info[processor].debuggerinfo = regs; 	kgdb_info[processor].task = current; 	atomic_set(&procindebug[processor], 1);+	atomic_set(&kgdb_sync_softlockup[smp_processor_id()], 1);  	/* Wait till master processor goes completely into the debugger. 	 * FIXME: this looks racy */@@ -1046,6 +1049,8 @@ 			udelay(1); 	} +	atomic_set(&kgdb_sync_softlockup[smp_processor_id()], 1);+ 	/* 	 * Don't enter if the last instance of the exception handler wanted to 	 * come into the debugger again.Index: linux-2.6.16/kernel/softlockup.c===================================================================--- linux-2.6.16.orig/kernel/softlockup.c	2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/kernel/softlockup.c	2006-04-25 11:44:01.000000000 +0530@@ -14,6 +14,7 @@ #include <linux/kthread.h> #include <linux/notifier.h> #include <linux/module.h>+#include <linux/kgdb.h>  static DEFINE_SPINLOCK(print_lock); @@ -37,6 +38,9 @@ void touch_softlockup_watchdog(void) { 	per_cpu(timestamp, raw_smp_processor_id()) = jiffies;+#ifdef CONFIG_KGDB+	atomic_set(&kgdb_sync_softlockup[raw_smp_processor_id()], 0);+#endif } EXPORT_SYMBOL(touch_softlockup_watchdog); Index: linux-2.6.16/kernel/timer.c===================================================================--- linux-2.6.16.orig/kernel/timer.c	2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/kernel/timer.c	2006-04-25 11:44:57.000000000 +0530@@ -34,6 +34,7 @@ #include <linux/cpu.h> #include <linux/syscalls.h> #include <linux/delay.h>+#include <linux/kgdb.h>  #include <asm/uaccess.h> #include <asm/unistd.h>@@ -940,11 +941,17 @@  void do_timer(struct pt_regs *regs) {+	 int this_cpu = smp_processor_id(); 	jiffies_64++; 	/* prevent loading jiffies before storing new jiffies_64 value. */ 	barrier(); 	update_times();-	softlockup_tick(regs);++#ifdef CONFIG_KGDB+	if(!atomic_read(&kgdb_sync_softlockup[this_cpu]))+#endif+		softlockup_tick(regs);+ }  #ifdef __ARCH_WANT_SYS_ALARMIndex: linux-2.6.16/include/linux/kgdb.h===================================================================--- linux-2.6.16.orig/include/linux/kgdb.h	2006-04-25 11:33:57.000000000 +0530+++ linux-2.6.16/include/linux/kgdb.h	2006-04-25 11:44:01.000000000 +0530@@ -45,6 +45,7 @@  extern atomic_t kgdb_setting_breakpoint; extern atomic_t cpu_doing_single_step;+extern atomic_t kgdb_sync_softlockup[NR_CPUS];  extern struct task_struct *kgdb_usethread, *kgdb_contthread; 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?