Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to show the arguments of current debugged like gdb show args #2242

Closed
llhuii opened this issue Dec 1, 2020 · 5 comments · Fixed by #3346
Closed

Allow users to show the arguments of current debugged like gdb show args #2242

llhuii opened this issue Dec 1, 2020 · 5 comments · Fixed by #3346

Comments

@llhuii
Copy link

llhuii commented Dec 1, 2020

Now dlv has no method to show the arguments of current debugged program in the dlv interactive cmd.

Can we add a command to show current running arguments like gdb show args?

@aarzilli
Copy link
Member

aarzilli commented Dec 1, 2020

p os.Args will do this

@llhuii
Copy link
Author

llhuii commented Dec 2, 2020

Seems p os.Args can't do this? image

p os.Args will do this

=== updated ==

p os.Args works after run to a breakpoint.

@llhuii
Copy link
Author

llhuii commented Dec 2, 2020

another problem with p os.Args is that the program should be running, otherwise it reports this (dlv) p os.Args Process 23179 has exited with status 0

@aarzilli
Copy link
Member

aarzilli commented Dec 3, 2020

os.Args needs to be initialized by the go runtime so it won't be available immediately after starting a program. Also, as you note, you can't read it after the program has quit. But features have a complexity cost and I don't think it's worth paying it to cover this edge cases.

@hitzhangjie
Copy link
Contributor

hitzhangjie commented Aug 6, 2021

To run 'p os.Args' at breakpoint 'main.main' may meet your needs. @llhuii

aarzilli added a commit to aarzilli/delve that referenced this issue Aug 4, 2022
When attaching to child processes in follow exec mode, read their
command line.
Use it to match the follow exec regexp and also display it in the
traget list.

Updates go-delve#2242
aarzilli added a commit to aarzilli/delve that referenced this issue Aug 12, 2022
When attaching to child processes in follow exec mode, read their
command line.
Use it to match the follow exec regexp and also display it in the
traget list.

Updates go-delve#2242
aarzilli added a commit to aarzilli/delve that referenced this issue Sep 27, 2022
When attaching to child processes in follow exec mode, read their
command line.
Use it to match the follow exec regexp and also display it in the
traget list.

Updates go-delve#2242
aarzilli added a commit to aarzilli/delve that referenced this issue Jan 13, 2023
When attaching to child processes in follow exec mode, read their
command line.
Use it to match the follow exec regexp and also display it in the
traget list.

Updates go-delve#2242
aarzilli added a commit to aarzilli/delve that referenced this issue Feb 23, 2023
… proc,terminal: read command line of new processes

When attaching to child processes in follow exec mode, read their
command line.
Use it to match the follow exec regexp and also display it in the
traget list.

Updates go-delve#2242
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 28, 2023
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 go-delve#2242
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 28, 2023
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 go-delve#2242
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 28, 2023
… proc,terminal: read command line of new processes

When attaching to child processes in follow exec mode, read their
command line.
Use it to match the follow exec regexp and also display it in the
traget list.

Updates go-delve#2242
derekparker pushed a commit that referenced this issue May 9, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants