binutils-gdb/gdb/testsuite/gdb.mi
Pedro Alves 121b3efd49 Add "info connections" command, "info inferiors" connection number/string
This commit extends the CLI a bit for multi-target, in three ways.

#1 - New "info connections" command.

This is a new command that lists the open connections (process_stratum
targets).  For example, if you're debugging two remote connections, a
couple local/native processes, and a core dump, all at the same time,
you might see something like this:

 (gdb) info connections
   Num  What                     Description
   1    remote 192.168.0.1:9999  Remote serial target in gdb-specific protocol
   2    remote 192.168.0.2:9998  Remote serial target in gdb-specific protocol
 * 3    native                   Native process
   4    core                     Local core dump file

#2 - New "info inferiors" "Connection" column

You'll also see a new matching "Connection" column in "info
inferiors", showing you which connection an inferior is bound to:

 (gdb) info inferiors
   Num  Description       Connection                   Executable
   1    process 18526     1 (remote 192.168.0.1:9999)  target:/tmp/a.out
   2    process 18531     2 (remote 192.168.0.2:9998)  target:/tmp/a.out
   3    process 19115     3 (native)                   /tmp/prog1
   4    process 6286      4 (core)                     myprogram
 * 5    process 19122     3 (native)                   /bin/hello

#3 - Makes "add-inferior" show the inferior's target connection

"add-inferior" now shows you the connection you've just bound the
inferior to, which is the current process_stratum target:

 (gdb) add-inferior
 [New inferior 2]
 Added inferior 2 on connection 1 (extended-remote localhost:2346)

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMMON_SFILES): Add target-connection.c.
	* inferior.c (uiout_field_connection): New function.
	(print_inferior): Add new "connection-id" column.
	(add_inferior_command): Show connection number/string of added
	inferior.
	* process-stratum-target.h
	(process_stratum_target::connection_string): New virtual method.
	(process_stratum_target::connection_number): New field.
	* remote.c (remote_target::connection_string): New override.
	* target-connection.c: New file.
	* target-connection.h: New file.
	* target.c (decref_target): Remove process_stratum targets from
	the connection list.
	(target_stack::push): Add process_stratum targets to the
	connection list.

gdb/testsuite/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

	* gdb.base/kill-detach-inferiors-cmd.exp: Adjust expected output
	of "add-inferior".
	* gdb.base/quit-live.exp: Likewise.
	* gdb.base/remote-exec-file.exp: Likewise.
	* gdb.guile/scm-progspace.exp: Likewise.
	* gdb.linespec/linespec.exp: Likewise.
	* gdb.mi/new-ui-mi-sync.exp: Likewise.
	* gdb.mi/user-selected-context-sync.exp: Likewise.
	* gdb.multi/multi-target.exp (setup): Add "info connection" and
	"info inferiors" tests.
	* gdb.multi/remove-inferiors.exp: Adjust expected output of
	"add-inferior".
	* gdb.multi/watchpoint-multi.exp: Likewise.
	* gdb.python/py-inferior.exp: Likewise.
	* gdb.server/extended-remote-restart.exp: Likewise.
	* gdb.threads/fork-plus-threads.exp: Adjust expected output of
	"info inferiors".
	* gdb.threads/forking-threads-plus-breakpoint.exp: Likewise.
	* gdb.trace/report.exp: Likewise.
2020-01-10 20:06:14 +00:00
..
ChangeLog-1999-2003
array.f Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
basics.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
dw2-ref-missing-frame-func.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
dw2-ref-missing-frame-main.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
dw2-ref-missing-frame.S Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
dw2-ref-missing-frame.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gdb669.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gdb680.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gdb701.c
gdb701.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gdb792.cc
gdb792.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gdb2549.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
list-thread-groups-available.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
list-thread-groups-available.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
list-thread-groups-no-inferior.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-async-run.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-async-run.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-async.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-basics.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-break.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-breakpoint-changed.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-breakpoint-multiple-locations.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-breakpoint-multiple-locations.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-catch-cpp-exceptions.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-catch-cpp-exceptions.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-catch-load-so.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-catch-load.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-catch-load.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-cli.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-cmd-error.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-cmd-param-changed.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-complete.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-complete.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-condbreak-call-thr-state-mt.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-condbreak-call-thr-state-st.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-condbreak-call-thr-state.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-condbreak-call-thr-state.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-console.c
mi-console.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-detach.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-disassemble.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-dprintf-pending.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-dprintf-pending.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-dprintf-pendshr.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-dprintf.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-dprintf.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-editing.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-eval.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-exec-run.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-exit-code.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-exit-code.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-file-transfer.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-file.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-fill-memory.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-fortran-modules-2.f90 Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-fortran-modules.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-fortran-modules.f90 Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-frame-regs.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-fullname-deleted.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-hack-cli.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-i-cmd.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-info-os.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-inheritance-syntax-error.cc
mi-inheritance-syntax-error.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-language.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-linespec-err-cp.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-linespec-err-cp.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-logging.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-memory-changed.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-nonstop-exit.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-nonstop.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-ns-stale-regcache.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-nsintrall.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-nsmoribund.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-nsthrexec.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-pending.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-pending.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-pendshr.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-pendshr2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-pthreads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-read-memory.c
mi-read-memory.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-record-changed.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-reg-undefined.S Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-reg-undefined.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-reg-undefined.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-regs.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-return.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-reverse.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-simplerun.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-solib.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-stack.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-stack.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-start.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-start.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-stepi.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-stepn.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-stepn.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-sym-info-1.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-sym-info-2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-sym-info.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-syn-frame.c
mi-syn-frame.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-threads-interrupt.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-threads-interrupt.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-undefined-cmd.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-until.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-block.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-child-f.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-child.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-child.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-cmd.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-cp.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-cp.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-create-rtti.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-create-rtti.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-display.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-invalidate.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-list-children-invalid-grandchild.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-list-children-invalid-grandchild.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-rtti.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-var-rtti.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-vla-c99.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-vla-fortran.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-watch-nonstop.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi-watch.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi2-amd64-entry-value.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi2-amd64-entry-value.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi2-amd64-entry-value.s Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi2-cli-display.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi2-cli-display.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi2-prompt.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mi2-var-child.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
new-ui-mi-sync.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
new-ui-mi-sync.exp Add "info connections" command, "info inferiors" connection number/string 2020-01-10 20:06:14 +00:00
non-stop-exit.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-stop.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
ns-stale-regcache.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
nsintrall.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
nsmoribund.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
nsthrexec.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pending.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pendshr1.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pendshr2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pr11022.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pr11022.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pthreads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
solib-lib.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
solib-main.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
testcmds
until.c
user-selected-context-sync.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
user-selected-context-sync.exp Add "info connections" command, "info inferiors" connection number/string 2020-01-10 20:06:14 +00:00
var-cmd.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
vla.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
vla.f90 Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watch-nonstop.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00