binutils-gdb/gdb/testsuite/gdb.threads
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
..
async.c Preserve selected thread in all-stop w/ background execution 2020-01-10 20:05:41 +00:00
async.exp Preserve selected thread in all-stop w/ background execution 2020-01-10 20:05:41 +00:00
attach-into-signal.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
attach-into-signal.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
attach-many-short-lived-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
attach-many-short-lived-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
attach-slow-waitpid.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
attach-slow-waitpid.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
attach-stopped.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
attach-stopped.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
bp_in_thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
bp_in_thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
break-while-running.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
break-while-running.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
check-libthread-db.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
check-libthread-db.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
clone-attach-detach.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
clone-attach-detach.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
clone-new-thread-event.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
clone-new-thread-event.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
clone-thread_db.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
clone-thread_db.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
continue-pending-after-query.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
continue-pending-after-query.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
continue-pending-status.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
continue-pending-status.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
corethreads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
corethreads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
create-fail.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
create-fail.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
current-lwp-dead.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
current-lwp-dead.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
dlopen-libpthread-lib.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
dlopen-libpthread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
dlopen-libpthread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
execl1.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
execl.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
execl.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
fork-child-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
fork-child-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
fork-plus-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
fork-plus-threads.exp Add "info connections" command, "info inferiors" connection number/string 2020-01-10 20:06:14 +00:00
fork-thread-pending.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
fork-thread-pending.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
forking-threads-plus-breakpoint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
forking-threads-plus-breakpoint.exp Add "info connections" command, "info inferiors" connection number/string 2020-01-10 20:06:14 +00:00
gcore-stale-thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gcore-stale-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gcore-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
hand-call-in-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
hand-call-in-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
hand-call-new-thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
hand-call-new-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
ia64-sigill.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
ia64-sigill.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
info-threads-cur-sal-2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
info-threads-cur-sal.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
info-threads-cur-sal.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
interrupt-while-step-over.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
interrupt-while-step-over.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
interrupted-hand-call.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
interrupted-hand-call.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
kill.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
kill.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
killed.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
killed.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
leader-exit.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
leader-exit.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-dp.c
linux-dp.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
local-watch-wrong-thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
local-watch-wrong-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
manythreads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
manythreads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
multi-create-ns-info-thr.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
multi-create.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
multi-create.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
multiple-step-overs.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
multiple-step-overs.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
multiple-successive-infcall.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
multiple-successive-infcall.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
names.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
names.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
next-bp-other-thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
next-bp-other-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
next-while-other-thread-longjmps.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
next-while-other-thread-longjmps.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
no-unwaited-for-left.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
no-unwaited-for-left.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-1.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-1.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-2.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-3.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-3.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-4.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exc-4.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exit.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-ldr-exit.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-stop-fair-events.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
non-stop-fair-events.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
omp-par-scope.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
omp-par-scope.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pending-step.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pending-step.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
print-threads.c
print-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
process-dies-while-detaching.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
process-dies-while-detaching.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
process-dies-while-handling-bp.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
process-dies-while-handling-bp.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pthread_cond_wait.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
pthread_cond_wait.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
pthreads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
queue-signal.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
queue-signal.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
reconnect-signal.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
reconnect-signal.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
schedlock.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
schedlock.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
siginfo-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
siginfo-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-command-handle-nopass.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-command-handle-nopass.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-command-multiple-signals-pending.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-command-multiple-signals-pending.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-delivered-right-thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-delivered-right-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-sigtrap.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-sigtrap.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-while-stepping-over-bp-other-thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
signal-while-stepping-over-bp-other-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
sigstep-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
sigstep-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
sigthread.c
sigthread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
slow-waitpid.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
staticthreads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
staticthreads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
step-bg-decr-pc-switch-thread.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
step-bg-decr-pc-switch-thread.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
step-over-lands-on-breakpoint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
step-over-lands-on-breakpoint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
step-over-trips-on-watchpoint.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
step-over-trips-on-watchpoint.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
stepi-random-signal.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
stepi-random-signal.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
stop-with-handle.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
stop-with-handle.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
switch-threads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
switch-threads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread_check.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread_check.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread_events.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread_events.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-execl.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-execl.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-find.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-specific-bp.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-specific-bp.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-specific.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-specific.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
thread-unwindonsignal.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
threadapply.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
threadapply.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
threxit-hop-specific.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
threxit-hop-specific.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tid-reuse.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tid-reuse.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-core.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-core.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-main.c
tls-nodebug-pie.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-nodebug-pie.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-nodebug.c
tls-nodebug.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-shared.c
tls-shared.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-so_extern_main.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-so_extern.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-so_extern.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-var-main.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-var.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls-var.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
tls.c
tls.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
vfork-follow-child-exec.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
vfork-follow-child-exec.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
vfork-follow-child-exit.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
vfork-follow-child-exit.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchpoint-fork-child.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchpoint-fork-mt.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchpoint-fork-parent.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchpoint-fork-st.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchpoint-fork.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchpoint-fork.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchthreads2.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchthreads2.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchthreads-reorder.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchthreads-reorder.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchthreads.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
watchthreads.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
wp-replication.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
wp-replication.exp Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00