add-inferior / clone-inferior

Luis Machado lgustavo@codesourcery.com
Mon May 20 15:06:00 GMT 2013


On 05/20/2013 04:43 PM, David Taylor wrote:
> The commands add-inferior / clone-inferior and several related commands
> were added as long ago as gdb 7.1.  But, unless I'm missing the obvious,
> they aren't currently very useful.
>
> GDB appears to support multiple "live" inferiors only when the arise as
> the result of a fork or vfork.  Please tell me that I'm wrong and that
> I'm missing the obvious.
>
>      . I start up gdb with no arguments
>      . file my-elf-file
>      . clone-inferior
>      . info inferiors
>
> I now have two inferiors, numbers 1 and 2, same elf file; 1 is curent.
>
>      . target remote <arguments>
>      . inferior 2
>      . target remote <different-arguments>
>
> And I get:
>
>      A program is being debugged already.  Kill it? (y or n)

This is expected since you can actually have two inferiors, but you are 
only allowed to connect to a single remote target at one time.

What would've worked is first connecting to a remote target in 
*extended* remote mode. Then you would be able to attach to more than a 
process at a time, or start more than a process at a time.

By using "target remote", you're really trying to debug an already 
active process running on a remote system.

I'd suggest reading about the extended remote mode. That looks like what 
you want, though multiprocess support is still a WIP.



More information about the Gdb mailing list