This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: multiple live inferiors
- From: Pedro Alves <palves at redhat dot com>
- To: "taylor, david" <david dot taylor at emc dot com>, "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Thu, 11 Aug 2016 16:22:27 +0100
- Subject: Re: multiple live inferiors
- Authentication-results: sourceware.org; auth=none
- References: <63F1AEE13FAE864586D589C671A6E18B06CA71@MX203CL03.corp.emc.com>
On 08/11/2016 03:56 PM, taylor, david wrote:
> Currently GDB supports having multiple non-live inferiors. But, if I try to
> add a second live inferior it wants to kill the current live inferior.
By "non-live", I assume you mean file_stratum inferiors
(executable files, etc.). GDB does not support having multiple
core dump inferiors loaded.
gdb _does_ however support having multiple live inferiors. It works
as long as they're all behind the same target connection. E.g.,
multiple inferiors with the native target. Or
multiple inferiors against gdbserver. The simplest to get them
is to enable following forks, with "set detach-on-fork off".
You're trying to add a second target connection, which is
a bit orthogonal.
>
> That is, I can do:
>
> gdb some-file.elf
> set non-stop on
> set target-async on
> target extended-remote | program with some arguments
"program" here will be the server.
> add-inferior -exec new-file.elf
> info inferiors
> inferior 2
> target extended-remote | program with different arguments
>
So here replace the second "target extended-remote"
with "attach" or "run" to start the new inferior under
control of the first server.
> at which point GDB will say:
>
> A program is being debugged already. Kill it? (y or n)
>
> I'd be okay with the question if the current inferior was live. But, it is just an executable.
>
> I assume that there's more to changing this than just modifying target_preopen.
> What else is likely to break or need modification?
See here:
https://sourceware.org/gdb/wiki/MultiTarget
Thanks,
Pedro Alves