* [PATCH] Make "info proc cmdline" show args on GNU/Linux
@ 2018-03-21 13:15 Andreas Arnez
2018-03-21 19:28 ` Simon Marchi
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Arnez @ 2018-03-21 13:15 UTC (permalink / raw)
To: gdb-patches
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.
gdb/ChangeLog:
* linux-tdep.c (linux_info_proc): For "info proc cmdline", print
command line args instead of emitting a warning.
gdb/testsuite/ChangeLog:
* gdb.base/info-proc.exp: Add test for "info proc cmdline".
---
gdb/linux-tdep.c | 20 ++++++++++++++++----
gdb/testsuite/gdb.base/info-proc.exp | 13 +++++++++++++
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index b4b87dd..0ac78c2 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -754,10 +754,22 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (cmdline_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/cmdline", pid);
- gdb::unique_xmalloc_ptr<char> cmdline
- = target_fileio_read_stralloc (NULL, filename);
- if (cmdline)
- printf_filtered ("cmdline = '%s'\n", cmdline.get ());
+ gdb_byte *buffer;
+ ssize_t len = target_fileio_read_alloc (NULL, filename, &buffer);
+
+ if (len > 0)
+ {
+ gdb::unique_xmalloc_ptr<char> cmdline ((char *) buffer);
+ ssize_t pos;
+
+ for (pos = 0; pos < len - 1; pos++)
+ {
+ if (buffer[pos] == '\0')
+ buffer[pos] = ' ';
+ }
+ buffer[len - 1] = '\0';
+ printf_filtered ("cmdline = '%s'\n", buffer);
+ }
else
warning (_("unable to open /proc file '%s'"), filename);
}
diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp
index 72355bf..eadcb15 100644
--- a/gdb/testsuite/gdb.base/info-proc.exp
+++ b/gdb/testsuite/gdb.base/info-proc.exp
@@ -38,6 +38,16 @@ gdb_test_multiple "info proc" "info proc without a process" {
}
}
+# 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] } {
+ 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\'"
+ }
set gcorefile [standard_output_file $testfile.gcore]
if {[gdb_gcore_cmd $gcorefile "save a core file"]} {
clean_restart $binfile
--
2.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux
2018-03-21 13:15 [PATCH] Make "info proc cmdline" show args on GNU/Linux Andreas Arnez
@ 2018-03-21 19:28 ` Simon Marchi
2018-03-22 9:04 ` Andreas Arnez
0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2018-03-21 19:28 UTC (permalink / raw)
To: Andreas Arnez, gdb-patches
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:
> gdb/ChangeLog:
>
> * linux-tdep.c (linux_info_proc): For "info proc cmdline", print
> command line args instead of emitting a warning.
>
> gdb/testsuite/ChangeLog:
>
> * gdb.base/info-proc.exp: Add test for "info proc cmdline".
> ---
> gdb/linux-tdep.c | 20 ++++++++++++++++----
> gdb/testsuite/gdb.base/info-proc.exp | 13 +++++++++++++
> 2 files changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
> index b4b87dd..0ac78c2 100644
> --- a/gdb/linux-tdep.c
> +++ b/gdb/linux-tdep.c
> @@ -754,10 +754,22 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
> if (cmdline_f)
> {
> xsnprintf (filename, sizeof filename, "/proc/%ld/cmdline", pid);
> - gdb::unique_xmalloc_ptr<char> cmdline
> - = target_fileio_read_stralloc (NULL, filename);
> - if (cmdline)
> - printf_filtered ("cmdline = '%s'\n", cmdline.get ());
> + gdb_byte *buffer;
> + ssize_t len = target_fileio_read_alloc (NULL, filename, &buffer);
> +
> + if (len > 0)
> + {
> + gdb::unique_xmalloc_ptr<char> cmdline ((char *) buffer);
> + ssize_t pos;
> +
> + for (pos = 0; pos < len - 1; pos++)
> + {
> + if (buffer[pos] == '\0')
> + buffer[pos] = ' ';
> + }
> + buffer[len - 1] = '\0';
> + printf_filtered ("cmdline = '%s'\n", buffer);
> + }
> else
> warning (_("unable to open /proc file '%s'"), filename);
> }
> diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp
> index 72355bf..eadcb15 100644
> --- a/gdb/testsuite/gdb.base/info-proc.exp
> +++ b/gdb/testsuite/gdb.base/info-proc.exp
> @@ -38,6 +38,16 @@ gdb_test_multiple "info proc" "info proc without a process" {
> }
> }
>
> +# 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).
> + 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.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux
2018-03-21 19:28 ` Simon Marchi
@ 2018-03-22 9:04 ` Andreas Arnez
2018-03-22 11:18 ` Simon Marchi
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Arnez @ 2018-03-22 9:04 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux
2018-03-22 9:04 ` Andreas Arnez
@ 2018-03-22 11:18 ` Simon Marchi
2018-03-22 18:46 ` Andreas Arnez
0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2018-03-22 11:18 UTC (permalink / raw)
To: Andreas Arnez; +Cc: Simon Marchi, gdb-patches
On 2018-03-22 05:04, Andreas Arnez wrote:
>>>
>>> +# 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?
Yes, they probably should.
>>
>>> + 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.
Thanks!
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux
2018-03-22 11:18 ` Simon Marchi
@ 2018-03-22 18:46 ` Andreas Arnez
2018-03-22 20:12 ` Simon Marchi
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Arnez @ 2018-03-22 18:46 UTC (permalink / raw)
To: Simon Marchi; +Cc: Simon Marchi, gdb-patches
On Thu, Mar 22 2018, Simon Marchi wrote:
> On 2018-03-22 05:04, Andreas Arnez wrote:
>>>>
>>>> +# 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?
>
> Yes, they probably should.
All right. How about the patch below?
--
Andreas
-- >8 --
Subject: [PATCH] Testsuite: fully migrate to use_gdb_stub convenience func
In the GDB test suite, there are still multiple invocations of
"target_info exists use_gdb_stub". However, the recommended way of
checking for use_gdb_stub is to call the convenience function of the same
name.
Replace these occurrences and just call "use_gdb_stub" instead.
gdb/testsuite/ChangeLog:
* gdb.ada/exec_changed.exp: Replace "target_info exists
use_gdb_stub" by "use_gdb_stub".
* gdb.ada/start.exp: Likewise.
* gdb.base/async-shell.exp: Likewise.
* gdb.base/attach-pie-misread.exp: Likewise.
* gdb.base/attach-wait-input.exp: Likewise.
* gdb.base/break-entry.exp: Likewise.
* gdb.base/break-interp.exp: Likewise.
* gdb.base/dprintf-detach.exp: Likewise.
* gdb.base/nostdlib.exp: Likewise.
* gdb.base/solib-nodir.exp: Likewise.
* gdb.base/statistics.exp: Likewise.
* gdb.base/testenv.exp: Likewise.
* gdb.mi/mi-exec-run.exp: Likewise.
* gdb.mi/mi-start.exp: Likewise.
* gdb.multi/dummy-frame-restore.exp: Likewise.
* gdb.multi/multi-arch-exec.exp: Likewise.
* gdb.multi/multi-arch.exp: Likewise.
* gdb.multi/tids.exp: Likewise.
* gdb.multi/watchpoint-multi.exp: Likewise.
* gdb.python/py-events.exp: Likewise.
* gdb.threads/attach-into-signal.exp: Likewise.
* gdb.threads/attach-stopped.exp: Likewise.
* gdb.threads/threadapply.exp: Likewise.
* lib/selftest-support.exp: Likewise.
---
gdb/testsuite/gdb.ada/exec_changed.exp | 2 +-
gdb/testsuite/gdb.ada/start.exp | 2 +-
gdb/testsuite/gdb.base/async-shell.exp | 2 +-
gdb/testsuite/gdb.base/attach-pie-misread.exp | 2 +-
gdb/testsuite/gdb.base/attach-wait-input.exp | 2 +-
gdb/testsuite/gdb.base/break-entry.exp | 2 +-
gdb/testsuite/gdb.base/break-interp.exp | 2 +-
gdb/testsuite/gdb.base/dprintf-detach.exp | 2 +-
gdb/testsuite/gdb.base/nostdlib.exp | 2 +-
gdb/testsuite/gdb.base/solib-nodir.exp | 2 +-
gdb/testsuite/gdb.base/statistics.exp | 2 +-
gdb/testsuite/gdb.base/testenv.exp | 2 +-
gdb/testsuite/gdb.mi/mi-exec-run.exp | 2 +-
gdb/testsuite/gdb.mi/mi-start.exp | 2 +-
gdb/testsuite/gdb.multi/dummy-frame-restore.exp | 2 +-
gdb/testsuite/gdb.multi/multi-arch-exec.exp | 2 +-
gdb/testsuite/gdb.multi/multi-arch.exp | 2 +-
gdb/testsuite/gdb.multi/tids.exp | 2 +-
gdb/testsuite/gdb.multi/watchpoint-multi.exp | 2 +-
gdb/testsuite/gdb.python/py-events.exp | 2 +-
gdb/testsuite/gdb.threads/attach-into-signal.exp | 2 +-
gdb/testsuite/gdb.threads/attach-stopped.exp | 2 +-
gdb/testsuite/gdb.threads/threadapply.exp | 2 +-
gdb/testsuite/lib/selftest-support.exp | 2 +-
24 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/exec_changed.exp b/gdb/testsuite/gdb.ada/exec_changed.exp
index 8070eecbb3..943a75178b 100644
--- a/gdb/testsuite/gdb.ada/exec_changed.exp
+++ b/gdb/testsuite/gdb.ada/exec_changed.exp
@@ -19,7 +19,7 @@ if { [skip_ada_tests] } { return -1 }
# This testcase verifies the behavior of the `start' command, which
# does not work when we use the gdb stub...
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "skipping tests due to use_gdb_stub"
return
}
diff --git a/gdb/testsuite/gdb.ada/start.exp b/gdb/testsuite/gdb.ada/start.exp
index 711f3dfefd..cbf615e956 100644
--- a/gdb/testsuite/gdb.ada/start.exp
+++ b/gdb/testsuite/gdb.ada/start.exp
@@ -19,7 +19,7 @@ if { [skip_ada_tests] } { return -1 }
# This testcase verifies the behavior of the `start' command, which
# does not work when we use the gdb stub...
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "skipping test due to gdb stub"
return
}
diff --git a/gdb/testsuite/gdb.base/async-shell.exp b/gdb/testsuite/gdb.base/async-shell.exp
index c7782f404a..37046d6f48 100644
--- a/gdb/testsuite/gdb.base/async-shell.exp
+++ b/gdb/testsuite/gdb.base/async-shell.exp
@@ -21,7 +21,7 @@ if { ![support_displaced_stepping] } {
}
# The testfile uses "run". The real bug happened only for ![is_remote target].
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return 0
}
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index aa7710a397..b693d3a2ba 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This test only works on GNU/Linux.
-if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
+if { ![isnative] || [is_remote host] || [use_gdb_stub]
|| ![istarget *-linux*] || [skip_shlib_tests]} {
continue
}
diff --git a/gdb/testsuite/gdb.base/attach-wait-input.exp b/gdb/testsuite/gdb.base/attach-wait-input.exp
index 67abaa22e9..776cac884c 100644
--- a/gdb/testsuite/gdb.base/attach-wait-input.exp
+++ b/gdb/testsuite/gdb.base/attach-wait-input.exp
@@ -29,7 +29,7 @@
# simpler to do, so we test with both editing on and off.
# The test uses the "attach" command.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return
}
diff --git a/gdb/testsuite/gdb.base/break-entry.exp b/gdb/testsuite/gdb.base/break-entry.exp
index 8775b38a39..85de662a6d 100644
--- a/gdb/testsuite/gdb.base/break-entry.exp
+++ b/gdb/testsuite/gdb.base/break-entry.exp
@@ -27,7 +27,7 @@
standard_testfile start.c
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "skipping tests due to use_gdb_stub"
return
}
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index a065d9803d..72117cb4a6 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This test only works on GNU/Linux.
-if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
+if { ![isnative] || [is_remote host] || [use_gdb_stub]
|| ![istarget *-linux*] || [skip_shlib_tests]} {
continue
}
diff --git a/gdb/testsuite/gdb.base/dprintf-detach.exp b/gdb/testsuite/gdb.base/dprintf-detach.exp
index ed92c4a01a..4c3b33b777 100644
--- a/gdb/testsuite/gdb.base/dprintf-detach.exp
+++ b/gdb/testsuite/gdb.base/dprintf-detach.exp
@@ -21,7 +21,7 @@
load_lib gdbserver-support.exp
# The test relies on "detach/attach".
-if { [target_info exists use_gdb_stub] } then {
+if { [use_gdb_stub] } then {
return 0
}
diff --git a/gdb/testsuite/gdb.base/nostdlib.exp b/gdb/testsuite/gdb.base/nostdlib.exp
index 54b6cb3ec6..2ce21322de 100644
--- a/gdb/testsuite/gdb.base/nostdlib.exp
+++ b/gdb/testsuite/gdb.base/nostdlib.exp
@@ -18,7 +18,7 @@ standard_testfile .c
# If we're using a stub, breakpoints at the entry point will not trigger.
# See also the comment in break-entry.exp.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "skipping tests due to use_gdb_stub"
return
}
diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp
index 42314c8280..911d614063 100644
--- a/gdb/testsuite/gdb.base/solib-nodir.exp
+++ b/gdb/testsuite/gdb.base/solib-nodir.exp
@@ -25,7 +25,7 @@ if [is_remote target] {
# We need to be able to influence the target's environment and working
# directory. Can't do that if when we connect the inferior is already
# running.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return
}
diff --git a/gdb/testsuite/gdb.base/statistics.exp b/gdb/testsuite/gdb.base/statistics.exp
index eb99ff411a..c093b03b1b 100644
--- a/gdb/testsuite/gdb.base/statistics.exp
+++ b/gdb/testsuite/gdb.base/statistics.exp
@@ -18,7 +18,7 @@ standard_testfile
gdb_exit
# Inlined default_gdb_start.
-set use_gdb_stub [target_info exists use_gdb_stub]
+set use_gdb_stub [use_gdb_stub]
set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts] -statistics"]
if { $res < 0 || $res == "" } {
perror "Spawning $GDB failed."
diff --git a/gdb/testsuite/gdb.base/testenv.exp b/gdb/testsuite/gdb.base/testenv.exp
index 4c123d9ce0..4c4c6e63be 100644
--- a/gdb/testsuite/gdb.base/testenv.exp
+++ b/gdb/testsuite/gdb.base/testenv.exp
@@ -20,7 +20,7 @@
# Can't pass environment variables to the inferior if when we connect,
# the inferior is already running.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-exec-run.exp b/gdb/testsuite/gdb.mi/mi-exec-run.exp
index 7e1758f525..ca3da5d3bf 100644
--- a/gdb/testsuite/gdb.mi/mi-exec-run.exp
+++ b/gdb/testsuite/gdb.mi/mi-exec-run.exp
@@ -28,7 +28,7 @@ set MIFLAGS "-i=mi"
# The purpose of this testcase is to test the -exec-run command. If we
# cannot use it, then there is no point in running this testcase.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "cannot use -exec-run command"
return -1
}
diff --git a/gdb/testsuite/gdb.mi/mi-start.exp b/gdb/testsuite/gdb.mi/mi-start.exp
index 64f7f47a3c..185318ae3b 100644
--- a/gdb/testsuite/gdb.mi/mi-start.exp
+++ b/gdb/testsuite/gdb.mi/mi-start.exp
@@ -19,7 +19,7 @@ set MIFLAGS "-i=mi"
# The purpose of this testcase is to test the --start option of
# the -exec-run command. If we cannot use the -exec-run command,
# then there is no point in running this testcase...
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "cannot use -exec-run command"
return -1
}
diff --git a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp
index 4372081ee7..b5b012f4b1 100644
--- a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp
+++ b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp
@@ -17,7 +17,7 @@ standard_testfile .c
set executable ${testfile}
# The plain remote target can't do multiple inferiors.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return
}
diff --git a/gdb/testsuite/gdb.multi/multi-arch-exec.exp b/gdb/testsuite/gdb.multi/multi-arch-exec.exp
index eaaa9ecd40..9ff439d2a3 100644
--- a/gdb/testsuite/gdb.multi/multi-arch-exec.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch-exec.exp
@@ -19,7 +19,7 @@
set testfile "multi-arch-exec"
# The plain remote target can't do multiple inferiors.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return
}
diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
index 61ab15b49a..3a90f028e1 100644
--- a/gdb/testsuite/gdb.multi/multi-arch.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -19,7 +19,7 @@
set testfile "multi-arch"
# The plain remote target can't do multiple inferiors.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return
}
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index 334e08e7a7..67349b5759 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -22,7 +22,7 @@ standard_testfile
# Multiple inferiors are needed, therefore both native and extended
# gdbserver modes are supported. Only non-extended gdbserver is not
# supported.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "using gdb stub"
return
}
diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.exp b/gdb/testsuite/gdb.multi/watchpoint-multi.exp
index 5234304ebe..bba1b902eb 100644
--- a/gdb/testsuite/gdb.multi/watchpoint-multi.exp
+++ b/gdb/testsuite/gdb.multi/watchpoint-multi.exp
@@ -18,7 +18,7 @@ set executable ${testfile}
# Multiple inferiors are needed, therefore both native and extended gdbserver
# modes are supported. Only non-extended gdbserver is not supported.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
untested "using gdb stub"
return
}
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 26cc802045..5109e7ac75 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index 446f00c984..4a0a670a28 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -17,7 +17,7 @@
# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
# This test only works on Linux
-if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
+if { ![isnative] || [is_remote host] || [use_gdb_stub]
|| ![istarget *-linux*] } {
continue
}
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 6c8c8bf10e..a3916c6354 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -18,7 +18,7 @@
# This file was updated by Jan Kratochvil <jan.kratochvil@redhat.com>.
# This test only works on Linux
-if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
+if { ![isnative] || [is_remote host] || [use_gdb_stub]
|| ![istarget *-linux*] } {
continue
}
diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp
index fc8aac6e06..8979ee38d8 100644
--- a/gdb/testsuite/gdb.threads/threadapply.exp
+++ b/gdb/testsuite/gdb.threads/threadapply.exp
@@ -105,7 +105,7 @@ proc kill_and_remove_inferior {thread_set} {
# The test starts multiple inferiors, therefore non-extended
# remote is not supported.
- if [target_info exists use_gdb_stub] {
+ if [use_gdb_stub] {
unsupported "using gdb stub"
return
}
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
index 89e2e3f4ef..f7169e0955 100644
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -140,7 +140,7 @@ proc do_self_tests {function body} {
# ... or with a stub-like server? I.e., gdbserver + "target
# remote"? In that case we won't be able to pass command line
# arguments to GDB, and selftest_setup wants to do exactly that.
- if [target_info exists use_gdb_stub] {
+ if [use_gdb_stub] {
return
}
--
2.14.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux
2018-03-22 18:46 ` Andreas Arnez
@ 2018-03-22 20:12 ` Simon Marchi
2018-03-23 10:02 ` Andreas Arnez
0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2018-03-22 20:12 UTC (permalink / raw)
To: Andreas Arnez; +Cc: Simon Marchi, gdb-patches
On 2018-03-22 14:45, Andreas Arnez wrote:
> On Thu, Mar 22 2018, Simon Marchi wrote:
>
>> On 2018-03-22 05:04, Andreas Arnez wrote:
>>>>>
>>>>> +# 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?
>>
>> Yes, they probably should.
>
> All right. How about the patch below?
>
> --
> Andreas
>
> -- >8 --
> Subject: [PATCH] Testsuite: fully migrate to use_gdb_stub convenience
> func
>
> In the GDB test suite, there are still multiple invocations of
> "target_info exists use_gdb_stub". However, the recommended way of
> checking for use_gdb_stub is to call the convenience function of the
> same
> name.
>
> Replace these occurrences and just call "use_gdb_stub" instead.
Awesome, thanks!
LGTM.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Make "info proc cmdline" show args on GNU/Linux
2018-03-22 20:12 ` Simon Marchi
@ 2018-03-23 10:02 ` Andreas Arnez
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Arnez @ 2018-03-23 10:02 UTC (permalink / raw)
To: Simon Marchi; +Cc: Simon Marchi, gdb-patches
On Thu, Mar 22 2018, Simon Marchi wrote:
> On 2018-03-22 14:45, Andreas Arnez wrote:
[...]
>> Subject: [PATCH] Testsuite: fully migrate to use_gdb_stub convenience
>> func
>>
>> In the GDB test suite, there are still multiple invocations of
>> "target_info exists use_gdb_stub". However, the recommended way of
>> checking for use_gdb_stub is to call the convenience function of the
>> same
>> name.
>>
>> Replace these occurrences and just call "use_gdb_stub" instead.
>
> Awesome, thanks!
>
> LGTM.
>
> Simon
Thanks, pushed.
--
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-23 10:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-21 13:15 [PATCH] Make "info proc cmdline" show args on GNU/Linux Andreas Arnez
2018-03-21 19:28 ` Simon Marchi
2018-03-22 9:04 ` Andreas Arnez
2018-03-22 11:18 ` Simon Marchi
2018-03-22 18:46 ` Andreas Arnez
2018-03-22 20:12 ` Simon Marchi
2018-03-23 10:02 ` Andreas Arnez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).