diff options
author | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2020-01-10 20:06:17 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2020-01-10 20:06:17 +0000 |
commit | d9ebdab754fac0e9a4e4046a550a3e89cf5c2699 (patch) | |
tree | 163dfc559621fb159f80a3ae2e067c517fd9456f /bfd | |
parent | f3c469b95b9f1f635668660c5041df9513a47a02 (diff) | |
download | gdb-d9ebdab754fac0e9a4e4046a550a3e89cf5c2699.zip gdb-d9ebdab754fac0e9a4e4046a550a3e89cf5c2699.tar.gz gdb-d9ebdab754fac0e9a4e4046a550a3e89cf5c2699.tar.bz2 |
Switch the inferior before outputting its id in "info inferiors"
GDB uses the 'current_top_target' when displaying the description of
an inferior. This leads to same target being used for each inferior
and, in turn, yields incorrect output when the inferior has a target
that is supposed to give a specialized output. For instance, the
remote target outputs "Remote target" instead of "process XYZ" as the
description if the multi-process feature is not supported or turned
off.
E.g.: Suppose we have a native and a remote target, and the native is
the current inferior. The remote target does not support multi-process.
For "info inferiors", we would expect to see:
~~~
(gdb) i inferiors
Num Description Connection Executable
* 1 process 29060 1 (native) /a/path
2 Remote target 2 (remote ...)
~~~
but instead we get
~~~
(gdb) i inferiors
Num Description Connection Executable
* 1 process 29060 1 (native) /a/path
2 process 42000 2 (remote ...)
~~~
Similarly, if the current inferior is the remote one, we would expect
to see
~~~
(gdb) i inferiors
Num Description Connection Executable
1 process 29060 1 (native) /a/path
* 2 Remote target 2 (remote ...)
~~~
but we get
~~~
(gdb) i inferiors
Num Description Connection Executable
* 1 Remote target 1 (native) /a/path
2 Remote target 2 (remote ...)
~~~
With this patch, we switch to the inferior when outputting its
description, so that the current_top_target will be aligned to the
inferior we are displaying.
For testing, this patch expands the "info inferiors" test for the
multi-target feature. The test was checking for the output of the
info commands after setup, only when the current inferior is the last
added inferior.
This patch does the following to the testcase:
1. The "info inferiors" and "info connections" test is extracted out
from the "setup" procedure to a separate procedure.
2. The test is enriched to check the output after switching to each
inferior, not just the last one.
3. The test is performed twice; one for when the multi-process feature
is turned on, one for off.
gdb/ChangeLog:
2020-01-10 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* inferior.c (print_inferior): Switch inferior before printing it.
gdb/testsuite/ChangeLog:
2020-01-10 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdb.multi/multi-target.exp (setup): Factor out "info
connections" and "info inferiors" tests to ...
(test_info_inferiors): ... this new procedure.
(top level): Run new "info-inferiors" tests.
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions