Skip to contentSkip to conversation

Split kgdb into "lite" and "normal" parts

PATCH Pavel Machek 4 participants 14 messages Feb 18, 2004 – Feb 25, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi!

This is based on current CVS version. If you want just basic functionality, apply core-lite.patch and i386-lite.patch. If you want all the features, add core.patch and i386.patch.

Amit, this should be "step 1: split" we were talking about. Could you test it looks sane and add it to the cvs?
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
Makefile +2 -0
@@ -440,6 +440,8 @@
 
 ifndef CONFIG_FRAME_POINTER
 CFLAGS		+= -fomit-frame-pointer
+else
+CFLAGS		+= -fno-omit-frame-pointer
 endif
 
 ifdef CONFIG_DEBUG_INFO
include/linux/debugger.h +66 -0

66 lines not on this page · raw message

include/linux/kgdb.h +112 -0

112 lines not on this page · raw message

init/main.c +2 -0
@@ -39,6 +39,7 @@
 #include <linux/writeback.h>
 #include <linux/cpu.h>
 #include <linux/efi.h>
+#include <linux/debugger.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -580,6 +581,7 @@
 	do_pre_smp_initcalls();
 
 	smp_init();
+	debugger_entry();
 	do_basic_setup();
 
 	prepare_namespace();
kernel/Makefile +1 -0
@@ -19,6 +19,7 @@
 obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_IKCONFIG) += configs.o
 obj-$(CONFIG_IKCONFIG_PROC) += configs.o
+obj-$(CONFIG_KGDB) += kgdbstub.o
 
 ifneq ($(CONFIG_IA64),y)
 # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/kgdbstub.c +1207 -0

1,207 lines not on this page · raw message

kernel/sched.c +3 -0
@@ -37,6 +37,7 @@
 #include <linux/rcupdate.h>
 #include <linux/cpu.h>
 #include <linux/percpu.h>
+#include <linux/debugger.h>
 
 #ifdef CONFIG_NUMA
 #define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
@@ -2958,6 +2959,8 @@
 #if defined(in_atomic)
 	static unsigned long prev_jiffy;	/* ratelimiting */
 
+	if (atomic_read(&debugger_active))
+		return;
 	if ((in_atomic() || irqs_disabled()) && system_running) {
 		if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
 			return;
arch/i386/Kconfig +14 -0
@@ -1253,6 +1253,20 @@
 	  If you say Y here, various routines which may sleep will become very
 	  noisy if they are called with a spinlock held.	
 
+config KGDB
+	bool "KGDB: kernel debugging with remote gdb"
+	depends on DEBUG_KERNEL
+	select DEBUG_INFO
+	select FRAME_POINTER
+	help
+	  If you say Y here, it will be possible to remotely debug the
+	  kernel using gdb. This enlarges your kernel image disk size by
+	  several megabytes and requires a machine with more than 128 MB
+	  RAM to avoid excessive linking time. 
+	  Documentation of kernel debugger available at
+	  http://kgdb.sourceforge.net
+	  This is only useful for kernel hackers. If unsure, say N.
+
 config FRAME_POINTER
 	bool "Compile the kernel with frame pointers"
 	help
arch/i386/kernel/Makefile +1 -0
@@ -31,6 +31,7 @@
 obj-$(CONFIG_ACPI_SRAT) 	+= srat.o
 obj-$(CONFIG_HPET_TIMER) 	+= time_hpet.o
 obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
+obj-$(CONFIG_KGDB)		+= i386-stub.o
 
 EXTRA_AFLAGS   := -traditional
 
arch/i386/kernel/i386-stub.c +373 -0

373 lines not on this page · raw message

arch/i386/kernel/nmi.c +13 -1
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/nmi.h>
 #include <linux/sysdev.h>
+#include <linux/debugger.h>
 
 #include <asm/smp.h>
 #include <asm/mtrr.h>
@@ -420,14 +421,25 @@
 	int sum, cpu = smp_processor_id();
 
 	sum = irq_stat[cpu].apic_timer_irqs;
+	if (atomic_read(&debugger_active)) {
 
-	if (last_irq_sums[cpu] == sum) {
+		/*
+		 * The machine is in debugger, hold this cpu if already
+		 * not held.
+		 */
+		debugger_nmihook(cpu, regs);
+		alert_counter[cpu] = 0;
+
+	} else if (last_irq_sums[cpu] == sum) {
 		/*
 		 * Ayiee, looks like this CPU is stuck ...
 		 * wait a few IRQs (5 seconds) before doing the oops ...
 		 */
 		alert_counter[cpu]++;
 		if (alert_counter[cpu] == 5*nmi_hz) {
+
+			CHK_DEBUGGER(2,SIGSEGV,0,regs,)
+
 			spin_lock(&nmi_print_lock);
 			/*
 			 * We are in trouble anyway, lets at least try
arch/i386/kernel/signal.c +2 -1
@@ -580,7 +580,8 @@
 		 * have been cleared if the watchpoint triggered
 		 * inside the kernel.
 		 */
-		__asm__("movl %0,%%db7"	: : "r" (current->thread.debugreg[7]));
+		if (current->thread.debugreg[7])
+			__asm__("movl %0,%%db7"	: : "r" (current->thread.debugreg[7]));
 
 		/* Whee!  Actually deliver the signal.  */
 		handle_signal(signr, &info, oldset, regs);
arch/i386/kernel/traps.c +15 -6
@@ -51,6 +51,7 @@
 
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/debugger.h>
 
 #include "mach_traps.h"
 
@@ -256,6 +257,7 @@
 {
 	static int die_counter;
 
+	CHK_DEBUGGER(1,SIGTRAP,err,regs,)
 	console_verbose();
 	spin_lock_irq(&die_lock);
 	bust_spinlocks(1);
@@ -330,6 +332,7 @@
 #define DO_ERROR(trapnr, signr, str, name) \
 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
+	CHK_DEBUGGER(trapnr,signr,error_code,regs,)\
 	do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \
 }
 
@@ -347,7 +350,10 @@
 #define DO_VM86_ERROR(trapnr, signr, str, name) \
 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
+	CHK_DEBUGGER(trapnr,signr,error_code,regs,goto skip_trap)\
 	do_trap(trapnr, signr, str, 1, regs, error_code, NULL); \
+skip_trap: \
+	return; \
 }
 
 #define DO_VM86_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
@@ -547,7 +553,7 @@
 	tsk->thread.debugreg[6] = condition;
 
 	/* Mask out spurious TF errors due to lazy TF clearing */
-	if (condition & DR_STEP) {
+	if (condition & DR_STEP && !debugger_step) {
 		/*
 		 * The TF error should be masked out only if the current
 		 * process is not traced and if the TRAP flag has been set
@@ -570,11 +576,13 @@
 	info.si_errno = 0;
 	info.si_code = TRAP_BRKPT;
 	
-	/* If this is a kernel mode trap, save the user PC on entry to 
-	 * the kernel, that's what the debugger can make sense of.
-	 */
-	info.si_addr = ((regs->xcs & 3) == 0) ? (void *)tsk->thread.eip : 
-	                                        (void *)regs->eip;
+
+	/* If this is a kernel mode trap, we need to reset db7 to allow us
+	 * to continue sanely */
+	if ((regs->xcs & 3) == 0)
+		goto clear_dr7;
+
+	info.si_addr = (void *)regs->eip;
 	force_sig_info(SIGTRAP, &info, tsk);
 
 	/* Disable additional traps. They'll be re-enabled when
@@ -584,6 +592,7 @@
 	__asm__("movl %0,%%db7"
 		: /* no output */
 		: "r" (0));
+	CHK_DEBUGGER(1,SIGTRAP,error_code,regs,)
 	return;
 
 debug_vm86:
arch/i386/mm/fault.c +9 -0
@@ -2,6 +2,11 @@
  *  linux/arch/i386/mm/fault.c
  *
  *  Copyright (C) 1995  Linus Torvalds
+ *
+ *  Change History
+ *
+ *	Tigran Aivazian <[email protected]>	Remote debugging support.
+ *
  */
 
 #include <linux/signal.h>
@@ -21,6 +26,7 @@
 #include <linux/vt_kern.h>		/* For unblank_screen() */
 #include <linux/highmem.h>
 #include <linux/module.h>
+#include <linux/debugger.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -399,6 +405,8 @@
  	if (is_prefetch(regs, address))
  		return;
 
+	CHK_DEBUGGER(14, SIGSEGV,error_code, regs,)
+
 /*
  * Oops. The kernel tried to access some bad page. We'll have to
  * terminate things with extreme prejudice.
@@ -406,6 +414,7 @@
 
 	bust_spinlocks(1);
 
+
 	if (address < PAGE_SIZE)
 		printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
 	else
include/asm-i386/kgdb.h +49 -0

49 lines not on this page · raw message

include/asm-i386/processor.h +2 -0
@@ -425,6 +425,8 @@
 	unsigned int		saved_fs, saved_gs;
 /* IO permissions */
 	unsigned long	*io_bitmap_ptr;
+	void *		debuggerinfo;
+
 };
 
 #define INIT_THREAD  {							\
include/linux/sched.h +12 -1
@@ -173,7 +173,9 @@
 
 #define	MAX_SCHEDULE_TIMEOUT	LONG_MAX
 extern signed long FASTCALL(schedule_timeout(signed long timeout));
-asmlinkage void schedule(void);
+asmlinkage void do_schedule(void);
+asmlinkage void kern_schedule(void);
+asmlinkage void kern_do_schedule(struct pt_regs);
 
 struct namespace;
 
@@ -906,6 +908,15 @@
 
 #endif /* CONFIG_SMP */
 
+static inline void schedule(void)
+{
+#ifdef CONFIG_KGDB_THREAD
+	kern_schedule();
+#else
+	do_schedule();
+#endif
+}
+
 #endif /* __KERNEL__ */
 
 #endif
kernel/kgdbstub.c +64 -0

77 lines not on this page · raw message

kernel/sched.c +18 -1
@@ -1589,7 +1589,7 @@
 /*
  * schedule() is the main scheduler function.
  */
-asmlinkage void schedule(void)
+asmlinkage void do_schedule(void)
 {
 	long *switch_count;
 	task_t *prev, *next;
@@ -1761,6 +1761,23 @@
 
 EXPORT_SYMBOL(default_wake_function);
 
+asmlinkage void user_schedule(void)
+{
+#ifdef CONFIG_KGDB_THREAD
+	current->thread.debuggerinfo = NULL;
+#endif
+	do_schedule();
+}
+
+#ifdef CONFIG_KGDB_THREAD
+asmlinkage void kern_do_schedule(struct pt_regs regs)
+{
+	current->thread.debuggerinfo = &regs;
+	do_schedule();
+	current->thread.debuggerinfo = NULL;
+}
+#endif
+
 /*
  * The core wakeup function.  Non-exclusive wakeups (nr_exclusive == 0) just
  * wake everything up.  If it's an exclusive wakeup (nr_exclusive == small +ve
arch/i386/Kconfig +17 -0
@@ -1267,6 +1267,23 @@
 	  http://kgdb.sourceforge.net
 	  This is only useful for kernel hackers. If unsure, say N.
 
+config KGDB_THREAD
+	bool "KGDB: Thread analysis"
+	depends on KGDB
+	help
+	  With thread analysis enabled, gdb can talk to kgdb stub to list
+	  threads and to get stack trace for a thread. This option also enables
+	  some code which helps gdb get exact status of thread. Thread analysis
+	  adds some overhead to schedule and down functions. You can disable
+	  this option if you do not want to compromise on speed.
+
+config KGDB_CONSOLE
+	bool "KGDB: Console messages through gdb"
+	depends on KGDB
+	help
+	  If you say Y here, console messages will appear through gdb.
+	  Other consoles such as tty or ttyS will continue to work as usual.
+
 config FRAME_POINTER
 	bool "Compile the kernel with frame pointers"
 	help
arch/i386/kernel/entry.S +37 -2
@@ -226,7 +226,7 @@
 	jz restore_all
 	movl $PREEMPT_ACTIVE,TI_PRE_COUNT(%ebp)
 	sti
-	call schedule
+	call user_schedule
 	movl $0,TI_PRE_COUNT(%ebp)
 	cli
 	jmp need_resched
@@ -308,7 +308,7 @@
 	testb $_TIF_NEED_RESCHED, %cl
 	jz work_notifysig
 work_resched:
-	call schedule
+	call user_schedule
 	cli				# make sure we don't miss an interrupt
 					# setting need_resched or sigpending
 					# between sampling and the iret
@@ -399,7 +399,17 @@
 	ALIGN
 common_interrupt:
 	SAVE_ALL
+	movl %esp, %eax
+/* Create a fake function call followed by a fake function prologue to fool
+ * gdb into believing that this is a normal function call. */
+	pushl EIP(%eax)
+
+common_interrupt_1:
+	pushl %ebp
+	movl %esp, %ebp
+	pushl %eax
 	call do_IRQ
+	addl $12, %esp
 	jmp ret_from_intr
 
 #define BUILD_INTERRUPT(name, nr)	\
@@ -606,6 +616,31 @@
 	pushl $do_spurious_interrupt_bug
 	jmp error_code
 
+#ifdef CONFIG_KGDB_THREAD
+ENTRY(kern_schedule)
+	pushl	%ebp
+	movl	%esp, %ebp
+	pushl	%ss		
+	pushl	%ebp
+	pushfl
+	pushl	%cs
+	pushl	4(%ebp)
+	pushl	%eax		
+	pushl	%es
+	pushl	%ds
+	pushl	%eax
+	pushl	(%ebp)
+	pushl	%edi
+	pushl	%esi
+	pushl	%edx
+	pushl	%ecx
+	pushl	%ebx
+	call	kern_do_schedule
+	movl	%ebp, %esp
+	pop	%ebp
+	ret
+#endif
+
 .data
 ENTRY(sys_call_table)
 	.long sys_restart_syscall	/* 0 - old "setup()" system call, used for restarting */
arch/i386/kernel/irq.c +3 -3
@@ -410,7 +410,7 @@
  * SMP cross-CPU interrupts have their own specific
  * handlers).
  */
-asmlinkage unsigned int do_IRQ(struct pt_regs regs)
+asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
 {	
 	/* 
 	 * We ack quickly, we don't want the irq controller
@@ -422,7 +422,7 @@
 	 * 0 return value means that this irq is already being
 	 * handled by some other CPU. (or is disabled)
 	 */
-	int irq = regs.orig_eax & 0xff; /* high bits used in ret_from_ code  */
+	int irq = regs->orig_eax & 0xff; /* high bits used in ret_from_ code  */
 	irq_desc_t *desc = irq_desc + irq;
 	struct irqaction * action;
 	unsigned int status;
@@ -488,7 +488,7 @@
 		irqreturn_t action_ret;
 
 		spin_unlock(&desc->lock);
-		action_ret = handle_IRQ_event(irq, &regs, action);
+		action_ret = handle_IRQ_event(irq, regs, action);
 		spin_lock(&desc->lock);
 		if (!noirqdebug)
 			note_interrupt(irq, desc, action_ret);
#1 lore raw

Hi,

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

-Amit

Quoted 9 lines · Pavel Machek

Hi!

This is based on current CVS version. If you want just basic functionality, apply core-lite.patch and i386-lite.patch. If you want all the features, add core.patch and i386.patch.

Amit, this should be "step 1: split" we were talking about. Could you test it looks sane and add it to the cvs?
Pavel

#2 lore raw
Quoted 7 lines · Amit S. Kale

Hi,

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#3 lore raw

Hi!

Quoted 8 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#4 lore raw
Quoted 8 lines · Pavel Machek

Hi!

Quoted 6 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

Quoted 6 lines
Quoted 2 lines

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...

There's still a whole bunch of bogons in the -lite patch still, so I don't think it should be merged yet.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#5 lore raw

Hi!

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Quoted 6 lines
Quoted 3 lines

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...

There's still a whole bunch of bogons in the -lite patch still, so I don't think it should be merged yet.

Well, it seems to contains a *lot* less bogons than what currently is in -mm series.

What big problems do you see? It does not yet use weak symbols, but I do not think that's a serious problem. What else?
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#6 lore raw
Quoted 15 lines · Pavel Machek

Hi!

Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...

Quoted 8 lines
Quoted 2 lines

There's still a whole bunch of bogons in the -lite patch still, so I don't think it should be merged yet.

Well, it seems to contains a *lot* less bogons than what currently is in -mm series.

What big problems do you see? It does not yet use weak symbols, but I do not think that's a serious problem. What else?

The first two big ones are:
- Doesn't like gdb 6.0 (You cannot assume the first packet is Hc...)
- Wierdities with kgdb_killed_or_detached / kgdb_might_be_resumed (both can die).
- All of the function pointer games (of which the weak symbols, but not all of them) are a part of.
- Issues w/ handling 'D' and 'k' packets cleaner (and I think there was a correctness fix in there, too, but it was a while ago).
- Don't ACK packets sitting on the line
- kgdb_schedule/process_breakpoint, required for kgdboe, harmless to use on serial.

There's still a lot of stuff I checked into linux-2.6-kgdb that's non-trivially important
(http://ppc.bkbits.net:8080/linux-2.6-kgdb/ChangeSet@-4w?nav=index.html)

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#7 lore raw

Hi!

Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...

Quoted 8 lines
Quoted 2 lines

There's still a whole bunch of bogons in the -lite patch still, so I don't think it should be merged yet.

Well, it seems to contains a *lot* less bogons than what currently is in -mm series.

What big problems do you see? It does not yet use weak symbols, but I do not think that's a serious problem. What else?

Quoted 7 lines

The first two big ones are:
- Doesn't like gdb 6.0 (You cannot assume the first packet is Hc...)
- Wierdities with kgdb_killed_or_detached / kgdb_might_be_resumed (both can die).
- Issues w/ handling 'D' and 'k' packets cleaner (and I think there was a correctness fix in there, too, but it was a while ago).
- Don't ACK packets sitting on the line

Okay, these look important but probably only touch core-lite, right? So it should be easy to merge. Can you generate diff?

I'll try to import kgdb into quilt to make working with it easier. [But don't expect miracles.]

Quoted 9 lines

- All of the function pointer games (of which the weak symbols, but not all of them) are a part of.
- kgdb_schedule/process_breakpoint, required for kgdboe, harmless to use on serial.

There's still a lot of stuff I checked into linux-2.6-kgdb that's non-trivially important
(http://ppc.bkbits.net:8080/linux-2.6-kgdb/ChangeSet@-4w?nav=index.html)

Hmm, I'm not allowed to use bt :-(.

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#8 lore raw
Quoted 32 lines · Pavel Machek

Hi!

Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...

Quoted 8 lines
Quoted 2 lines

There's still a whole bunch of bogons in the -lite patch still, so I don't think it should be merged yet.

Well, it seems to contains a *lot* less bogons than what currently is in -mm series.

What big problems do you see? It does not yet use weak symbols, but I do not think that's a serious problem. What else?

Quoted 7 lines

The first two big ones are:
- Doesn't like gdb 6.0 (You cannot assume the first packet is Hc...)
- Wierdities with kgdb_killed_or_detached / kgdb_might_be_resumed (both can die).
- Issues w/ handling 'D' and 'k' packets cleaner (and I think there was a correctness fix in there, too, but it was a while ago).
- Don't ACK packets sitting on the line

Quoted 1 line

Okay, these look important but probably only touch core-lite, right?

Some of these also touch 8250/kgdboe patch.

Quoted 1 line

So it should be easy to merge. Can you generate diff?

I'm working on that part right now, along with a cosmetic rename / Lindent the code.

Quoted 2 lines

I'll try to import kgdb into quilt to make working with it easier. [But don't expect miracles.]

Just let us know what it takes to do so. :)

Quoted 11 lines
Quoted 9 lines

- All of the function pointer games (of which the weak symbols, but not all of them) are a part of.
- kgdb_schedule/process_breakpoint, required for kgdboe, harmless to use on serial.

There's still a lot of stuff I checked into linux-2.6-kgdb that's non-trivially important
(http://ppc.bkbits.net:8080/linux-2.6-kgdb/ChangeSet@-4w?nav=index.html)

Hmm, I'm not allowed to use bt :-(.

You can look at it all via the web 'tho. There's nothing to agree to, to view the web page :)

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#9 lore raw

Hi!

Quoted 4 lines
Quoted 2 lines

I'll try to import kgdb into quilt to make working with it easier. [But don't expect miracles.]

Just let us know what it takes to do so. :)

This is what I did to get it under quilt. (Then, patches directory should be put under CVS and replace what we have in the CVS now).

root@amd:/usr/src# cp -a clean.2.5/ linux-mm
root@amd:/usr/src/linux-mm# exit
pavel@amd:/usr/src$ cd linux-mm
pavel@amd:/usr/src/linux-mm$ mkdir patches
pavel@amd:/usr/src/linux-mm$ mkdir txt
pavel@amd:/usr/src/linux-mm$ mkdir .pc
pavel@amd:/usr/src/linux-mm$ quilt import -n core-lite ~/sf/kgdb-2/core-lite.patch
Importing patch core-lite (stored as patches/core-lite)
pavel@amd:/usr/src/linux-mm$ quilt import -n i386-lite ~/sf/kgdb-2/i386-lite.patch
Importing patch i386-lite (stored as patches/i386-lite)
pavel@amd:/usr/src/linux-mm$ quilt import -n 8250 ~/sf/kgdb-2/8250.patch
Importing patch 8250 (stored as patches/8250)
pavel@amd:/usr/src/linux-mm$ quilt import -n x86_64 ~/sf/kgdb-2/x86_64.patch
Importing patch x86_64 (stored as patches/x86_64)
pavel@amd:/usr/src/linux-mm$ quilt import -n ppc ~/sf/kgdb-2/ppc.patch
Importing patch ppc (stored as patches/ppc)
pavel@amd:/usr/src/linux-mm$ quilt import -n core ~/sf/kgdb-2/core.patch
Importing patch core (stored as patches/core)
pavel@amd:/usr/src/linux-mm$ quilt import -n i386 ~/sf/kgdb-2/i386.patch
Importing patch i386 (stored as patches/i386)
pavel@amd:/usr/src/linux-mm$ quilt import -n eth ~/sf/kgdb-2/eth.patch
Importing patch eth (stored as patches/eth)
pavel@amd:/usr/src/linux-mm$

At this point project is controlled with quilt. If I do

pavel@amd:/usr/src/linux-mm$ quilt push 5
Applying eth
...

It applies all -lite patches and non-conflicting patches. I can modify them as I wish. At the end I need to do quilt refresh <whatever patch I changed>.

If I wanted my changes to go into the non-lite version, instead, I'd have to begin with quilt push 7.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

- All of the function pointer games (of which the weak symbols, but not all of them) are a part of.
- kgdb_schedule/process_breakpoint, required for kgdboe, harmless to use on serial.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

There's still a lot of stuff I checked into linux-2.6-kgdb that's non-trivially important
(http://ppc.bkbits.net:8080/linux-2.6-kgdb/ChangeSet@-4w?nav=index.html)

Hmm, I'm not allowed to use bt :-(.

You can look at it all via the web 'tho. There's nothing to agree to, to view the web page :)

Well, I took a look at the web page, but could not find all the kgdb-related changes easily...
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#10 lore raw
Quoted 9 lines · Pavel Machek

Hi!

Quoted 4 lines
Quoted 2 lines

I'll try to import kgdb into quilt to make working with it easier. [But don't expect miracles.]

Just let us know what it takes to do so. :)

This is what I did to get it under quilt. (Then, patches directory should be put under CVS and replace what we have in the CVS now).

Quilt is a great tool!

I follow a slightly different procedure.
I manually copy files from patches directory to cvs tree and back.

I trash my tree too many times, perhaps because I am new to quilt. Above procedure saves my cvs tree. While cvs is meant for precisely this purpose (save repository in a separate place where it can't be trashed), cvs sync can take a long time when done over internet.

-Amit

Quoted 59 lines
root@amd:/usr/src# cp -a clean.2.5/ linux-mm
root@amd:/usr/src/linux-mm# exit
pavel@amd:/usr/src$ cd linux-mm
pavel@amd:/usr/src/linux-mm$ mkdir patches
pavel@amd:/usr/src/linux-mm$ mkdir txt
pavel@amd:/usr/src/linux-mm$ mkdir .pc
pavel@amd:/usr/src/linux-mm$ quilt import -n core-lite
~/sf/kgdb-2/core-lite.patch Importing patch core-lite (stored as
patches/core-lite)
pavel@amd:/usr/src/linux-mm$ quilt import -n i386-lite
~/sf/kgdb-2/i386-lite.patch Importing patch i386-lite (stored as
patches/i386-lite)
pavel@amd:/usr/src/linux-mm$ quilt import -n 8250 ~/sf/kgdb-2/8250.patch
Importing patch 8250 (stored as patches/8250)
pavel@amd:/usr/src/linux-mm$ quilt import -n x86_64
~/sf/kgdb-2/x86_64.patch Importing patch x86_64 (stored as patches/x86_64)
pavel@amd:/usr/src/linux-mm$ quilt import -n ppc ~/sf/kgdb-2/ppc.patch
Importing patch ppc (stored as patches/ppc)
pavel@amd:/usr/src/linux-mm$ quilt import -n core ~/sf/kgdb-2/core.patch
Importing patch core (stored as patches/core)
pavel@amd:/usr/src/linux-mm$ quilt import -n i386 ~/sf/kgdb-2/i386.patch
Importing patch i386 (stored as patches/i386)
pavel@amd:/usr/src/linux-mm$ quilt import -n eth ~/sf/kgdb-2/eth.patch
Importing patch eth (stored as patches/eth)
pavel@amd:/usr/src/linux-mm$

At this point project is controlled with quilt. If I do

pavel@amd:/usr/src/linux-mm$ quilt push 5
Applying eth
...

It applies all -lite patches and non-conflicting patches. I can modify them as I wish. At the end I need to do quilt refresh <whatever patch I changed>.

If I wanted my changes to go into the non-lite version, instead, I'd have to begin with quilt push 7.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

- All of the function pointer games (of which the weak symbols, but not all of them) are a part of.
- kgdb_schedule/process_breakpoint, required for kgdboe, harmless to use on serial.

There's still a lot of stuff I checked into linux-2.6-kgdb that's non-trivially important
(http://ppc.bkbits.net:8080/linux-2.6-kgdb/ChangeSet@-4w?nav=index.ht
ml)

Quoted 4 lines
Quoted 1 line

Hmm, I'm not allowed to use bt :-(.

You can look at it all via the web 'tho. There's nothing to agree to, to view the web page :)

Well, I took a look at the web page, but could not find all the kgdb-related changes easily...
Pavel

#11 lore raw
In reply to Tom Rini
Quoted 20 lines · Tom Rini
Quoted 19 lines · Pavel Machek

Hi!

Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

Quoted 7 lines
Quoted 3 lines

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...

There's still a whole bunch of bogons in the -lite patch still, so I don't think it should be merged yet.

Quoted 8 lines
Quoted 5 lines

Well, it seems to contains a *lot* less bogons than what currently is in -mm series.

What big problems do you see? It does not yet use weak symbols, but I do not think that's a serious problem. What else?

The first two big ones are:
- Doesn't like gdb 6.0 (You cannot assume the first packet is Hc...)

Can you tell me more about this?

Quoted 2 lines

- Wierdities with kgdb_killed_or_detached / kgdb_might_be_resumed (both can die).

Yes. These have to be thought over again. I don't think a perfect solution exists for all problems related to gdb kill/die followed by a reattach. We should attempt a proper design describing different scenarios.

Quoted 4 lines

- All of the function pointer games (of which the weak symbols, but not all of them) are a part of.
- Issues w/ handling 'D' and 'k' packets cleaner (and I think there was a correctness fix in there, too, but it was a while ago).

Is this wrt kgdb_killed.., kgdb_might..., remove breakpoints?

Quoted 1 line

- Don't ACK packets sitting on the line

More info please.

-Amit

Quoted 6 lines

- kgdb_schedule/process_breakpoint, required for kgdboe, harmless to use on serial.

There's still a lot of stuff I checked into linux-2.6-kgdb that's non-trivially important
(http://ppc.bkbits.net:8080/linux-2.6-kgdb/ChangeSet@-4w?nav=index.html)

#12 lore raw
Quoted 22 lines · Amit S. Kale
Quoted 21 lines · Tom Rini
Quoted 20 lines · Pavel Machek
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

Tested (core-lite.patch + i386-lite.patch + 8250.patch) combination. Looks good.

Let's first check this in and then do more cleanups. Tom, does it sound ok?

This sounds fine to me. Pavel, I'm guessing you did this with quilt, could you provide some pointers on how to replicate this in the future?

Quoted 6 lines
Quoted 3 lines

Unfortunately, I done it by hand :-(. But if -lite parts are not merged, soon, I'll be forced to start using quilt. Doing stuff by hand is quite painfull...

There's still a whole bunch of bogons in the -lite patch still, so I don't think it should be merged yet.

Well, it seems to contains a *lot* less bogons than what currently is in -mm series.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

What big problems do you see? It does not yet use weak symbols, but I do not think that's a serious problem. What else?

The first two big ones are:
- Doesn't like gdb 6.0 (You cannot assume the first packet is Hc...)

Can you tell me more about this?

You make an assumption that the first packet is $Hc..., which you cannot do. gdb 6's first packet is $qOffsets. I'll post the patch for this shortly.

Quoted 6 lines
Quoted 2 lines

- Wierdities with kgdb_killed_or_detached / kgdb_might_be_resumed (both can die).

Yes. These have to be thought over again. I don't think a perfect solution exists for all problems related to gdb kill/die followed by a reattach. We should attempt a proper design describing different scenarios.

I don't see the problem to be delt with. GDB reconnecting is not a special case.

Quoted 6 lines
Quoted 4 lines

- All of the function pointer games (of which the weak symbols, but not all of them) are a part of.
- Issues w/ handling 'D' and 'k' packets cleaner (and I think there was a correctness fix in there, too, but it was a while ago).

Is this wrt kgdb_killed.., kgdb_might..., remove breakpoints?

This will be part of the patch I hope to post today:
http://ppc.bkbits.net:8080/linux-2.6-kgdb/[email protected]?nav=index.html|ChangeSet@-4w|[email protected]

Quoted 3 lines
Quoted 1 line

- Don't ACK packets sitting on the line

More info please.

I see you've already taken this bit:
http://ppc.bkbits.net:8080/linux-2.6-kgdb/[email protected]?nav=index.html|ChangeSet@-4w|[email protected]

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#13 lore raw
Quoted 2 lines · Tom Rini
Quoted 1 line · Amit S. Kale

On Wednesday 25 Feb 2004 5:08 am, Tom Rini wrote:

[snip]

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

- Issues w/ handling 'D' and 'k' packets cleaner (and I think there was a correctness fix in there, too, but it was a while ago).

Is this wrt kgdb_killed.., kgdb_might..., remove breakpoints?

This will be part of the patch I hope to post today:
http://ppc.bkbits.net:8080/linux-2.6-kgdb/[email protected]?nav=index.html|ChangeSet@-4w|[email protected]

After looking at what's in your stub now, and at the gdb source code, I've filed a gdb bug (remote/1571) as the protocol docs and code don't agree on what's expected from a detach. The docs say that gdb doesn't look for a reply (so we wouldn't/shouldn't make one) but the code does, and will print out an error code, if one happens. So I'm going to leave this bit of code alone for now.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/