[Lldb-commits] [PATCH 3/3] Rearrange #include's, initialization/termination.

Stephen Wilson wilsons at start.ca
Thu Dec 16 14:29:54 PST 2010


Hi Greg,

Greg Clayton <gclayton at apple.com> writes:

> This one shouldn't be committed, we will need to get the
> UnwindAssemblyProfiler-x86, ArchDefaultUnwindPlan-x86, and the
> ArchVolatileRegs-x86 to compile and build on linux. They are the basis
> for our i386/x86_64 unwinder. This unwinder should be able to be used
> by the linux debugger plug-in as the unwinder for both i386 and for
> x86_64.
>
> Do these files not build on linux? Is the make system just not
> building these? If the build system isn't then it should be.

Currently the build system does not enter Process/Utility.

The main issue here is LLDB's libunwind.  I have not looked deeply at
what is needed to get libunwind to build on linux -- I expect it will
take some time.

The main focus of these patches is to simply get the tree to build under
linux without compromising the Darwin build, and to do so with the
smallest number of changes possible.  Once the tree is buildable my plan
was to start working on all of the "missing" features and re-integrate
support.

However, if you feel that this is not a proper strategy that is
perfectly OK with me -- I can keep this change local and still have a
buildable tree and submit patches against Process/Utility down the road.


> Stephen, let me know what issue you run into when tryingo t build these?

There are quite a few.  For example we need to conditionalize the
include of Availability.h and provide Linux builds with an empty define
for __OSX_AVAILABLE_STARTING (libunwind.h).  We need to remove
references to mach/mach_types.h, mach/machine.h etc and use the support
headers provided by LLVM (possibly extending them?).  There are quite a
few other examples.

Of course, I may be wrong here in expecting that LLDB's libunwind is
intended to be cross-platform in time -- perhaps we should be using the
system libunwind on linux?

If we want to use the system libunwind on linux then we will need to
figure out how to work around the fact that the symbols are extern "C"
and do not live in the lldb_private namespace.

Please let me know if you have any suggestions on how to approach this
problem and I would be happy to look into any other approaches.


Take care,

> Greg Clayton


>
>
> On Dec 16, 2010, at 12:54 PM, Stephen Wilson wrote:
>
>> Guard #include's and component initialization/termination with the __APPLE__
>> define to allow compilation on non-Apple platforms.
>> 
>> diff --git a/source/lldb.cpp b/source/lldb.cpp
>> index 137ad86..ae8fe6a 100644
>> --- a/source/lldb.cpp
>> +++ b/source/lldb.cpp
>> @@ -24,9 +24,6 @@
>> #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
>> #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
>> #include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
>> -#include "Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h"
>> -#include "Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h"
>> -#include "Plugins/Process/Utility/ArchVolatileRegs-x86.h"
>> 
>> #ifdef __APPLE__
>> #include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
>> @@ -39,6 +36,9 @@
>> #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
>> #include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h"
>> #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
>> +#include "Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h"
>> +#include "Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h"
>> +#include "Plugins/Process/Utility/ArchVolatileRegs-x86.h"
>> #endif
>> 
>> #ifdef __linux__
>> @@ -73,11 +73,11 @@ lldb_private::Initialize ()
>>         SymbolFileDWARF::Initialize();
>>         SymbolFileDWARFDebugMap::Initialize();
>>         SymbolFileSymtab::Initialize();
>> +
>> +#ifdef __APPLE__
>>         UnwindAssemblyProfiler_x86::Initialize();
>>         ArchDefaultUnwindPlan_x86::Initialize();
>>         ArchVolatileRegs_x86::Initialize();
>> -
>> -#ifdef __APPLE__
>>         ABIMacOSX_i386::Initialize();
>>         ABISysV_x86_64::Initialize();
>>         DynamicLoaderMacOSXDYLD::Initialize();
>> @@ -112,11 +112,11 @@ lldb_private::Terminate ()
>>     SymbolFileDWARF::Terminate();
>>     SymbolFileDWARFDebugMap::Terminate();
>>     SymbolFileSymtab::Terminate();
>> +
>> +#ifdef __APPLE__
>>     UnwindAssemblyProfiler_x86::Terminate();
>>     ArchDefaultUnwindPlan_x86::Terminate();
>>     ArchVolatileRegs_x86::Terminate();
>> -
>> -#ifdef __APPLE__
>>     DynamicLoaderMacOSXDYLD::Terminate();
>>     ItaniumABILanguageRuntime::Terminate();
>>     AppleObjCRuntimeV2::Terminate();
>> -- 
>> 1.7.3.2
>> 
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>

--
steve



More information about the lldb-commits mailing list