* Multiple remote inferiors
@ 2011-04-06 15:02 Kevin Pouget
2011-04-06 17:44 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Pouget @ 2011-04-06 15:02 UTC (permalink / raw)
To: gdb
Hello,
it looks like it's not possible to connect to several
remote/extended-remote inferiors at the same time:
(gdb) target remote :1234
...
(gdb) add-inferior
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [process 0] (<noexec>)]
(gdb) target remote :1235
A program is being debugged already. Kill it? (y or n)
and I was wondering what was the reason?
it should theoretically be possible, now that multiprocess debugging
has been enabled, so maybe it's because remote.c relies a lot on
global variables?
Cordially,
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple remote inferiors
2011-04-06 15:02 Multiple remote inferiors Kevin Pouget
@ 2011-04-06 17:44 ` Pedro Alves
2011-04-06 18:50 ` Kevin Pouget
0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2011-04-06 17:44 UTC (permalink / raw)
To: gdb; +Cc: Kevin Pouget
On Wednesday 06 April 2011 16:02:15, Kevin Pouget wrote:
> Hello,
>
> it looks like it's not possible to connect to several
> remote/extended-remote inferiors at the same time:
>
> (gdb) target remote :1234
> ...
> (gdb) add-inferior
> Added inferior 2
> (gdb) inferior 2
> [Switching to inferior 2 [process 0] (<noexec>)]
> (gdb) target remote :1235
> A program is being debugged already. Kill it? (y or n)
>
>
> and I was wondering what was the reason?
GDB support multiple processes, but they currently
all need to be behind the same target.
For remote targets, only extended-remote allows that.
E.g., adding a new inferior with add-inferior, switching
to it, and doing "start", should work.
> it should theoretically be possible,
This is just software, so in theory, anything
is possible. :-)
> now that multiprocess debugging
> has been enabled, so maybe it's because remote.c relies a lot on
> global variables?
It goes further beyond that. There's only one target_ops stack.
Going multi-target would be awesome.
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple remote inferiors
2011-04-06 17:44 ` Pedro Alves
@ 2011-04-06 18:50 ` Kevin Pouget
2011-04-06 19:30 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Pouget @ 2011-04-06 18:50 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb
On Wed, Apr 6, 2011 at 7:44 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Wednesday 06 April 2011 16:02:15, Kevin Pouget wrote:
>> Hello,
>>
>> it looks like it's not possible to connect to several
>> remote/extended-remote inferiors at the same time:
>>
>> (gdb) target remote :1234
>> ...
>> (gdb) add-inferior
>> Added inferior 2
>> (gdb) inferior 2
>> [Switching to inferior 2 [process 0] (<noexec>)]
>> (gdb) target remote :1235
>> A program is being debugged already. Kill it? (y or n)
>>
>> and I was wondering what was the reason?
>
> GDB support multiple processes, but they currently
> all need to be behind the same target.
>
> For remote targets, only extended-remote allows that.
> E.g., adding a new inferior with add-inferior, switching
> to it, and doing "start", should work.
yes, sure, I wanted to use only the "remote" target stack to connect
GDB to 2 different inferiors
"start" seems not to be used with the remote/extended remote ("No
symbol table loaded. Use the "file" command.") target,
(gdb) target [extended-]remote <location>
is, AFAIK, the only way to initiate such a connection
>
>> it should theoretically be possible,
>
> This is just software, so in theory, anything
> is possible. :-)
:)
I meant, "easily feasible with the current GDB implementation!"
> It goes further beyond that. There's only one target_ops stack.
> Going multi-target would be awesome.
yep, sure ! but that's why my initial question only targeted the
remote target stack, and (although I'm not sure that's mandatory) the
same target architecture
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple remote inferiors
2011-04-06 18:50 ` Kevin Pouget
@ 2011-04-06 19:30 ` Pedro Alves
[not found] ` <BANLkTinjtiS6cp6WpS=8FULQJdxWuO7K8Q@mail.gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2011-04-06 19:30 UTC (permalink / raw)
To: Kevin Pouget; +Cc: gdb
On Wednesday 06 April 2011 19:50:15, Kevin Pouget wrote:
> yes, sure, I wanted to use only the "remote" target stack to connect
> GDB to 2 different inferiors
>
> "start" seems not to be used with the remote/extended remote ("No
> symbol table loaded. Use the "file" command.") target,
So do what it says. :-) Each inferior has its own set
of symbols, so you get to use "file" to load the executable
into GDB, just like if you had a simple inferior and did:
$ gdb
(gdb) tar extended-remote :xxxx
...
(gdb) start
No symbol table loaded. Use the "file" command.
You can use "add-inferior -exec <FILENAME>" as shortcut.
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple remote inferiors
[not found] ` <BANLkTinjtiS6cp6WpS=8FULQJdxWuO7K8Q@mail.gmail.com>
@ 2011-04-08 9:43 ` Kevin Pouget
2011-04-08 10:02 ` Jan Kratochvil
2011-04-08 10:00 ` Pedro Alves
1 sibling, 1 reply; 7+ messages in thread
From: Kevin Pouget @ 2011-04-08 9:43 UTC (permalink / raw)
To: gdb
Hi Pedro,
thanks for your answer, I gave it a try, but it seems to behave a bit strangely.
--> should it be possible to start _two different_ processes from a
single GDBServer ?
here is what I got (debugging functionPtr and stackoverflow):
> $ gdbserver :1234 functionPtr
> Process functionPtr created; pid = 10820
> Listening on port 1234
> Remote debugging from host 127.0.0.1
> Process functionPtr created; pid = 10825
> $ gdb functionPtr
> GNU gdb (GDB) Fedora (7.2-46.fc14)
> ...
> Reading symbols from /home/kevin/travail/arm/perso/root/sample/debug/functionPtr...done.
> (gdb) target extended-remote :1234
> Remote debugging using :1234
> ...
> (gdb) b main
> Breakpoint 1 at 0x400533: file ./functionPtr.c, line 8.
> (gdb) c
> Continuing.
> Breakpoint 1, main () at ./functionPtr.c:8
> 8 void (* my_say) (const char *) = NULL ;
>
> (gdb) add-inferior
> Added inferior 2
> (gdb) inferior 2
> [Switching to inferior 2 [Thread 0.0] (<noexec>)]
> (gdb) file stackoverflow
> Reading symbols from /home/kevin/travail/arm/perso/root/sample/debug/stackoverflow...done.
> (gdb) b main
> Breakpoint 2 at 0x400522: file stackoverflow.c, line 10.
> (gdb) r
> Starting program: /home/kevin/travail/arm/perso/root/sample/debug/stackoverflow
> Ignoring packet error, continuing...
GDBServer tries to start functionPtr twice, as confirmed by the `pstree'
> $ pstree | grep functionPtr
> .... bash---gdbserver---2*[functionPtr]
is it a bug or <del>a feature</del> a wrong usage of GDB ?
but ultimately, what I would like to do is connecting GDB to two
*different* gdbservers, ie maintain two TCP connections
simultaneously.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple remote inferiors
[not found] ` <BANLkTinjtiS6cp6WpS=8FULQJdxWuO7K8Q@mail.gmail.com>
2011-04-08 9:43 ` Kevin Pouget
@ 2011-04-08 10:00 ` Pedro Alves
1 sibling, 0 replies; 7+ messages in thread
From: Pedro Alves @ 2011-04-08 10:00 UTC (permalink / raw)
To: Kevin Pouget; +Cc: gdb
On Friday 08 April 2011 10:40:44, Kevin Pouget wrote:
> Hi Pedro,
>
> thanks for your answer, I gave it a try, but it seems to behave a bit strangely.
Hmm, yes, I can see how you've hit something confusing.
>
> --> should it be possible to start _two different_ processes from a single GDBServer ?
Yes.
>
> here is what I got (debugging functionPtr and stackoverflow):
>
> $ gdbserver :1234 functionPtr
This sets the default process to launch as "functionPtr".
> Process functionPtr created; pid = 10820
> Listening on port 1234
> Remote debugging from host 127.0.0.1
> Process functionPtr created; pid = 10825
>
> $ gdb functionPtr
> GNU gdb (GDB) Fedora (7.2-46.fc14)
> ...
> Reading symbols from /home/kevin/travail/arm/perso/root/sample/debug/functionPtr...done.
> (gdb) target extended-remote :1234
> Remote debugging using :1234
> ...
> (gdb) b main
> Breakpoint 1 at 0x400533: file ./functionPtr.c, line 8.
> (gdb) c
> Continuing.
> Breakpoint 1, main () at ./functionPtr.c:8
> 8 void (* my_say) (const char *) = NULL ;
>
> (gdb) add-inferior
> Added inferior 2
> (gdb) inferior 2
> [Switching to inferior 2 [Thread 0.0] (<noexec>)]
> (gdb) file stackoverflow
> Reading symbols from /home/kevin/travail/arm/perso/root/sample/debug/stackoverflow...done.
There is no automatic connection between GDB's executable, and the
executable gdbserver spawns. You also need to
do "set remote exec-file FOO"
I was assuming you'd start gdbserver with --multi, like so:
$ gdbserver --multi :9999
Which would have forced you to use that command at least once
and make the problem more obvious.
> (gdb) b main
> Breakpoint 2 at 0x400522: file stackoverflow.c, line 10.
> (gdb) r
> Starting program: /home/kevin/travail/arm/perso/root/sample/debug/stackoverflow
> Ignoring packet error, continuing...
This shouldn't happen. Is it a red herring?
> but ultimately, what I would like to do is connecting GDB to two *different* gdbservers, ie maintain two TCP connections simultaneously.
A lot to do to get there, but the good thing is that
we're closer that ever. :-)
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple remote inferiors
2011-04-08 9:43 ` Kevin Pouget
@ 2011-04-08 10:02 ` Jan Kratochvil
0 siblings, 0 replies; 7+ messages in thread
From: Jan Kratochvil @ 2011-04-08 10:02 UTC (permalink / raw)
To: Kevin Pouget; +Cc: gdb
On Fri, 08 Apr 2011 11:42:55 +0200, Kevin Pouget wrote:
> --> should it be possible to start _two different_ processes from a
> single GDBServer ?
yes, I have already seen it working.
> here is what I got (debugging functionPtr and stackoverflow):
>
> > $ gdbserver :1234 functionPtr
I would say --multi should be here.
> > GNU gdb (GDB) Fedora (7.2-46.fc14)
Reproduced also with: GNU gdb (GDB) 7.3.50.20110408-cvs
$ gdbserver --multi :1234
Listening on port 1234
Remote debugging from host 127.0.0.1
Process /home/jkratoch/t/1 created; pid = 1921
Process /home/jkratoch/t/2 created; pid = 1968
$ gdb ~/t/1
GNU gdb (GDB) 7.3.50.20110408-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jkratoch/t/1...done.
(gdb) target extended-remote localhost:1234
Remote debugging using localhost:1234
(gdb) set remote exec-file /home/jkratoch/t/1
(gdb) start
Temporary breakpoint 1 at 0x400483: file 1.c, line 5.
Starting program: /home/jkratoch/t/1
Temporary breakpoint 1, main () at 1.c:5
5 return f ();
(gdb) add-inferior
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [Thread 0.0] (<noexec>)]
(gdb) set remote exec-file /home/jkratoch/t/2
(gdb) file /home/jkratoch/t/2
Reading symbols from /home/jkratoch/t/2...done.
(gdb) start
Temporary breakpoint 2 at 0x400478: file 2.c, line 4.
Starting program: /home/jkratoch/t/2
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Malformed response to offset query, timeout
(gdb) q
Thanks,
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-04-08 10:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-06 15:02 Multiple remote inferiors Kevin Pouget
2011-04-06 17:44 ` Pedro Alves
2011-04-06 18:50 ` Kevin Pouget
2011-04-06 19:30 ` Pedro Alves
[not found] ` <BANLkTinjtiS6cp6WpS=8FULQJdxWuO7K8Q@mail.gmail.com>
2011-04-08 9:43 ` Kevin Pouget
2011-04-08 10:02 ` Jan Kratochvil
2011-04-08 10:00 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox