fdeazeve created this revision. fdeazeve added a reviewer: aprantl. Herald added a project: All. fdeazeve requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
When running LLDB tests with a separately built copy of libcxx, it may be necessary to also use the `nostdinc++` and `cxx-isystem` flags, so that Clang doesn't keep multiple paths to the standard library in its include search list. This is particularly important when also running LLDB tests using older versions of clang, which may not deal with multiple standard libraries properly. These issues have all been seen in the LLDB matrix green dragon bot, which ensures that tip-of-trunk LLDBs can debug code compiled with older versions of Clang/libcxx. Once this is merged, llvm-zorg can be updated to use the flags. Local testing has been done by compiling the project with: `-DLLDB_TEST_USER_ARGS="--custom-libcpp=<invalid_path>` We verified that all LLDB tests failed to find standard library files. Then we fixed the invalid path to point to a proper libcxx, and the tests passed. A similar effect could have been accomplished by repurposing either CXXFLAGS or CXXFLAGS_EXTRAS, but these are already for many different purposes, so we choose to isolate the new behavior into a new environment variable. We also choose to keep the logic of formatting the flags inside the Makefile, as that's where we can check which compiler is being used, as it is already done in other places there. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D132257 Files: lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/dotest_args.py lldb/packages/Python/lldbsuite/test/make/Makefile.rules 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 @@ -402,6 +402,14 @@ endif endif +ifdef CUSTOM_LIBCPP + ifeq (,$(findstring clang,$(CC))) + $(error "CUSTOM_LIBCPP only supported for Clang compilers") + endif + + CXXFLAGS += -nostdinc++ -cxx-isystem $(CUSTOM_LIBCPP) +endif + #---------------------------------------------------------------------- # Additional system libraries #---------------------------------------------------------------------- Index: lldb/packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest_args.py +++ lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -172,6 +172,11 @@ type=str, metavar='A plugin whose tests will be enabled', help='A plugin whose tests will be enabled. The only currently supported plugin is intel-pt.') + group.add_argument( + '--custom-libcpp', + metavar='custom-libcpp', + dest='custom_libcpp', + help='(Clang only) Specify path to a custom standard library to use. Disables search for other standard C++ libraries.') # Configuration options group = parser.add_argument_group('Remote platform options') Index: lldb/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -335,6 +335,9 @@ # that explicitly require no debug info. os.environ['CFLAGS'] = '-gdwarf-{}'.format(configuration.dwarf_version) + if args.custom_libcpp: + os.environ['CUSTOM_LIBCPP'] = args.custom_libcpp + if args.settings: for setting in args.settings: if not len(setting) == 1 or not setting[0].count('='):
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 @@ -402,6 +402,14 @@ endif endif +ifdef CUSTOM_LIBCPP + ifeq (,$(findstring clang,$(CC))) + $(error "CUSTOM_LIBCPP only supported for Clang compilers") + endif + + CXXFLAGS += -nostdinc++ -cxx-isystem $(CUSTOM_LIBCPP) +endif + #---------------------------------------------------------------------- # Additional system libraries #---------------------------------------------------------------------- Index: lldb/packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest_args.py +++ lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -172,6 +172,11 @@ type=str, metavar='A plugin whose tests will be enabled', help='A plugin whose tests will be enabled. The only currently supported plugin is intel-pt.') + group.add_argument( + '--custom-libcpp', + metavar='custom-libcpp', + dest='custom_libcpp', + help='(Clang only) Specify path to a custom standard library to use. Disables search for other standard C++ libraries.') # Configuration options group = parser.add_argument_group('Remote platform options') Index: lldb/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -335,6 +335,9 @@ # that explicitly require no debug info. os.environ['CFLAGS'] = '-gdwarf-{}'.format(configuration.dwarf_version) + if args.custom_libcpp: + os.environ['CUSTOM_LIBCPP'] = args.custom_libcpp + if args.settings: for setting in args.settings: if not len(setting) == 1 or not setting[0].count('='):
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits