Multiple targets/processes

Hi all,

I’ve been playing around with lldb’s ability to create multiple targets and switch between them from the command line.

I can

target create
process launch
^C
target create
process launch
^C
target select 0
cont

Is there any way to get both processes running in parallel from the command line? what about the API? Are there any docs I can read about this?

Thanks,

Vince

Hi Vince, as for the SB API, take a look at test/api/multiple-debuggers/multi-process-driver.cpp. This particular test program is creating separate Debugger/Target/Processes on multiple threads. It's designed to help find race conditions so it has e.g. 50 threads all debugging the same inferior process, all putting breakpoints on the same place, running to that place, etc. Nothing interesting but you can see how it's straightforward to run multiple inferior processes at one time.

J

Yes you can, just don't use STDIN/STDOUT:

target create
process launch --no-stdio
target create
process launch --no-stdio

When you use STDIN/OUT/ERR then we hook this up to the in/out/error of the debugger by pushing a new ProcessIOHandler which intercepts all incoming and outgoing data and displays it on a screen. If an IDE was running this, it might create a new SBDebugger, one for each debug window. When the IDE launches a process, it would redirect the STDIO to the slave side of a PTY while the IDE would have the master side open allowing it to communicate with the process on a side channel (stdio window). So you are running into this problem because you are trying to do this with the command line LLDB and IO is enabled.

Gre

To further clarify: no stdio for a process means the ProcessIOHandler doesn't get pushed and it stop it from trying to take over the terminal and allows commands to be run on the command line while the process is running.

Greg