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:
Alessandro Arzilli
2023-05-09 20:40:00 +02:00
committed by GitHub
parent 801a9109c7
commit e95ae9c21b
18 changed files with 310 additions and 67 deletions

View File

@ -19,6 +19,8 @@ var ErrNotExecutable = errors.New("not an executable file")
type DebuggerState struct {
// PID of the process we are debugging.
Pid int
// Command line of the process we are debugging.
TargetCommandLine string
// Running is true if the process is running and no other information can be collected.
Running bool
// Recording is true if the process is currently being recorded and no other