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
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);
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");
}