mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 04:35:19 +08:00
*: Add --tty flag for debug / exec
This flag allows users on UNIX systems to set the tty for the program being debugged by Delve. This is useful for debugging command line applications which need access to their own TTY, and also for controlling the output of the debugged programs so that IDEs may open a dedicated terminal to show the output for the process.
This commit is contained in:
@ -91,6 +91,10 @@ type Config struct {
|
||||
// used to compile the executable and refuse to work on incompatible
|
||||
// versions.
|
||||
CheckGoVersion bool
|
||||
|
||||
// TTY is passed along to the target process on creation. Used to specify a
|
||||
// TTY for that process.
|
||||
TTY string
|
||||
}
|
||||
|
||||
// New creates a new Debugger. ProcessArgs specify the commandline arguments for the
|
||||
@ -195,9 +199,9 @@ func (d *Debugger) Launch(processArgs []string, wd string) (*proc.Target, error)
|
||||
}
|
||||
switch d.config.Backend {
|
||||
case "native":
|
||||
return native.Launch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories)
|
||||
return native.Launch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY)
|
||||
case "lldb":
|
||||
return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories))
|
||||
return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY))
|
||||
case "rr":
|
||||
if d.target != nil {
|
||||
// restart should not call us if the backend is 'rr'
|
||||
@ -239,9 +243,9 @@ func (d *Debugger) Launch(processArgs []string, wd string) (*proc.Target, error)
|
||||
|
||||
case "default":
|
||||
if runtime.GOOS == "darwin" {
|
||||
return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories))
|
||||
return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY))
|
||||
}
|
||||
return native.Launch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories)
|
||||
return native.Launch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY)
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown backend %q", d.config.Backend)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user