Message ID | 0deb38a1bee181cdcd6689d69ea69913f136f979.camel@skynet.be |
---|---|
State | New |
Headers | show |
On 10/20/19 12:41 PM, Philippe Waroquiers wrote: > 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). Guess you missed that this was in the users/palves/multi-target-v2 branch. :-/ > 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. That's great to hear. > > 3 notes: > * It might be interesting to one day add > something like 'inferior apply all/list of inferiors SOMMECOMMAND' Agreed. > * 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've tried to debug this a little, but I'd like to punt for now. The error I'm seeing first comes from a breakpoint re-set, where gdb tries to read memory from the valgrind that is running. Breakpoint re-sets currently are too dumb and re-set all locations, instead of only adding/removing the locations necessary. And then that is running into the fact that the remote protocol in the old all-stop mode (which is what valgrind supports) is synchronous, gdb can't talk to the remote target until the target reports a stop. These sorts of issues is why I required that the remote backends support non-stop mode for this initial pass. I'd rather not have to fix all these issues before landing the initial multi-target support, even if we know there are issues we need to fix to make it cope better with all-stop-only targets. > * 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. Yes, that is fine with me. Thanks, Pedro Alves
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"));