mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
This patch makes the inferior command display information about the
current inferior when called with no argument. This behavior is similar
to the one of the thread command.
Before patch:
(gdb) info inferior
Num Description Connection Executable
* 1 process 19221 1 (native) /home/lsix/tmp/a.out
2 process 19239 1 (native) /home/lsix/tmp/a.out
(gdb) inferior 2
[Switching to inferior 2 [process 19239] (/home/lsix/tmp/a.out)]
[Switching to thread 2.1 (process 19239)]
#0 0x0000000000401146 in main ()
(gdb) inferior
Argument required (expression to compute).
After patch:
(gdb) info inferior
Num Description Connection Executable
* 1 process 18699 1 (native) /home/lsix/tmp/a.out
2 process 18705 1 (native) /home/lsix/tmp/a.out
(gdb) inferior 2
[Switching to inferior 2 [process 18705] (/home/lsix/tmp/a.out)]
[Switching to thread 2.1 (process 18705)]
#0 0x0000000000401146 in main ()
(gdb) inferior
[Current inferior is 2 [process 18705] (/home/lsix/tmp/a.out)]
gdb/doc/ChangeLog:
* gdb.texinfo (Inferiors Connections and Programs): Document the
inferior command when used without argument.
gdb/ChangeLog:
* NEWS: Add entry for the behavior change of the inferior command.
* inferior.c (inferior_command): When no argument is given to the
inferior command, display info about the currently selected
inferior.
gdb/testsuite/ChangeLog:
* gdb.base/inferior-noarg.c: New test.
* gdb.base/inferior-noarg.exp: New test.
37 lines
1.4 KiB
Plaintext
37 lines
1.4 KiB
Plaintext
# Copyright 2021 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# This test case checks that the 'inferior' command, when given no
|
|
# argument, displays information about the inferior currently active.
|
|
|
|
standard_testfile
|
|
|
|
if { [prepare_for_testing "failed to prepare" \
|
|
${testfile} ${srcfile}] } {
|
|
return
|
|
}
|
|
|
|
gdb_test "inferior" "\[Current inferior is 1 \[<null>\] (.*)\]" "inferior not running"
|
|
|
|
if { ![runto_main] } {
|
|
untested "could not run to main"
|
|
return
|
|
}
|
|
|
|
gdb_test "inferior" {\[Current inferior is 1 \[.*\] (.*)\]} "inferior running"
|
|
gdb_test "clone-inferior" "Added inferior 2.*" "create new inferior"
|
|
gdb_test "inferior 2" "\[Switching to inferior 2 \[<null>\] (.*)]" "change inferior"
|
|
gdb_test "inferior" "\[Current inferior is 2 \[<null>\] (.*)\]" "show new inferior"
|