binutils-gdb/gdb/testsuite/gdb.python
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
..
amd64-py-framefilter-invalidarg.S Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
lib-types.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
lib-types.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-arch.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-arch.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-as-string.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-as-string.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-bad-printers.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-bad-printers.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-bad-printers.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-block.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-block.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-breakpoint-create-fail.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-breakpoint-create-fail.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-breakpoint-create-fail.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-breakpoint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-breakpoint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-caller-is.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-caller-is.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-cmd.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-cmd.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-completion.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-completion.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-error.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-error.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-events-shlib.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-events.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-events.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-events.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-evsignal.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-evthreads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-evthreads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-explore-cc.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-explore.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-explore.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-explore.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-finish-breakpoint2.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-finish-breakpoint2.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-finish-breakpoint2.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-finish-breakpoint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-finish-breakpoint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-finish-breakpoint.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-format-string.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-format-string.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-format-string.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-frame-args.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-frame-args.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-frame-args.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-frame-inline.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-frame-inline.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-frame.c
py-frame.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter-gdb.py.in Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter-invalidarg-gdb.py.in Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter-invalidarg.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter-invalidarg.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter-mi.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter-mi.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-framefilter.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-function.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-inferior.c
py-inferior.exp Add "info connections" command, "info inferiors" connection number/string 2020-01-10 20:06:14 +00:00
py-infthread.c
py-infthread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-lazy-string.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-lazy-string.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-linetable.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-linetable.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-linetable.S Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-lookup-type.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-events-gdb.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-events.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-events.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-objfile-gdb.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-objfile.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-objfile.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-var-info-path-expression.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-var-info-path-expression.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi-var-info-path-expression.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-mi.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-nested-maps.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-nested-maps.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-nested-maps.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-objfile-script-gdb.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-objfile-script.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-objfile-script.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-objfile.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-objfile.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-parameter.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-integral.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-integral.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-integral.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-maint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-maint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-maint.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-re-notag.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-re-notag.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-re-notag.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-registration.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-registration.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-pp-registration.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-prettyprint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-prettyprint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-prettyprint.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-progspace.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-progspace.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-prompt.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-prompt.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-rbreak-func2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-rbreak.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-rbreak.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-record-btrace-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-record-btrace-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-record-btrace.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-record-btrace.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-record-full.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-record-full.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-recurse-unwind.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-recurse-unwind.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-recurse-unwind.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-rvalue-ref-value-cc.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-rvalue-ref-value-cc.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-section-script.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-section-script.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-section-script.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-shared-sl.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-shared.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-shared.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-strfns.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-strfns.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-symbol-2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-symbol.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-symbol.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-symtab.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-sync-interp.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-sync-interp.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-template.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-template.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-thrhandle.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-thrhandle.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-type.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-type.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-typeprint.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-typeprint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-typeprint.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-unwind-maint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-unwind-maint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-unwind-maint.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-unwind.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-unwind.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-unwind.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-value-cc.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-value-cc.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-value.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-value.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-xmethods.cc Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-xmethods.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
py-xmethods.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
python-1.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
python.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
python.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
source1 Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
source2.py Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00