Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 00/24] Multi-target support
Date: Sun, 20 Oct 2019 11:41:00 -0000	[thread overview]
Message-ID: <0deb38a1bee181cdcd6689d69ea69913f136f979.camel@skynet.be> (raw)
In-Reply-To: <20191017225026.30496-1-palves@redhat.com>

I played a little bit with the patch and valgrind
(I had to apply the patch with git am --3way, otherwise it failed to apply).
No problem encountered when playing with the result.
I also re-read the documentation (as I forgot about how this was all
working), and it was all pretty clear.

3 notes:
  * It might be interesting to one day add
     something like 'inferior apply all/list of inferiors SOMMECOMMAND'
  * when having 2 inferiors connected to 2 different valgrind gdbservers,
    I could continue both inferiors by using 'continue&',
    but I had to (artificially) issue 'interrupt' in the second inferior
    to have GDB accepting 'continue&'.  So, this might be the indication
    of a status 'running' which should be maintained per inferior,
    while it might now be maintained globally.
  * I was (again?) confused by add-inferior silently ignoring abbreviations
    (or more generally anything starting with - unless matching exactly
     an option).
    Waiting for option framework to be extended, the add-inferior command
    could use the below that accepts abbreviations and does not ignore
    wrong options.

Thanks

Philippe


diff --git a/gdb/inferior.c b/gdb/inferior.c
index 061cf5cebb..5d72780eb3 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -786,24 +786,23 @@ add_inferior_command (const char *args, int from_tty)
 
       for (char **argv = built_argv.get (); *argv != NULL; argv++)
 	{
-	  if (**argv == '-')
+	  int len = strlen (*argv);
+
+	  if (strncmp (*argv, "-copies", len) == 0)
 	    {
-	      if (strcmp (*argv, "-copies") == 0)
-		{
-		  ++argv;
-		  if (!*argv)
-		    error (_("No argument to -copies"));
-		  copies = parse_and_eval_long (*argv);
-		}
-	      else if (strcmp (*argv, "-no-connection") == 0)
-		no_connection = true;
-	      else if (strcmp (*argv, "-exec") == 0)
-		{
-		  ++argv;
-		  if (!*argv)
-		    error (_("No argument to -exec"));
-		  exec.reset (tilde_expand (*argv));
-		}
+	      ++argv;
+	      if (!*argv)
+		error (_("No argument to -copies"));
+	      copies = parse_and_eval_long (*argv);
+	    }
+	  else if (strncmp (*argv, "-no-connection", len) == 0)
+	    no_connection = true;
+	  else if (strncmp (*argv, "-exec", len) == 0)
+	    {
+	      ++argv;
+	      if (!*argv)
+		error (_("No argument to -exec"));
+	      exec.reset (tilde_expand (*argv));
 	    }
 	  else
 	    error (_("Invalid argument"));



On Thu, 2019-10-17 at 23:50 +0100, Pedro Alves wrote:
> Here's v2 of the multi-target patchset, which addresses all the review
> comments so far, I believe.  Patch 15 is new, so all following patches
> are shifted by one.
> 
> This time, I've adjusted the host-specific nat files to function API
> changes.  I tried to find spots that would need changes using grep.  I
> built the series on AIX, x86/SPARC Solaris, 64-bit Windows, x86
> GNU/Linux -m64/-m32, and Aarch64 GNU/Linux.  I'm currently running
> this through the buildbot, will have results tomorrow.  I don't expect
> any serious major issue, if any, as so far runs that completed seem
> OK.
> 
> Follows the intro blurb:
> 
> This series adds multi-target support to GDB.  What this means is that
> with this series, GDB can now be connected to different targets at the
> same time.  E.g., you can debug a live native process and a core dump
> at the same time, connect to multiple gdbservers, etc.
> 
> Patches 1 to 17 are preparatory patches.
> 
> Patch 18 is the actual multi-target patch.  This is the largest patch
> in the series.  It does a number of things at the same time, but
> they're all intertwined, so I gave up on splitting it further.
> 
> Patch 19 adds tests.  Split out because patch 18 is already too big as
> is.
> 
> Patch 22 does some user-visible changes, including a new command to
> list open target connections.  This is just the bare minimum I could
> think of that is necessary for multi-target work.  I'm sure we'll find
> other tweaks to other commands necessary.
> 
> Documentation is in patch 24.  Eli already reviewed and approved it.
> 
> I've pushed this to users/palves/multi-target-v2 on sourceware.
> 
> Pedro Alves (23):
>   Preserve selected thread in all-stop w/ background execution
>   Don't rely on inferior_ptid in record_full_wait
>   Make "show remote exec-file" inferior-aware
>   exceptions.c:print_flush: Remove obsolete check
>   Make target_ops::has_execution take an 'inferior *' instead of a
>     ptid_t
>   Don't check target is running in remote_target::mourn_inferior
>   Delete unnecessary code from kill_command
>   Introduce switch_to_inferior_no_thread
>   switch inferior/thread before calling target methods
>   Some get_last_target_status tweaks
>   tfile_target::close: trace_fd can't be -1
>   Use all_non_exited_inferiors in infrun.c
>   Delete exit_inferior_silent(int pid)
>   Tweak handling of remote errors in response to resumption packet
>   Fix reconnecting to a gdbserver already debugging multiple processes,
>     I
>   Fix reconnecting to a gdbserver already debugging multiple processes,
>     II
>   Multi-target support
>   Add multi-target tests
>   gdbarch-selftests.c: No longer error out if debugging something
>   Revert 'Remove unused struct serial::name field'
>   Add "info connections" command, "info inferiors" connection
>     number/string
>   Require always-non-stop for multi-target resumptions
>   Multi-target: NEWS and user manual
> 
> Tankut Baris Aktemur (1):
>   Avoid another inferior_ptid reference in gdb/remote.c
> 
>  gdb/doc/gdb.texinfo                                | 137 ++--
>  gdb/doc/guile.texi                                 |   4 +-
>  gdb/doc/python.texi                                |   6 +-
>  gdb/NEWS                                           |  29 +
>  gdb/Makefile.in                                    |   1 +
>  gdb/aarch64-linux-nat.c                            |   2 +-
>  gdb/ada-tasks.c                                    |   4 +-
>  gdb/aix-thread.c                                   |  24 +-
>  gdb/amd64-fbsd-tdep.c                              |   4 +-
>  gdb/amd64-linux-nat.c                              |   2 +-
>  gdb/break-catch-sig.c                              |   3 +-
>  gdb/break-catch-syscall.c                          |   3 +-
>  gdb/breakpoint.c                                   |  25 +-
>  gdb/bsd-uthread.c                                  |  20 +-
>  gdb/btrace.c                                       |   2 +-
>  gdb/corelow.c                                      |  10 +-
>  gdb/event-top.c                                    |  14 +-
>  gdb/exceptions.c                                   |   6 +-
>  gdb/exec.c                                         |  51 +-
>  gdb/exec.h                                         |   7 +
>  gdb/fbsd-tdep.c                                    |   3 +-
>  gdb/fork-child.c                                   |   7 +-
>  gdb/gdbarch-selftests.c                            |   5 -
>  gdb/gdbserver/fork-child.c                         |   3 +-
>  gdb/gdbserver/inferiors.c                          |   2 +-
>  gdb/gdbserver/linux-low.c                          |   2 +-
>  gdb/gdbserver/lynx-low.c                           |   2 +-
>  gdb/gdbserver/nto-low.c                            |   2 +-
>  gdb/gdbserver/remote-utils.c                       |   2 +-
>  gdb/gdbserver/target.c                             |   8 +-
>  gdb/gdbserver/target.h                             |  11 +-
>  gdb/gdbserver/win32-low.c                          |   4 +-
>  gdb/gdbsupport/common-gdbthread.h                  |   5 +-
>  gdb/gdbthread.h                                    | 133 ++--
>  gdb/i386-fbsd-tdep.c                               |   4 +-
>  gdb/i386-linux-nat.c                               |   2 +-
>  gdb/inf-child.c                                    |   2 +-
>  gdb/inf-ptrace.c                                   |   6 +-
>  gdb/infcall.c                                      |   3 +-
>  gdb/infcmd.c                                       | 129 ++--
>  gdb/inferior-iter.h                                |  76 ++-
>  gdb/inferior.c                                     | 156 +++--
>  gdb/inferior.h                                     |  71 +-
>  gdb/infrun.c                                       | 720 ++++++++++++++++-----
>  gdb/infrun.h                                       |  23 +-
>  gdb/inline-frame.c                                 |  51 +-
>  gdb/inline-frame.h                                 |  12 +-
>  gdb/linux-fork.c                                   |   5 +-
>  gdb/linux-nat.c                                    |  76 ++-
>  gdb/linux-nat.h                                    |   1 +
>  gdb/linux-tdep.c                                   |   3 +-
>  gdb/linux-thread-db.c                              | 112 ++--
>  gdb/mi/mi-interp.c                                 |  10 +-
>  gdb/mi/mi-main.c                                   |   6 +-
>  gdb/nat/fork-inferior.c                            |   8 +-
>  gdb/nat/fork-inferior.h                            |   5 +-
>  gdb/nto-procfs.c                                   |   2 +-
>  gdb/ppc-fbsd-tdep.c                                |   4 +-
>  gdb/proc-service.c                                 |  17 +-
>  gdb/process-stratum-target.c                       |  12 +-
>  gdb/process-stratum-target.h                       |  31 +-
>  gdb/procfs.c                                       |  49 +-
>  gdb/python/py-threadevent.c                        |   4 +-
>  gdb/ravenscar-thread.c                             |  15 +-
>  gdb/record-btrace.c                                |  41 +-
>  gdb/record-full.c                                  |  22 +-
>  gdb/regcache.c                                     | 162 +++--
>  gdb/regcache.h                                     |  30 +-
>  gdb/remote.c                                       | 307 +++++----
>  gdb/riscv-fbsd-tdep.c                              |   4 +-
>  gdb/serial.c                                       |   4 +
>  gdb/serial.h                                       |   1 +
>  gdb/sol-thread.c                                   |  28 +-
>  gdb/sol2-tdep.c                                    |   2 +-
>  gdb/solib-svr4.c                                   |   3 +-
>  gdb/target-connection.c                            | 159 +++++
>  gdb/target-connection.h                            |  40 ++
>  gdb/target-delegates.c                             |  27 +
>  gdb/target.c                                       | 192 +++---
>  gdb/target.h                                       |  41 +-
>  gdb/testsuite/gdb.base/fork-running-state.exp      |  17 +-
>  .../gdb.base/kill-detach-inferiors-cmd.exp         |   4 +-
>  gdb/testsuite/gdb.base/quit-live.exp               |   2 +-
>  gdb/testsuite/gdb.base/remote-exec-file.exp        |  46 ++
>  gdb/testsuite/gdb.guile/scm-progspace.exp          |   2 +-
>  gdb/testsuite/gdb.linespec/linespec.exp            |   2 +-
>  gdb/testsuite/gdb.mi/new-ui-mi-sync.exp            |   2 +-
>  .../gdb.mi/user-selected-context-sync.exp          |   2 +-
>  gdb/testsuite/gdb.multi/multi-target.c             | 100 +++
>  gdb/testsuite/gdb.multi/multi-target.exp           | 387 +++++++++++
>  gdb/testsuite/gdb.multi/remove-inferiors.exp       |   2 +-
>  gdb/testsuite/gdb.multi/tids-gid-reset.c           |  22 +
>  gdb/testsuite/gdb.multi/tids-gid-reset.exp         |  96 +++
>  gdb/testsuite/gdb.multi/watchpoint-multi.exp       |   2 +-
>  gdb/testsuite/gdb.python/py-inferior.exp           |   4 +-
>  .../gdb.server/connect-without-multi-process.exp   |   7 +-
>  .../gdb.server/extended-remote-restart.exp         |  22 +-
>  gdb/testsuite/gdb.threads/async.c                  |  70 ++
>  gdb/testsuite/gdb.threads/async.exp                |  98 +++
>  gdb/testsuite/gdb.threads/fork-plus-threads.exp    |   2 +-
>  .../forking-threads-plus-breakpoint.exp            |   2 +-
>  gdb/testsuite/gdb.trace/report.exp                 |   2 +-
>  gdb/testsuite/lib/gdbserver-support.exp            |   4 +
>  gdb/thread-iter.c                                  |  14 +-
>  gdb/thread-iter.h                                  |  25 +-
>  gdb/thread.c                                       | 230 ++++---
>  gdb/top.c                                          |  17 +-
>  gdb/tracectf.c                                     |   2 +-
>  gdb/tracefile-tfile.c                              |   5 +-
>  gdb/tracefile.h                                    |   2 +-
>  gdb/windows-nat.c                                  |  20 +-
>  111 files changed, 3360 insertions(+), 1073 deletions(-)
>  create mode 100644 gdb/target-connection.c
>  create mode 100644 gdb/target-connection.h
>  create mode 100644 gdb/testsuite/gdb.base/remote-exec-file.exp
>  create mode 100644 gdb/testsuite/gdb.multi/multi-target.c
>  create mode 100644 gdb/testsuite/gdb.multi/multi-target.exp
>  create mode 100644 gdb/testsuite/gdb.multi/tids-gid-reset.c
>  create mode 100644 gdb/testsuite/gdb.multi/tids-gid-reset.exp
>  create mode 100644 gdb/testsuite/gdb.threads/async.c
>  create mode 100644 gdb/testsuite/gdb.threads/async.exp
> 


  parent reply	other threads:[~2019-10-20 11:41 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 22:50 Pedro Alves
2019-10-17 22:50 ` [PATCH v2 15/24] Avoid another inferior_ptid reference in gdb/remote.c Pedro Alves
2019-10-17 22:50 ` [PATCH v2 11/24] tfile_target::close: trace_fd can't be -1 Pedro Alves
2019-10-17 22:50 ` [PATCH v2 02/24] Don't rely on inferior_ptid in record_full_wait Pedro Alves
2019-11-01 14:54   ` Tom Tromey
2019-12-20 17:49     ` Pedro Alves
2019-12-20 18:57       ` Tom Tromey
2019-10-17 22:50 ` [PATCH v2 10/24] Some get_last_target_status tweaks Pedro Alves
2019-10-17 22:50 ` [PATCH v2 03/24] Make "show remote exec-file" inferior-aware Pedro Alves
2019-10-17 22:50 ` [PATCH v2 21/24] Revert 'Remove unused struct serial::name field' Pedro Alves
2019-10-17 22:50 ` [PATCH v2 12/24] Use all_non_exited_inferiors in infrun.c Pedro Alves
2019-10-17 22:50 ` [PATCH v2 09/24] switch inferior/thread before calling target methods Pedro Alves
2019-10-17 22:50 ` [PATCH v2 17/24] Fix reconnecting to a gdbserver already debugging multiple processes, II Pedro Alves
2019-10-17 22:50 ` [PATCH v2 01/24] Preserve selected thread in all-stop w/ background execution Pedro Alves
2019-11-01 13:20   ` Tom Tromey
2019-12-20 17:22     ` Pedro Alves
2019-12-20 18:54       ` Tom Tromey
2019-12-20 18:57         ` Pedro Alves
2019-12-20 18:57           ` Tom Tromey
2019-10-17 22:50 ` [PATCH v2 16/24] Fix reconnecting to a gdbserver already debugging multiple processes, I Pedro Alves
2019-10-17 22:50 ` [PATCH v2 06/24] Don't check target is running in remote_target::mourn_inferior Pedro Alves
2019-10-17 22:51 ` [PATCH v2 18/24] Multi-target support Pedro Alves
2020-01-11  3:12   ` Simon Marchi
2020-01-12  1:58     ` [pushed] Remove last traces of discard_all_inferiors (Re: [PATCH v2 18/24] Multi-target support) Pedro Alves
2020-01-12 20:17   ` [PATCH v2 18/24] Multi-target support Simon Marchi
2020-01-13 15:19     ` Pedro Alves
2020-01-13 16:37       ` Simon Marchi
2020-01-12 22:30   ` Simon Marchi
2020-01-13 15:59     ` Pedro Alves
2020-01-17  4:03   ` Simon Marchi
2020-01-17 16:19     ` Simon Marchi
2020-01-17 15:18   ` Simon Marchi
2020-05-16  8:16   ` Andreas Schwab
2020-05-16 11:33     ` Fix IA-64 GNU/Linux build (Re: [PATCH v2 18/24] Multi-target support) Pedro Alves
2019-10-17 22:51 ` [PATCH v2 04/24] exceptions.c:print_flush: Remove obsolete check Pedro Alves
2019-10-17 22:51 ` [PATCH v2 22/24] Add "info connections" command, "info inferiors" connection number/string Pedro Alves
2019-10-17 22:51 ` [PATCH v2 19/24] Add multi-target tests Pedro Alves
2019-10-17 22:57 ` [PATCH v2 05/24] Make target_ops::has_execution take an 'inferior *' instead of a ptid_t Pedro Alves
2019-10-17 22:57 ` [PATCH v2 23/24] Require always-non-stop for multi-target resumptions Pedro Alves
2019-11-01 14:51   ` Tom Tromey
2019-12-30 18:30     ` Pedro Alves
2019-12-31 20:06       ` Tom Tromey
2019-10-17 22:57 ` [PATCH v2 07/24] Delete unnecessary code from kill_command Pedro Alves
2019-10-17 22:59 ` [PATCH v2 08/24] Introduce switch_to_inferior_no_thread Pedro Alves
2019-11-07  9:14   ` Paunovic, Aleksandar
2019-12-20 18:50     ` Pedro Alves
2019-12-23 19:30       ` [PATCH] Switch the inferior too in switch_to_program_space_and_thread (Re: [PATCH v2 08/24] Introduce switch_to_inferior_no_thread) Pedro Alves
2020-01-08 15:48         ` Aktemur, Tankut Baris
2020-01-10  2:03           ` Pedro Alves
     [not found]             ` <BYAPR11MB30305218B921F31040FE4C1EC4380@BYAPR11MB3030.namprd11.prod.outlook.com>
2020-01-10 12:18               ` Pedro Alves
2020-01-10 14:41             ` Tom Tromey
2020-01-10 20:03               ` Pedro Alves
2019-10-17 22:59 ` [PATCH v2 13/24] Delete exit_inferior_silent(int pid) Pedro Alves
2019-10-17 22:59 ` [PATCH v2 20/24] gdbarch-selftests.c: No longer error out if debugging something Pedro Alves
2019-10-17 22:59 ` [PATCH v2 24/24] Multi-target: NEWS and user manual Pedro Alves
2019-10-17 23:00 ` [PATCH v2 14/24] Tweak handling of remote errors in response to resumption packet Pedro Alves
2019-10-18 20:23 ` [PATCH v2 00/24] Multi-target support John Baldwin
2019-10-29 19:13   ` Pedro Alves
2020-01-09 19:32     ` John Baldwin
2020-01-09 19:50       ` Pedro Alves
2020-01-10 13:49         ` Aktemur, Tankut Baris
2020-01-10 15:40           ` [PATCH] Switch the inferior before outputting its id in "info inferiors" (Re: [PATCH v2 00/24] Multi-target support) Pedro Alves
2019-10-20 11:41 ` Philippe Waroquiers [this message]
2019-10-29 19:56   ` [PATCH v2 00/24] Multi-target support Pedro Alves
2019-11-01 14:56 ` Tom Tromey
2020-01-10 20:13 ` Pedro Alves
2020-08-04  3:30   ` Kevin Buettner
2020-08-06 15:16     ` Pedro Alves
2020-08-06 17:49       ` Tom Tromey
2020-08-07 22:43       ` Kevin Buettner
2020-08-12 18:45         ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0deb38a1bee181cdcd6689d69ea69913f136f979.camel@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox