aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2014-01-08 12:36:31 -0800
committerIan Lance Taylor <iant@golang.org>2014-01-08 12:36:31 -0800
commit89c5d178785bd7884dbb14d73f85f600196d6cb6 (patch)
tree3b1e8c356913d2d06b0497a77308251187605674 /src/pkg/runtime
parenta03e8a5be017f4741c029c04a3333bb655ab8059 (diff)
downloadgo-89c5d178785bd7884dbb14d73f85f600196d6cb6.tar.xz
runtime: handle gdb breakpoint in x86 traceback
This lets stack splits work correctly when running under gdb when gdb has inserted a breakpoint somewhere on the call stack. Fixes #6834. R=golang-codereviews, minux.ma CC=golang-codereviews https://golang.org/cl/48650043
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/sys_x86.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pkg/runtime/sys_x86.c b/src/pkg/runtime/sys_x86.c
index e68ff514a2..bddfb8a889 100644
--- a/src/pkg/runtime/sys_x86.c
+++ b/src/pkg/runtime/sys_x86.c
@@ -27,7 +27,8 @@ void
runtime·rewindmorestack(Gobuf *gobuf)
{
byte *pc;
-
+ Func *f;
+
pc = (byte*)gobuf->pc;
if(pc[0] == 0xe9) { // jmp 4-byte offset
gobuf->pc = gobuf->pc + 5 + *(int32*)(pc+1);
@@ -37,6 +38,13 @@ runtime·rewindmorestack(Gobuf *gobuf)
gobuf->pc = gobuf->pc + 2 + *(int8*)(pc+1);
return;
}
+ if(pc[0] == 0xcc) { // breakpoint inserted by gdb
+ f = runtime·findfunc(gobuf->pc);
+ if(f != nil) {
+ gobuf->pc = f->entry;
+ return;
+ }
+ }
runtime·printf("runtime: pc=%p %x %x %x %x %x\n", pc, pc[0], pc[1], pc[2], pc[3], pc[4]);
runtime·throw("runtime: misuse of rewindmorestack");
}