提交 8d3e74a4 编写于 作者: A Alessandro Arzilli 提交者: Derek Parker

proc/gdbserial: fix passing arguments to target via debugserver (#843)

Debugserver does not work as documented, "--" needs to be specified to
pass arguments to the target process (but only if it's an argument that
starts with a dash).

Fixes #839
上级 82d142d1
......@@ -332,8 +332,8 @@ func LLDBLaunch(cmd []string, wd string) (*Process, error) {
return nil, err
}
listener.(*net.TCPListener).SetDeadline(time.Now().Add(maxConnectAttempts * time.Second))
args := make([]string, 0, len(cmd)+3)
args = append(args, "-F", "-R", fmt.Sprintf("127.0.0.1:%d", listener.Addr().(*net.TCPAddr).Port))
args := make([]string, 0, len(cmd)+4)
args = append(args, "-F", "-R", fmt.Sprintf("127.0.0.1:%d", listener.Addr().(*net.TCPAddr).Port), "--")
args = append(args, cmd...)
isDebugserver = true
......
......@@ -1910,6 +1910,7 @@ func TestCmdLineArgs(t *testing.T) {
// make sure multiple arguments (including one with spaces) are passed to the binary correctly
withTestProcessArgs("testargs", t, ".", expectSuccess, []string{"test"})
withTestProcessArgs("testargs", t, ".", expectPanic, []string{"-test"})
withTestProcessArgs("testargs", t, ".", expectSuccess, []string{"test", "pass flag"})
// check that arguments with spaces are *only* passed correctly when correctly called
withTestProcessArgs("testargs", t, ".", expectPanic, []string{"test pass", "flag"})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册