Skip to contentSkip to conversation

KGDB: This is the core of the KGDB stub.

PATCH In review Jason Wessel 1 participant 1 message Oct 15, 2007

Subsystems (4)
lore
Share & tools
lore

Jason Wessel

author maintainer
#0 lore raw

PATCH 1/21 KGDB: This is the core of the KGDB stub.

core-lite.patch

From: Jason Wessel <[email protected]>
Subject: [PATCH] This is the core of the KGDB stub.

This patch provides all of the common code, documentation and basic Kconfig changes, as well as the common hooks. With out arch changes this code does not actually do anything to the kernel. The idea is that each arch can add in a minimal set of hooks to make use of the KGDB core.

The core contains the protocol handler to talk to a debugger client such as gdb via the gdb serial protocol. The core also contains the needed hooks for an arch to be SMP and preempt safe. The weak definitions allow an arch to override a part of the core, if it the arch impelmentation requires it.

---
 Documentation/DocBook/Makefile  |    2 
 Documentation/DocBook/kgdb.tmpl |  236 ++++
 MAINTAINERS                     |    9 
 include/asm-generic/kgdb.h      |  105 ++
 include/linux/kgdb.h            |  292 +++++
 kernel/Makefile                 |    1 
 kernel/kgdb.c                   | 1991 ++++++++++++++++++++++++++++++++++++++++
 kernel/sched.c                  |    4 
 lib/Kconfig.debug               |    2 
 lib/Kconfig.kgdb                |   70 +
 10 files changed, 2711 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/DocBook/kgdb.tmpl
 create mode 100644 include/asm-generic/kgdb.h
 create mode 100644 include/linux/kgdb.h
 create mode 100644 kernel/kgdb.c
 create mode 100644 lib/Kconfig.kgdb
Documentation/DocBook/Makefile +1 -1
@@ -11,7 +11,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mc
 	    procfs-guide.xml writing_usb_driver.xml \
 	    kernel-api.xml filesystems.xml lsm.xml usb.xml \
 	    gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
-	    genericirq.xml s390-drivers.xml
+	    genericirq.xml s390-drivers.xml kgdb.xml
 
 ###
 # The build process is as follows (targets):
Documentation/DocBook/kgdb.tmpl new file +236 -0

236 lines not on this page · raw message

MAINTAINERS +9 -0
@@ -2234,6 +2234,15 @@ L:	[email protected]
 L:	[email protected]
 S:	Maintained
 
+KGDB
+P:	Jason Wessel
+M:	[email protected]
+P:	Amit S. Kale
+M:	[email protected]
+W:	http://sourceforge.net/projects/kgdb
+L:	[email protected]
+S:	Maintained
+
 KPROBES
 P:	Prasanna S Panchamukhi
 M:	[email protected]
include/asm-generic/kgdb.h new file +105 -0

105 lines not on this page · raw message

include/linux/kgdb.h new file +292 -0

292 lines not on this page · raw message

kernel/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_STOP_MACHINE) += stop_machi
 obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
 obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
 obj-$(CONFIG_KPROBES) += kprobes.o
+obj-$(CONFIG_KGDB) += kgdb.o
 obj-$(CONFIG_SYSFS) += ksysfs.o
 obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o
 obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
kernel/kgdb.c new file +1991 -0

1,991 lines not on this page · raw message

kernel/sched.c +4 -0
@@ -58,6 +58,7 @@
 #include <linux/times.h>
 #include <linux/tsacct_kern.h>
 #include <linux/kprobes.h>
+#include <linux/kgdb.h>
 #include <linux/delayacct.h>
 #include <linux/reciprocal_div.h>
 #include <linux/unistd.h>
@@ -6614,6 +6615,9 @@ void __might_sleep(char *file, int line)
 #ifdef in_atomic
 	static unsigned long prev_jiffy;	/* ratelimiting */
 
+	if (atomic_read(&debugger_active))
+		return;
+
 	if ((in_atomic() || irqs_disabled()) &&
 	    system_state == SYSTEM_RUNNING && !oops_in_progress) {
 		if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
lib/Kconfig.debug +2 -0
@@ -480,3 +480,5 @@ config FAULT_INJECTION_STACKTRACE_FILTER
 	select FRAME_POINTER
 	help
 	  Provide stacktrace filter for fault-injection capabilities
+
+source "lib/Kconfig.kgdb"
lib/Kconfig.kgdb new file +70 -0

70 lines not on this page · raw message