This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v4 2/2] multi-executable support (new v5 patch included)


On Wednesday 09 September 2009 07:40:23, Vladimir Prus wrote:
> On Tuesday 08 September 2009 Pedro Alves wrote:

> > I've tweaked things around so that MI's thread-groups are
> > created at the same time as before, but obviously, MI needs to
> > be extended to be able to support multi-exec + multi-inferiors
> > properly.
> 
> What do you mean precisely. I have no comment about the above behaviour
> in CLI, but I think that for MI it is important that the 'thread-group-created'
> notification is emitted only when you have "real" inferiour that frontend
> can interact with, and not some "fake" one that is associated with a
> file but is otherwise dead. 

You need to load symbols before starting the inferior to be able
to set breakpoints before running it.  On DICOS, you didn't have to
think about it, because all symbols were common to all inferiors.  On
linux you do, every inferior needs to have its own set of symbols.

> Also, what is exactly requires to support multi-exec/multi-inferiours?

Load multiple executables into the debug session, and be able to have
commands apply to them.  I'll give a couple examples below.

> Is there any reason why thread groups are not sufficient to represent this?

If you want to do two -exec-run's in the same session, how do you
specify which executable this is going to run?  That is, how do you
translate this to MI?

 gdb hello
 ...
 (gdb) break hello_main
 breakpoint 1 added.
 (gdb) add-inferior -exec goodbye
 Inferior 2 added.
 (gdb) info inferiors
    Num  Description       Executable
    2    <null>            goodbye
  * 1    <null>            hello
 (gdb) inferior 2
 Switched to inferior 2.
 (gdb) break goodbye_main
 breakpoint 2 added.
 (gdb) inferior 1
 (gdb) run&
 (gdb) inferior 2
 (gdb) run&
 <breakpoint 1 hit, inferior 1>
 <breakpoint 2 hit, inferior 2>

Extending -exec-run to include an optional executable argument works
mostly, but it is not sufficient.  You need to be able to load multiple
executables, and to be able to switch scope between them, not just
for breakpoints, watchpoints, etc., but for anything that can be possible
to do currently without a running inferior that reads symbols or memory
from the executable.   

Another thing that needs extending is shared libraries support.
Again, on DICOS we didn't have to think about this, since the shared
library list was global to all inferiors, but, on linux, what does this
mean?

 =library-loaded,id="/usr/lib/libfoo.so.2",target-name="/usr/lib/libfoo.so.2",host-name="/usr/lib/libfoo.so.2",symbols-loaded="0"

Which inferior loaded this library?

A related question is then, how to list the shared libraries of
a given inferior?

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]