[lldb-dev] Linux process plugin

Greg Clayton gclayton at apple.com
Tue Sep 28 08:22:25 PDT 2010


On Sep 28, 2010, at 4:42 AM, arvid.picciani at nokia.com wrote:

> I think,I need some help getting the linux process plugin working. Getting it compiling was easy so far, but it won't work, 
> and for me its not easy too see how its supposed to work either.
> First of all, why does it run the inferior in a pty? I don't see why we would need an entire terminal there.

On MacOSX we hand a pty to our inferior using posix_spawn file attributes and we run a single read thread to watch for the input. We use a pty by default to stay as close to what would be run in a terminal. You can specify the file handles you want the inferior to use in process launch:

process launch --stdin /dev/null --stdout /dev/null --stderr /dev/null ....

> Secondly, why is there one thread per fd afterwards?

Not sure why linux would be running three threads.

> Basicly it does pretty much nothing:
> (lldb) r
> Launching '/tmp/crashd/a.out'  (x86_64)
> (lldb) 
> it randomly works after a few times, but only results in a visible effect when the inferior crashes.
> It then tries to send a message to the crashed process, which crashes lldb. There is a FIXME in there, 
> but why is this on a seperate thread in the first place?

Eli Friedman was the person leading the linux port, so I will have to defer linux questions to him.

I believe the linux plug-in also needs to get a DynamicLoader plug-in created for it at some point so that shared library loads/unloads can be detected and breakpoints in shared libraries will work.

You can see all of the logging that you can enable:

(lldb) log list

Each plug-in that is installed can install named logged channels that can have multiple categories. 

There is a lot of internal logging you can enable to see what might be going on:

(lldb) log enable lldb default

Then try and run and see if you see anything obvious. The linux plug-in should add its own logging channel so the details of the debug session can be logged when things go wrong.

Greg Clayton



More information about the lldb-dev mailing list