Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/goPublic

Commit0d2f5c0

Browse files
committed
[release-branch.go1.2] runtime: if traceback sees a breakpoint, don't change the PC
««« CL 49580044 / 38cd458b1dferuntime: if traceback sees a breakpoint, don't change the PCChanging the PC confuses gdb, because execution does notcontinue where gdb expects it. Not changing the PC has thepotential to confuse a stack dump, but when running under gdbit seems better to confuse a stack dump than to confuse gdb.Fixes#6776.LGTM=rscR=golang-codereviews, dvyukov, rscCC=golang-codereviewshttps://golang.org/cl/49580044»»»LGTM=rR=golang-codereviews, rCC=golang-devhttps://golang.org/cl/69800043
1 parent495b914 commit0d2f5c0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎src/pkg/runtime/sys_x86.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ runtime·rewindmorestack(Gobuf *gobuf)
3737
gobuf->pc=gobuf->pc+2+*(int8*)(pc+1);
3838
return;
3939
}
40+
if(pc[0]==0xcc) {
41+
// This is a breakpoint inserted by gdb. We could use
42+
// runtime·findfunc to find the function. But if we
43+
// do that, then we will continue execution at the
44+
// function entry point, and we will not hit the gdb
45+
// breakpoint. So for this case we don't change
46+
// gobuf->pc, so that when we return we will execute
47+
// the jump instruction and carry on. This means that
48+
// stack unwinding may not work entirely correctly
49+
// (http://golang.org/issue/5723) but the user is
50+
// running under gdb anyhow.
51+
return;
52+
}
4053
runtime·printf("runtime: pc=%p %x %x %x %x %x\n",pc,pc[0],pc[1],pc[2],pc[3],pc[4]);
4154
runtime·throw("runtime: misuse of rewindmorestack");
4255
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp