fdeazeve updated this revision to Diff 458240.
fdeazeve added a comment.
Added test changes for tests known to be faulty in the presence of a standard
library containing debug symbols, so that developers using debug builds don't
see any failures.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132940/new/
https://reviews.llvm.org/D132940
Files:
lldb/packages/Python/lldbsuite/test/lldbutil.py
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/test/API/commands/expression/fixits/TestFixIts.py
lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
lldb/test/API/lang/objc/exceptions/Makefile
lldb/test/API/macosx/macCatalyst/Makefile
lldb/test/API/python_api/sbmodule/TestSBModule.py
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
Index: lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
+++ lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
@@ -70,6 +70,7 @@
'SDKROOT': sdkroot.strip(),
'ARCH': arch,
'ARCH_CFLAGS': '-target {} {}'.format(triple, version_min),
+ 'USE_SYSTEM_STDLIB': 1,
})
exe_path = os.path.realpath(self.getBuildArtifact(exe_name))
cmd = [
Index: lldb/test/API/python_api/sbmodule/TestSBModule.py
===================================================================
--- lldb/test/API/python_api/sbmodule/TestSBModule.py
+++ lldb/test/API/python_api/sbmodule/TestSBModule.py
@@ -47,8 +47,8 @@
process = target.AttachToProcessWithID(self.dbg.GetListener(),
self.background_pid, error)
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
- main_module = target.GetModuleAtIndex(0)
- self.assertEqual(main_module.GetFileSpec().GetFilename(), "a.out")
+ main_module = target.FindModule(lldb.SBFileSpec("a.out"))
+ self.assertTrue(main_module is not None)
self.assertFalse(main_module.IsFileBacked(),
"The module should not be backed by a file on disk.")
Index: lldb/test/API/macosx/macCatalyst/Makefile
===================================================================
--- lldb/test/API/macosx/macCatalyst/Makefile
+++ lldb/test/API/macosx/macCatalyst/Makefile
@@ -3,6 +3,8 @@
override TRIPLE := $(ARCH)-apple-ios13.1-macabi
CFLAGS_EXTRAS := -target $(TRIPLE)
+USE_SYSTEM_STDLIB := 1
+
# FIXME: rdar://problem/54986190
# There is a Clang driver change missing on llvm.org.
override CC=xcrun clang
Index: lldb/test/API/lang/objc/exceptions/Makefile
===================================================================
--- lldb/test/API/lang/objc/exceptions/Makefile
+++ lldb/test/API/lang/objc/exceptions/Makefile
@@ -2,7 +2,7 @@
CFLAGS_EXTRAS := -w
-
+USE_SYSTEM_STDLIB := 1
LD_EXTRAS := -framework Foundation
include Makefile.rules
Index: lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
===================================================================
--- lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
+++ lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
@@ -14,9 +14,10 @@
def test(self):
self.build()
- lldbutil.run_to_source_breakpoint(self,
- "// Set break point at this line.",
- lldb.SBFileSpec("main.cpp"))
+ (target, _, _, _) = lldbutil.run_to_source_breakpoint(
+ self,
+ "// Set break point at this line.",
+ lldb.SBFileSpec("main.cpp"))
self.runCmd("settings set target.import-std-module true")
@@ -31,6 +32,8 @@
self.expect_expr("a.begin()->a", result_type="int", result_value="3")
# FIXME: The value here isn't actually empty.
- self.expect_expr("a.front()",
- result_type=value_type,
- result_children=[ValueCheck()])
+ # FIXME: LLDB struggles with this when stdlib has debug info.
+ if not lldbutil.has_debug_info_in_libcxx(target):
+ self.expect_expr("a.front()",
+ result_type=value_type,
+ result_children=[ValueCheck()])
Index: lldb/test/API/commands/expression/fixits/TestFixIts.py
===================================================================
--- lldb/test/API/commands/expression/fixits/TestFixIts.py
+++ lldb/test/API/commands/expression/fixits/TestFixIts.py
@@ -50,7 +50,9 @@
# A successfully parsed top-level expression will yield an error
# that there is 'no value'. If a parsing error would have happened we
# would get a different error kind, so let's check the error kind here.
- self.assertEquals(value.GetError().GetCString(), "error: No value")
+ # FIXME: LLDB struggles with this when stdlib has debug info.
+ if not lldbutil.has_debug_info_in_libcxx(target):
+ self.assertEquals(value.GetError().GetCString(), "error: No value")
# Try with two errors:
two_error_expression = "my_pointer.second->a"
Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -387,6 +387,16 @@
#----------------------------------------------------------------------
# C++ standard library options
#----------------------------------------------------------------------
+ifneq ($(and $(USE_LIBSTDCPP), $(USE_LIBCPP)),)
+ $(error Libcxx and Libstdc++ cannot be used together)
+endif
+
+ifeq (1, $(USE_SYSTEM_STDLIB))
+ ifneq ($(or $(USE_LIBSTDCPP), $(USE_LIBCPP)),)
+ $(error Cannot use system's library and a custom library together)
+ endif
+endif
+
ifeq (1,$(USE_LIBSTDCPP))
# Clang requires an extra flag: -stdlib=libstdc++
ifneq (,$(findstring clang,$(CC)))
@@ -415,6 +425,15 @@
endif
endif
+# If no explicit request was made, but we have paths to a custom libcxx, use
+# them.
+ifeq ($(or $(USE_LIBSTDCPP), $(USE_LIBCPP), $(USE_SYSTEM_STDLIB)),)
+ ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
+ CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(LIBCPP_INCLUDE_DIR)
+ LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
+ endif
+endif
+
#----------------------------------------------------------------------
# Additional system libraries
#----------------------------------------------------------------------
Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -1620,3 +1620,11 @@
expect_dylib_info_response = True
return dylib_info
+
+# ======================================================
+# Utility functions to query standard library properties
+# ======================================================
+
+def has_debug_info_in_libcxx(target):
+ contexts = target.FindFunctions("__cxa_throw")
+ return any(context.GetCompileUnit().IsValid() for context in contexts)
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits