[lldb-dev] Fix a build error on linux
Yao Qi
qiyaoltc at gmail.com
Sat May 11 23:12:49 PDT 2013
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;
}
More information about the lldb-dev
mailing list