Unifying source/Host (Mac/Linux/BSD)


A couple of months ago LLDB had skeleton Linux support. The status of this port has degraded to unbuildable through flux in program interfaces and through changes to unnecessarily duplicated code.

This affects two main areas: source/Host and source/Plugins/Process.

To reverse this decline, and to begin extending support to the BSD family, I propose a restructuring of source/Host. It currently looks like this:


Large pieces of code in Host.cpp/Host.mm were identical but have drifted with development on the Mac side. I propose:


As much common code as possible is factored into Host.cpp, with Host.mm containing Obj C++ and cfcpp code. Preprocessor guards are used to insert platform-specific code into largely platform-independent functions. Factoring into API-specific directories (like POSIX, 4.4BSD, portable, etc.) became unwieldy when I tried it, to no real advantage.

I have a patch which implements this (~160KB, mostly moving functions around, so I didn't attach it but see [1]) for Mac OS X, Linux and FreeBSD. This patch is a prerequisite for other patches that I'm working on to restore and improve cross-platform functionality. Together these build LLDB with very limited functionality on all platforms.

Is this patch of interest, or would you be able to suggest a better way to begin tackling this problem?


[1] http://www.jcornwall.me.uk/temp/lldb-host-unify.patch
(requires manual SVN removal of dead files/directories if applied)


that patch sounds great, please feel free to commit it if you have commit access.

Anything that can help LLDB build on more platforms is a must have.