Title: [9136] trunk/kernel/kgdb.c: Fix bug[#6189] kgdb: return correct thread id when single step over a
Revision
9136
Author
sonicz
Date
2010-09-14 04:34:15 -0400 (Tue, 14 Sep 2010)

Log Message

Fix bug[#6189] kgdb: return correct thread id when single step over a
breakpoint on current cpu.

Switch to current cpu is allowed in kgdb SMP kernel. If 
1) kernel traps into kgdb at a breakpoint;
2) gdb asks to switch to current cpu thread (-cpu_id -2);
3) gdb asks to continue;

Hc, s and c gdb ops are issued in sequence to skip the breakpoint with
current cpu thread id. But, kgdb always returns the thread id of current
process after the single step is done, which confuses gdb. This patch
return the thread id which Hc is issued with.

Modified Paths

Diff

Modified: trunk/kernel/kgdb.c (9135 => 9136)


--- trunk/kernel/kgdb.c	2010-09-13 17:50:37 UTC (rev 9135)
+++ trunk/kernel/kgdb.c	2010-09-14 08:34:15 UTC (rev 9136)
@@ -1047,6 +1047,10 @@
 	}
 }
 
+#ifdef CONFIG_SMP
+static int cont_curr_cpu_thread;
+#endif
+
 /* Handle the 'H' task query packets */
 static int gdb_cmd_task(struct kgdb_state *ks)
 {
@@ -1088,6 +1092,8 @@
 				break;
 			}
 			kgdb_contthread = thread;
+			if (ks->threadid == shadow_pid(0))
+				cont_curr_cpu_thread = 1;
 		}
 		strcpy(remcom_out_buffer, "OK");
 		break;
@@ -1235,6 +1241,12 @@
 			*ptr++ = 'T';
 			ptr = pack_hex_byte(ptr, ks->signo);
 			ptr += strlen(strcpy(ptr, "thread:"));
+#ifdef CONFIG_SMP
+			if (cont_curr_cpu_thread) {
+				int_to_threadref(thref, shadow_pid(0));
+				cont_curr_cpu_thread = 0;
+			} else
+#endif
 			int_to_threadref(thref, shadow_pid(current->pid));
 			ptr = pack_threadid(ptr, thref);
 			*ptr++ = ';';
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to