delve icon indicating copy to clipboard operation
delve copied to clipboard

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

Open llhuii opened this issue 4 years ago • 5 comments

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?

llhuii avatar Dec 01 '20 08:12 llhuii

p os.Args will do this

aarzilli avatar Dec 01 '20 13:12 aarzilli

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 avatar Dec 02 '20 02:12 llhuii

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

llhuii avatar Dec 02 '20 02:12 llhuii

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.

aarzilli avatar Dec 03 '20 10:12 aarzilli

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

hitzhangjie avatar Aug 06 '21 05:08 hitzhangjie