[Lldb-commits] [lldb] r191383 - Add support for TestPluginComands on Linux. Also, rework makefile dsym target.
Matt Kopec
Matt.Kopec at intel.com
Wed Sep 25 10:44:00 PDT 2013
Author: mkopec
Date: Wed Sep 25 12:44:00 2013
New Revision: 191383
URL: http://llvm.org/viewvc/llvm-project?rev=191383&view=rev
Log:
Add support for TestPluginComands on Linux. Also, rework makefile dsym target.
Modified:
lldb/trunk/test/functionalities/plugins/commands/Makefile
lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py
lldb/trunk/test/functionalities/plugins/commands/plugin.cpp
lldb/trunk/test/lldbtest.py
lldb/trunk/test/make/Makefile.rules
Modified: lldb/trunk/test/functionalities/plugins/commands/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/plugins/commands/Makefile?rev=191383&r1=191382&r2=191383&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/plugins/commands/Makefile (original)
+++ lldb/trunk/test/functionalities/plugins/commands/Makefile Wed Sep 25 12:44:00 2013
@@ -1,11 +1,8 @@
-all: foo.dylib
+LEVEL = ../../../make
-CWD := $(shell pwd)
+DYLIB_CXX_SOURCES := plugin.cpp
+DYLIB_NAME := plugin
+DYLIB_ONLY := YES
+MAKE_DSYM := NO
-all: foo.dylib
-
-foo.dylib:
- clang++ -O0 -g -stdlib=libc++ -dynamiclib -o plugin.dylib plugin.cpp -framework LLDB -F $(LLDB_FRAMEWORK)/..
-
-clean:
- rm -rf plugin.dylib plugin.dylib.dSYM/* plugin.dylib.dSYM
+include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py?rev=191383&r1=191382&r2=191383&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py (original)
+++ lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py Wed Sep 25 12:44:00 2013
@@ -16,19 +16,26 @@ class PluginCommandTestCase(TestBase):
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
+ self.lib_dir = os.environ["LLDB_LIB_DIR"]
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @skipIfi386 # This test links against liblldb.so. Thus, the test requires a 32-bit liblldb.so.
def test_load_plugin(self):
"""Test that plugins that load commands work correctly."""
- # Invoke the default build rule.
- self.buildDefault()
-
+ plugin_name = "plugin"
+ if sys.platform.startswith("darwin"):
+ plugin_lib_name = "lib%s.dylib" % plugin_name
+ else:
+ plugin_lib_name = "lib%s.so" % plugin_name
+
+ # Invoke the library build rule.
+ self.buildLibrary("plugin.cpp", plugin_name)
+
debugger = lldb.SBDebugger.Create()
retobj = lldb.SBCommandReturnObject()
-
- retval = debugger.GetCommandInterpreter().HandleCommand("plugin load plugin.dylib",retobj)
+
+ retval = debugger.GetCommandInterpreter().HandleCommand("plugin load %s" % plugin_lib_name, retobj)
retobj.Clear()
Modified: lldb/trunk/test/functionalities/plugins/commands/plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/plugins/commands/plugin.cpp?rev=191383&r1=191382&r2=191383&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/plugins/commands/plugin.cpp (original)
+++ lldb/trunk/test/functionalities/plugins/commands/plugin.cpp Wed Sep 25 12:44:00 2013
@@ -1,4 +1,4 @@
-//===-- fooplugin.cpp -------------------------------------------*- C++ -*-===//
+//===-- plugin.cpp -------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,9 +13,15 @@ Compile this into a dylib foo.dylib and
by typing plugin load foo.dylib at the LLDB command line
*/
+#if defined (__APPLE__)
#include <LLDB/SBCommandInterpreter.h>
#include <LLDB/SBCommandReturnObject.h>
#include <LLDB/SBDebugger.h>
+#else
+#include <lldb/API/SBCommandInterpreter.h>
+#include <lldb/API/SBCommandReturnObject.h>
+#include <lldb/API/SBDebugger.h>
+#endif
namespace lldb {
bool
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=191383&r1=191382&r2=191383&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Sep 25 12:44:00 2013
@@ -1329,14 +1329,20 @@ class Base(unittest2.TestCase):
# Build methods supported through a plugin interface
# ==================================================
- def buildDriver(self, sources, exe_name):
- """ Platform-specific way to build a program that links with LLDB (via the liblldb.so
- or LLDB.framework).
- """
+ def getstdFlag(self):
+ """ Returns the proper stdflag. """
if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():
stdflag = "-std=c++0x"
else:
stdflag = "-std=c++11"
+ return stdflag
+
+ def buildDriver(self, sources, exe_name):
+ """ Platform-specific way to build a program that links with LLDB (via the liblldb.so
+ or LLDB.framework).
+ """
+
+ stdflag = self.getstdFlag()
if sys.platform.startswith("darwin"):
dsym = os.path.join(self.lib_dir, 'LLDB.framework', 'LLDB')
@@ -1356,6 +1362,29 @@ class Base(unittest2.TestCase):
self.buildDefault(dictionary=d)
+ def buildLibrary(self, sources, lib_name):
+ """Platform specific way to build a default library. """
+
+ stdflag = self.getstdFlag()
+
+ if sys.platform.startswith("darwin"):
+ dsym = os.path.join(self.lib_dir, 'LLDB.framework', 'LLDB')
+ d = {'DYLIB_CXX_SOURCES' : sources,
+ 'DYLIB_NAME' : lib_name,
+ 'CFLAGS_EXTRAS' : "%s -stdlib=libc++" % stdflag,
+ 'FRAMEWORK_INCLUDES' : "-F%s" % self.lib_dir,
+ 'LD_EXTRAS' : "%s -Wl,-rpath,%s -dynamiclib" % (dsym, self.lib_dir),
+ }
+ elif sys.platform.startswith('freebsd') or sys.platform.startswith("linux") or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
+ d = {'DYLIB_CXX_SOURCES' : sources,
+ 'DYLIB_NAME' : lib_name,
+ 'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
+ 'LD_EXTRAS' : "-shared -L%s -llldb" % self.lib_dir}
+ if self.TraceOn():
+ print "Building LLDB Library (%s) from sources %s" % (lib_name, sources)
+
+ self.buildDefault(dictionary=d)
+
def buildProgram(self, sources, exe_name):
""" Platform specific way to build an executable from C/C++ sources. """
d = {'CXX_SOURCES' : sources,
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=191383&r1=191382&r2=191383&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Wed Sep 25 12:44:00 2013
@@ -239,16 +239,14 @@ endif
#----------------------------------------------------------------------
# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
#----------------------------------------------------------------------
+ifneq "$(DYLIB_ONLY)" "YES"
$(DSYM) : $(EXE)
ifeq "$(OS)" "Darwin"
ifneq "$(MAKE_DSYM)" "NO"
-ifeq "$(DYLIB_ONLY)" ""
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
endif
-endif
else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-ifeq "$(DYLIB_ONLY)" ""
objcopy --only-keep-debug "$(EXE)" "$(DSYM)"
objcopy --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
endif
More information about the lldb-commits
mailing list