[lldb-dev] Support for Linux core files

Martin Milata xmilata at fi.muni.cz
Wed Oct 17 10:51:12 PDT 2012


On Mon, Oct 15, 2012 at 09:49:59 -0700, Greg Clayton wrote:
> 
> On Oct 15, 2012, at 3:09 AM, Martin Milata <xmilata at fi.muni.cz> wrote:
> 
> > Hello,
> > I would like to write a simple tool that, given a Linux core dump,
> > produces a list of variables and their values (for those variables for
> > which it can be determined). I'm considering writing the tool on top of
> > LLDB.
> 
> That should be easy.
> 
> > If I understand correctly, there is no support for Linux cores in LLDB.
> 
> Correct, there is no linux core support currently.
> 
> 
> > What would it take to implement it?
> 
> We support mach-o core files, so there is some great example code that
> should be easy to adapt. The the mach-o core file example plug-in:
> 
> lldb/source/Plugins/Process/mach-core
> 
> 
> > Is it just a matter of implementing
> > the Process subclass for Linux cores?
> 
> Yes, see very simple and quick example in
> lldb/source/Plugins/Process/mach-core. Basically the linux plug-in
> will need to recognize linux core files and know how to parse them. I
> am not sure what the linux core file format is. On MacOSX, our core
> files are just mach-o files (very similar to executable files). As
> long as the linux core file is an ELF file, you should be good to go
> and the port should be easy. If not, you will need to write a
> "ObjectFile" subclass to parse the core file, or just parse it
> manually in your ProcessLinuxCore (you might want to name this
> ProcessELFCore if it is not tied to linux).

Yes, linux cores are indeed ELF files.

> > Or is there any other Linux-related functionality missing?
> 
> There is a lot of work going on for Linux right now, so it should be
> pretty functional as far as running/attaching.
> 
> > I see that there is support for
> > Linux processes but I haven't been successful in compiling LLDB yet, so
> > I can not try it out myself.
> 
> See the other messages on this build list. The message thread right
> before you e-mail had details on how to successfully build on linux.

Thanks for the information, Greg. Even though I really like the LLDB
design and the linux core support seems like a fun little project, I
have for other reasons decided not to use LLDB. So if anyone reading
this would like to have this feature - go ahead, I'm not working on it;)

Martin



More information about the lldb-dev mailing list