Merged Eli Friedman's linux build changes where he added Makefile files that
enabled LLVM make style building and made this compile LLDB on Mac OS X. We
can now iterate on this to make the build work on both linux and macosx.
llvm-svn: 108009
diff --git a/lldb/source/Host/Makefile b/lldb/source/Host/Makefile
new file mode 100644
index 0000000..76e3d34
--- /dev/null
+++ b/lldb/source/Host/Makefile
@@ -0,0 +1,20 @@
+##===- source/Host/Makefile --------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+
+include $(LLDB_LEVEL)/../../Makefile.config
+
+ifeq ($(HOST_OS),Darwin)
+DIRS := macosx posix
+else
+DIRS := linux posix
+endif
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Host/linux/Makefile b/lldb/source/Host/linux/Makefile
new file mode 100644
index 0000000..bd6d7e4
--- /dev/null
+++ b/lldb/source/Host/linux/Makefile
@@ -0,0 +1,14 @@
+##===- source/Host/linux/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+LIBRARYNAME := lldbHostLinux
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index 4aee444..b2ca2bb 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -23,9 +23,9 @@
#include <Foundation/Foundation.h>
-#include "CFCBundle.h"
-#include "CFCReleaser.h"
-#include "CFCString.h"
+#include "cfcpp/CFCBundle.h"
+#include "cfcpp/CFCReleaser.h"
+#include "cfcpp/CFCString.h"
#include "lldb/Host/Host.h"
#include "lldb/Core/ArchSpec.h"
@@ -434,7 +434,7 @@
// Set the pthread name if possible
if (pid == curr_pid && tid == curr_tid)
{
- ::pthread_setname_np (name) == 0;
+ ::pthread_setname_np (name);
}
#endif
ThreadNameAccessor (false, pid, tid, name);
@@ -446,21 +446,22 @@
static FileSpec g_program_filepsec;
if (!g_program_filepsec)
{
- std::string program_fullpath;
- program_fullpath.resize (PATH_MAX);
+ char program_fullpath[PATH_MAX];
// If DST is NULL, then return the number of bytes needed.
- uint32_t len = program_fullpath.size();
- int err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len);
- if (err < 0)
- {
- // The path didn't fit in the buffer provided, increase its size
- // and try again
- program_fullpath.resize(len);
- len = program_fullpath.size();
- err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len);
- }
+ uint32_t len = sizeof(program_fullpath);
+ int err = _NSGetExecutablePath (program_fullpath, &len);
if (err == 0)
- g_program_filepsec.SetFile(program_fullpath.data());
+ g_program_filepsec.SetFile (program_fullpath);
+ else if (err == -1)
+ {
+ char *large_program_fullpath = (char *)::malloc (len + 1);
+
+ err = _NSGetExecutablePath (large_program_fullpath, &len);
+ if (err == 0)
+ g_program_filepsec.SetFile (large_program_fullpath);
+
+ ::free (large_program_fullpath);
+ }
}
return g_program_filepsec;
}
@@ -505,7 +506,7 @@
struct MonitorInfo
{
- int handle;
+ uint32_t handle;
pthread_t thread;
Host::MonitorChildProcessCallback callback;
void *callback_baton;
diff --git a/lldb/source/Host/macosx/Makefile b/lldb/source/Host/macosx/Makefile
new file mode 100644
index 0000000..de50589
--- /dev/null
+++ b/lldb/source/Host/macosx/Makefile
@@ -0,0 +1,16 @@
+##===- source/Host/macosx/Makefile -------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+LIBRARYNAME := lldbHostMacOSX
+BUILD_ARCHIVE = 1
+
+SOURCES := $(notdir $(wildcard *.cpp *.mm))
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index 2b8026f..ccdde69 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -19,20 +19,23 @@
#include <CoreFoundation/CoreFoundation.h>
// Project includes
-#include "CFCReleaser.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/UUID.h"
+#include "Host/macosx/cfcpp/CFCReleaser.h"
+
using namespace lldb;
using namespace lldb_private;
extern "C" {
+
CFURLRef DBGCopyFullDSYMURLForUUID (CFUUIDRef uuid, CFURLRef exec_url);
CFDictionaryRef DBGCopyDSYMPropertyLists (CFURLRef dsym_url);
-};
+
+}
static bool
SkinnyMachOFileContainsArchAndUUID
diff --git a/lldb/source/Host/posix/Makefile b/lldb/source/Host/posix/Makefile
new file mode 100644
index 0000000..d263510
--- /dev/null
+++ b/lldb/source/Host/posix/Makefile
@@ -0,0 +1,14 @@
+##===- source/Host/posix/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+LIBRARYNAME := lldbHostPosix
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile