This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux


On Wed, Mar 21 2018, Simon Marchi wrote:

> On 2018-03-21 09:15 AM, Andreas Arnez wrote:
>> Currently "info proc cmdline" on GNU/Linux does not show the full command
>> line, but only argument 0.  And even a warning is shown if there are more.
>> This was discussed in 2014 already:
>> 
>>   https://sourceware.org/ml/gdb-patches/2014-04/msg00212.html
>> 
>> Follow the advice there and avoid target_fileio_read_stralloc.  Instead,
>> use target_fileio_read_alloc to read the whole command line and then
>> replace NUL characters by spaces.  Also add an appropriate test case.
>> Note that gdbserver already handles this correctly.
>
> Hi Andreas,
>
> This LGTM with two minor nits:
>

[...]

>>  
>> +# Set command line arguments to be verified later with "info proc
>> +# cmdline".  However, if we're using a stub, then "set args" would not
>> +# have any effect, so then just skip this.
>> +
>> +set cmdline ""
>> +if { ! [target_info exists use_gdb_stub] } {
>
> The use_gdb_stub proc from lib/gdb.exp should be used instead (its comment
> explains why).

Ah, OK.  There are still some occurrences of "target_info exists
use_gdb_stub" in the test suite.  Should these be replaced as well?

>
>> +    set cmdline "-i foo bar -o baz 1234"
>> +    gdb_test_no_output "set args $cmdline" "set args"
>> +}
>> +
>>  if { ! [ runto_main ] } then {
>>      untested "could not run to main"
>>      return -1
>> @@ -50,6 +60,9 @@ gdb_test "info proc mapping" \
>>  	"info proc mapping"
>>  
>>  if {[istarget "*-*-linux*"]} {
>> +    if { $cmdline != "" } {
>> +	gdb_test "info proc cmdline" "cmdline = \'.* $cmdline\'"
>
> The backslashes are unnecessary.

Right.

Thanks for your review.  Pushed with these fixes.

--
Andreas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]