mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 04:35:19 +08:00
proc,terminal: read command line of new processes (#3346)
Read the command line of the main target process as well as any other process Delve attaches to in follow exec mode. The command line can be viewed using the 'target list' command. In follow exec mode this command line is used to match the follow exec regex to decide whether or not to attach to a child process. On macOS or when using rr the list of arguments is not available for attached processes since there is no way to use the gdb serial protocol to read it. Fixes #2242
This commit is contained in:
committed by
GitHub
parent
801a9109c7
commit
e95ae9c21b
@ -176,7 +176,7 @@ func New(config *Config, processArgs []string) (*Debugger, error) {
|
||||
switch d.config.Backend {
|
||||
case "rr":
|
||||
d.log.Infof("opening trace %s", d.config.CoreFile)
|
||||
d.target, err = gdbserial.Replay(d.config.CoreFile, false, false, d.config.DebugInfoDirectories, d.config.RrOnProcessPid)
|
||||
d.target, err = gdbserial.Replay(d.config.CoreFile, false, false, d.config.DebugInfoDirectories, d.config.RrOnProcessPid, "")
|
||||
default:
|
||||
d.log.Infof("opening core file %s (executable %s)", d.config.CoreFile, d.processArgs[0])
|
||||
d.target, err = core.OpenCore(d.config.CoreFile, d.processArgs[0], d.config.DebugInfoDirectories)
|
||||
@ -335,7 +335,7 @@ func (d *Debugger) recordingRun(run func() (string, error)) (*proc.TargetGroup,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return gdbserial.Replay(tracedir, false, true, d.config.DebugInfoDirectories, 0)
|
||||
return gdbserial.Replay(tracedir, false, true, d.config.DebugInfoDirectories, 0, strings.Join(d.processArgs, " "))
|
||||
}
|
||||
|
||||
// Attach will attach to the process specified by 'pid'.
|
||||
@ -568,6 +568,7 @@ func (d *Debugger) state(retLoadCfg *proc.LoadConfig, withBreakpointInfo bool) (
|
||||
|
||||
state = &api.DebuggerState{
|
||||
Pid: tgt.Pid(),
|
||||
TargetCommandLine: tgt.CmdLine,
|
||||
SelectedGoroutine: goroutine,
|
||||
Exited: exited,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user