summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Wilson <wilsons@start.ca>2011-03-23 01:58:26 +0000
committerStephen Wilson <wilsons@start.ca>2011-03-23 01:58:26 +0000
commit3e2a18f61e671bc5ff22ef9b4cf6031108dbab6d (patch)
tree30f622fe9695c59898a1d7c3c2bd35c5929c798c
parentb1fd32858177f9dbc2eab3069be0f1f66876edfb (diff)
downloadbcm5719-llvm-3e2a18f61e671bc5ff22ef9b4cf6031108dbab6d.tar.gz
bcm5719-llvm-3e2a18f61e671bc5ff22ef9b4cf6031108dbab6d.zip
linux: add Host/linux subdirectory
Start putting linux specific host code in its own directory. For now, just implement Host::GetOSVersion. llvm-svn: 128133
-rw-r--r--lldb/lib/Makefile3
-rw-r--r--lldb/source/Host/Makefile4
-rw-r--r--lldb/source/Host/linux/Host.cpp35
-rw-r--r--lldb/source/Host/linux/Makefile14
4 files changed, 55 insertions, 1 deletions
diff --git a/lldb/lib/Makefile b/lldb/lib/Makefile
index 5cb956e0caa..d3398fa2c15 100644
--- a/lldb/lib/Makefile
+++ b/lldb/lib/Makefile
@@ -72,7 +72,8 @@ endif
ifeq ($(HOST_OS),Linux)
USEDLIBS += lldbPluginProcessLinux.a \
lldbPluginDynamicLoaderLinux.a \
- lldbPluginPlatformLinux.a
+ lldbPluginPlatformLinux.a \
+ lldbHostLinux.a
endif
include $(LEVEL)/Makefile.common
diff --git a/lldb/source/Host/Makefile b/lldb/source/Host/Makefile
index 63c7a5f34fe..b26528c2b69 100644
--- a/lldb/source/Host/Makefile
+++ b/lldb/source/Host/Makefile
@@ -17,4 +17,8 @@ ifeq ($(HOST_OS),Darwin)
DIRS += macosx
endif
+ifeq ($(HOST_OS),Linux)
+DIRS += linux
+endif
+
include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
new file mode 100644
index 00000000000..b0d43e87de6
--- /dev/null
+++ b/lldb/source/Host/linux/Host.cpp
@@ -0,0 +1,35 @@
+//===-- source/Host/linux/Host.cpp ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+#include <stdio.h>
+#include <sys/utsname.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Host/Host.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+bool
+Host::GetOSVersion(uint32_t &major,
+ uint32_t &minor,
+ uint32_t &update)
+{
+ struct utsname un;
+ int status;
+
+ if (uname(&un))
+ return false;
+
+ status = sscanf(un.release, "%u.%u.%u", &major, &minor, &update);
+ return status == 3;
+}
diff --git a/lldb/source/Host/linux/Makefile b/lldb/source/Host/linux/Makefile
new file mode 100644
index 00000000000..bd6d7e4fff8
--- /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
OpenPOWER on IntegriCloud