patch-2.2.0-pre5 linux/arch/i386/kernel/ptrace.c

Next file: linux/arch/i386/kernel/smp.c
Previous file: linux/arch/i386/config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre4/linux/arch/i386/kernel/ptrace.c linux/arch/i386/kernel/ptrace.c
@@ -67,6 +67,33 @@
 	return 0;
 }
 
+extern int _stext, _etext;
+static void print_child_state(struct task_struct *task)
+{
+	unsigned int * stack = (unsigned int *) task->tss.esp0;
+	int count = 40;
+
+	printk("Process: %s (stack=%p, task=%p)\n", task->comm, stack, task);
+	for (;;) {
+		unsigned int data;
+		if ((unsigned int) stack < (unsigned int) task)
+			break;
+		if ((unsigned int) stack >= PAGE_SIZE + (unsigned int) task)
+			break;
+		data = *stack;
+		stack++;
+		if (data < (unsigned long) &_stext)
+			continue;
+		if (data >= (unsigned long) &_etext)
+			continue;
+		printk("[<%08x>] ", data);
+		if (--count)
+			continue;
+		break;
+	}	
+	printk("\n");
+}
+
 /*
  * This routine gets a long from any process space by following the page
  * tables. NOTE! You should check that the long isn't on a page boundary,
@@ -408,6 +435,8 @@
 	if (!(child->flags & PF_PTRACED))
 		goto out;
 	if (child->state != TASK_STOPPED) {
+print_child_state(child);
+goto out;
 		if (request != PTRACE_KILL)
 			goto out;
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov