Fix a build error on linux

Hi,
I got the following build error when build lldb trunk on Linux:

/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp: In static member function ‘static void ProcessLinux::Initialize()’:
/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp:59:66: error: no matching function for call to ‘ProcessPOSIXLog::RegisterPluginName(lldb_private::ConstString)’
/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp:59:66: note: candidate is:
/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h:47:5: note: static void ProcessPOSIXLog::RegisterPluginName(const char*)
/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h:47:5: note: no known conversion for argument 1 from ‘lldb_private::ConstString’ to ‘const char*’
make[2]: *** [tools/lldb/source/Plugins/Process/Linux/CMakeFiles/lldbPluginProcessLinux.dir/ProcessLinux.cpp.o] Error 1
make[1]: *** [tools/lldb/source/Plugins/Process/Linux/CMakeFiles/lldbPluginProcessLinux.dir/all] Error 2

After this commit
<http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20130506/008401.html>,
we start to use ConstString for plugin-name, so I change the type of
field 'm_pluginname' of class 'ProcessPOSIXLog' from 'const char *' to
'ConstString'. The patch below fixes this error. However, this patch
doesn't unbreak the lldb build on linux, because of another error.
I'll describe it in the next mail.

diff --git a/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp b/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
index d673ab4..38b2062 100644
--- a/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
+++ b/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
@@ -172,7 +172,7 @@ ProcessPOSIXLog::ListLogCategories (Stream *strm)
                   " thread - log thread events and activities\n"
                   " step - log step related activities\n"
                   " verbose - enable verbose logging\n"
- " watch - log watchpoint related activities\n", ProcessPOSIXLog::m_pluginname);
+ " watch - log watchpoint related activities\n", ProcessPOSIXLog::m_pluginname.GetCString());
}

@@ -190,4 +190,4 @@ ProcessPOSIXLog::LogIf (uint32_t mask, const char *format, ...)
}

int ProcessPOSIXLog::m_nestinglevel;
-const char *ProcessPOSIXLog::m_pluginname = "";
+ConstString ProcessPOSIXLog::m_pluginname("");
diff --git a/source/Plugins/Process/POSIX/ProcessPOSIXLog.h b/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
index 7707a12..f0580b0 100644
--- a/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
+++ b/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
@@ -16,6 +16,7 @@

// Project includes
#include "lldb/Core/Log.h"
+#include "lldb/Core/ConstString.h"

#define POSIX_LOG_VERBOSE (1u << 0)
#define POSIX_LOG_PROCESS (1u << 1)
@@ -40,11 +41,11 @@
class ProcessPOSIXLog
{
     static int m_nestinglevel;
- static const char *m_pluginname;
+ static lldb_private::ConstString m_pluginname;

public:
     static void
- RegisterPluginName(const char *pluginName)
+ RegisterPluginName(const lldb_private::ConstString &pluginName)
     {
         m_pluginname = pluginName;
     }

With the patch in the last mail applied, the build moves on but there is another build failure:

/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp: In constructor ‘DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel(lldb_private::Process*, lldb::addr_t)’:
/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:463:59: error: ‘PlatformDarwinKernel’ has not been declared
/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp: In member function ‘bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(lldb_private::Process*)’:
/home/yao/Source/llvm/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:815:53: error: ‘PlatformDarwinKernel’ has not been declared

class 'PlatformDarwinKernel' is wrapped by checking macro '__APPLE__' defined or not, but it is used unconditionally in DynamicLoaderDarwinKernel.cpp. That is the reason why the build failed on linux, but my two-days lldb knowledge isn't enough to fix this problem.

% svn commit
Sending source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
Sending source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
Transmitting file data ..
Committed revision 181717.

This fix should get things building again. We are tracking to correct fix internally.

Greg Clayton