Author: Vedant Kumar Date: 2020-01-10T14:52:51-08:00 New Revision: 4c00dbf22d7f0ad005444b412b450ee4b4779b6a
URL: https://github.com/llvm/llvm-project/commit/4c00dbf22d7f0ad005444b412b450ee4b4779b6a DIFF: https://github.com/llvm/llvm-project/commit/4c00dbf22d7f0ad005444b412b450ee4b4779b6a.diff LOG: lldbutil: Forward ASan launch info to test inferiors This allows an unsanitized test process which loads a sanitized DSO (the motivating example is a Swift runtime dylib) to launch on Darwin. rdar://57290132 Differential Revision: https://reviews.llvm.org/D71379 Added: Modified: lldb/packages/Python/lldbsuite/test/lldbutil.py lldb/test/API/lit.cfg.py Removed: ################################################################################ diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 9deaed5cf50d..006362a4479c 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -19,6 +19,7 @@ # LLDB modules import lldb +from . import lldbtest_config # =================================================== @@ -758,6 +759,12 @@ def run_to_breakpoint_make_target(test, exe_name = "a.out", in_cwd = True): # Create the target target = test.dbg.CreateTarget(exe) test.assertTrue(target, "Target: %s is not valid."%(exe_name)) + + # Set environment variables for the inferior. + if lldbtest_config.inferior_env: + test.runCmd('settings set target.env-vars {}'.format( + lldbtest_config.inferior_env)) + return target def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None, @@ -765,7 +772,7 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None, # Launch the process, and do not stop at the entry point. if not launch_info: - launch_info = lldb.SBLaunchInfo(None) + launch_info = target.GetLaunchInfo() launch_info.SetWorkingDirectory(test.get_process_working_directory()) if extra_images and lldb.remote_platform: diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index aca13b9c64f8..631a8a4a33b8 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -87,6 +87,12 @@ def find_shlibpath_var(): if config.llvm_libs_dir: dotest_cmd += ['--env', 'LLVM_LIBS_DIR=' + config.llvm_libs_dir] +# Forward ASan-specific environment variables to tests, as a test may load an +# ASan-ified dylib. +for env_var in ('ASAN_OPTIONS', 'DYLD_INSERT_LIBRARIES'): + if env_var in config.environment: + dotest_cmd += ['--inferior-env', env_var + '=' + config.environment[env_var]] + if config.lldb_build_directory: dotest_cmd += ['--build-dir', config.lldb_build_directory] _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits