Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
fbfad819
D
delve
项目概览
HugeYuan
/
delve
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
delve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fbfad819
编写于
12月 10, 2020
作者:
A
Alessandro Arzilli
提交者:
GitHub
12月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc/gdbserial: use --unmask-signal debugserver option (#2255)
Fixes #852 Co-authored-by:
N
a
<
a@kra
>
上级
d3e9158e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
1 deletion
+25
-1
pkg/proc/gdbserial/gdbserver.go
pkg/proc/gdbserial/gdbserver.go
+25
-1
未找到文件。
pkg/proc/gdbserial/gdbserver.go
浏览文件 @
fbfad819
...
...
@@ -74,6 +74,7 @@ import (
"runtime"
"strconv"
"strings"
"sync"
"time"
"golang.org/x/arch/x86/x86asm"
...
...
@@ -90,6 +91,8 @@ const (
maxTransmitAttempts
=
3
// number of retransmission attempts on failed checksum
initialInputBufferSize
=
2048
// size of the input buffer for gdbConn
debugServerEnvVar
=
"DELVE_DEBUGSERVER_PATH"
// use this environment variable to override the path to debugserver used by Launch/Attach
)
const
heartbeatInterval
=
10
*
time
.
Second
...
...
@@ -126,6 +129,9 @@ var debugserverExecutablePaths = []string{
// while there are still internal breakpoints set.
var
ErrDirChange
=
errors
.
New
(
"direction change with internal breakpoints"
)
var
checkCanUnmaskSignalsOnce
sync
.
Once
var
canUnmaskSignalsCached
bool
// gdbProcess implements proc.Process using a connection to a debugger stub
// that understands Gdb Remote Serial Protocol.
type
gdbProcess
struct
{
...
...
@@ -330,6 +336,9 @@ func unusedPort() string {
// getDebugServerAbsolutePath returns a string of the absolute path to the debugserver binary IFF it is
// found in the system path ($PATH), the Xcode bundle or the standalone CLT location.
func
getDebugServerAbsolutePath
()
string
{
if
path
:=
os
.
Getenv
(
debugServerEnvVar
);
path
!=
""
{
return
path
}
for
_
,
debugServerPath
:=
range
debugserverExecutablePaths
{
if
debugServerPath
==
""
{
continue
...
...
@@ -341,6 +350,14 @@ func getDebugServerAbsolutePath() string {
return
""
}
func
canUnmaskSignals
(
debugServerExecutable
string
)
bool
{
checkCanUnmaskSignalsOnce
.
Do
(
func
()
{
buf
,
_
:=
exec
.
Command
(
debugServerExecutable
,
"--unmask-singals"
)
.
CombinedOutput
()
canUnmaskSignalsCached
=
!
strings
.
Contains
(
string
(
buf
),
"unrecognized option"
)
})
return
canUnmaskSignalsCached
}
// commandLogger is a wrapper around the exec.Command() function to log the arguments prior to
// starting the process
func
commandLogger
(
binary
string
,
arguments
...
string
)
*
exec
.
Cmd
{
...
...
@@ -421,6 +438,9 @@ func LLDBLaunch(cmd []string, wd string, flags proc.LaunchFlags, debugInfoDirs [
if
flags
&
proc
.
LaunchDisableASLR
!=
0
{
args
=
append
(
args
,
"-D"
)
}
if
canUnmaskSignals
(
debugserverExecutable
)
{
args
=
append
(
args
,
"--unmask-signals"
)
}
args
=
append
(
args
,
"-F"
,
"-R"
,
fmt
.
Sprintf
(
"127.0.0.1:%d"
,
listener
.
Addr
()
.
(
*
net
.
TCPAddr
)
.
Port
),
"--"
)
args
=
append
(
args
,
cmd
...
)
...
...
@@ -500,7 +520,11 @@ func LLDBAttach(pid int, path string, debugInfoDirs []string) (*proc.Target, err
if
err
!=
nil
{
return
nil
,
err
}
process
=
commandLogger
(
debugserverExecutable
,
"-R"
,
fmt
.
Sprintf
(
"127.0.0.1:%d"
,
listener
.
Addr
()
.
(
*
net
.
TCPAddr
)
.
Port
),
"--attach="
+
strconv
.
Itoa
(
pid
))
args
:=
[]
string
{
"-R"
,
fmt
.
Sprintf
(
"127.0.0.1:%d"
,
listener
.
Addr
()
.
(
*
net
.
TCPAddr
)
.
Port
),
"--attach="
+
strconv
.
Itoa
(
pid
)}
if
canUnmaskSignals
(
debugserverExecutable
)
{
args
=
append
(
args
,
"--unmask-signals"
)
}
process
=
commandLogger
(
debugserverExecutable
,
args
...
)
}
else
{
if
_
,
err
=
exec
.
LookPath
(
"lldb-server"
);
err
!=
nil
{
return
nil
,
&
ErrBackendUnavailable
{}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录