Index: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py =================================================================== --- lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py +++ lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py @@ -15,7 +15,7 @@ def setUp(self): """ - Note that lldbExec can be specified with the LLDB_EXEC env variable (see + Note that lldbtest_config.lldbExec can be specified with the LLDB_EXEC env variable (see dotest.py), and gdbExec can be specified with the GDB_EXEC env variable. This provides a flexibility in specifying different versions of gdb for comparison purposes. @@ -28,7 +28,7 @@ else: self.gdbExec = "gdb" - self.exe = self.lldbHere + self.exe = lldbtest_config.lldbExec self.function = 'Driver::MainLoop()' self.lldb_avg = None self.gdb_avg = None @@ -41,7 +41,7 @@ def test_run_lldb_then_gdb(self): """Test disassembly on a large function with lldb vs. gdb.""" print - print "lldb path: %s" % self.lldbExec + print "lldb path: %s" % lldbtest_config.lldbExec print "gdb path: %s" % self.gdbExec print @@ -56,7 +56,7 @@ def test_run_gdb_then_lldb(self): """Test disassembly on a large function with lldb vs. gdb.""" print - print "lldb path: %s" % self.lldbExec + print "lldb path: %s" % lldbtest_config.lldbExec print "gdb path: %s" % self.gdbExec print @@ -73,7 +73,7 @@ prompt = self.child_prompt # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbExec, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. Index: lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py =================================================================== --- lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py +++ lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py @@ -16,7 +16,7 @@ if lldb.bmExecutable: self.exe = lldb.bmExecutable else: - self.exe = self.lldbHere + self.exe = lldbtest_config.lldbExec self.count = lldb.bmIterationCount if self.count <= 0: self.count = 10 Index: lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py =================================================================== --- lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py +++ lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py @@ -13,7 +13,7 @@ BenchBase.setUp(self) self.gdb_41_exe = '/Xcode41/usr/bin/gdb' self.gdb_42_exe = '/Developer/usr/bin/gdb' - self.exe = self.lldbHere + self.exe = lldbtest_config.lldbExec self.function = 'Driver::MainLoop()' self.gdb_41_avg = None self.gdb_42_avg = None Index: lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py =================================================================== --- lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py +++ lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py @@ -40,7 +40,7 @@ self.stopwatch.reset() for i in range(count): # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. Index: lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py =================================================================== --- lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py +++ lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py @@ -42,7 +42,7 @@ prompt = self.child_prompt # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbExec, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. Index: lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py =================================================================== --- lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py +++ lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py @@ -14,7 +14,7 @@ if lldb.bmExecutable: self.exe = lldb.bmExecutable else: - self.exe = self.lldbHere + self.exe = lldbtest_config.lldbExec if lldb.bmBreakpointSpec: self.break_spec = lldb.bmBreakpointSpec else: @@ -42,7 +42,7 @@ self.stopwatch.reset() for i in range(count): # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. Index: lldb/trunk/test/benchmarks/startup/TestStartupDelays.py =================================================================== --- lldb/trunk/test/benchmarks/startup/TestStartupDelays.py +++ lldb/trunk/test/benchmarks/startup/TestStartupDelays.py @@ -19,7 +19,7 @@ if lldb.bmExecutable: self.exe = lldb.bmExecutable else: - self.exe = self.lldbHere + self.exe = lldbtest_config.lldbExec if lldb.bmBreakpointSpec: self.break_spec = lldb.bmBreakpointSpec else: @@ -50,7 +50,7 @@ self.stopwatch2.reset() for i in range(count): # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption)) + self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption)) child = self.child # Turn on logging for what the child sends back. Index: lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py =================================================================== --- lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py +++ lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py @@ -29,7 +29,7 @@ self.child_prompt = '(lldb) ' prompt = self.child_prompt - self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption)) + self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption)) self.child.expect_exact(prompt) # So that the child gets torn down after the test. child = self.child Index: lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py =================================================================== --- lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py +++ lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py @@ -14,7 +14,7 @@ if lldb.bmExecutable: self.exe = lldb.bmExecutable else: - self.exe = self.lldbHere + self.exe = lldbtest_config.lldbExec if lldb.bmBreakpointSpec: self.break_spec = lldb.bmBreakpointSpec else: @@ -42,7 +42,7 @@ prompt = self.child_prompt # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. Index: lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py =================================================================== --- lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py +++ lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py @@ -11,7 +11,7 @@ def setUp(self): BenchBase.setUp(self) - self.exe = self.lldbHere + self.exe = lldbtest_config.lldbExec self.function = 'Driver::MainLoop()' self.count = lldb.bmIterationCount @@ -38,7 +38,7 @@ prompt = self.child_prompt # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbExec, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. Index: lldb/trunk/test/dotest.py =================================================================== --- lldb/trunk/test/dotest.py +++ lldb/trunk/test/dotest.py @@ -148,9 +148,6 @@ # The path to LLDB.framework is optional. lldbFrameworkPath = None -# The path to lldb is optional -lldbExecutablePath = None - # The config file is optional. configFile = None @@ -482,7 +479,6 @@ global useCategories global skipCategories global lldbFrameworkPath - global lldbExecutablePath global configFile global archs global compilers @@ -755,7 +751,7 @@ lldbFrameworkPath = args.framework if args.executable: - lldbExecutablePath = args.executable + lldbtest_config.lldbExec = args.executable if args.libcxx: os.environ["LIBCXX_PATH"] = args.libcxx @@ -946,7 +942,6 @@ global svn_info global svn_silent global lldbFrameworkPath - global lldbExecutablePath # Get the directory containing the current script. if "DOTEST_PROFILE" in os.environ and "DOTEST_SCRIPT_DIR" in os.environ: @@ -1005,23 +1000,18 @@ # Some of the tests can invoke the 'lldb' command directly. # We'll try to locate the appropriate executable right here. - lldbExec = None lldbMiExec = None - lldbHere = None - if lldbExecutablePath: - if is_exe(lldbExecutablePath): - lldbExec = lldbExecutablePath - lldbHere = lldbExec - else: - print lldbExecutablePath + " is not an executable, lldb tests will fail." - else: + + # The lldb executable can be set from the command line + # if it's not set, we try to find it now + # first, we try the environment + if not lldbtest_config.lldbExec: # First, you can define an environment variable LLDB_EXEC specifying the # full pathname of the lldb executable. - if "LLDB_EXEC" in os.environ and is_exe(os.environ["LLDB_EXEC"]): - lldbExec = os.environ["LLDB_EXEC"] - else: - lldbExec = None - + if "LLDB_EXEC" in os.environ: + lldbtest_config.lldbExec = os.environ["LLDB_EXEC"] + + if not lldbtest_config.lldbExec: executable = ['lldb'] dbgExec = os.path.join(base, *(xcode3_build_dir + dbg + executable)) dbgExec2 = os.path.join(base, *(xcode4_build_dir + dbg + executable)) @@ -1034,54 +1024,50 @@ # The 'lldb' executable built here in the source tree. if is_exe(dbgExec): - lldbHere = dbgExec + lldbtest_config.lldbExec = dbgExec elif is_exe(dbgExec2): - lldbHere = dbgExec2 + lldbtest_config.lldbExec = dbgExec2 elif is_exe(dbcExec): - lldbHere = dbcExec + lldbtest_config.lldbExec = dbcExec elif is_exe(dbcExec2): - lldbHere = dbcExec2 + lldbtest_config.lldbExec = dbcExec2 elif is_exe(relExec): - lldbHere = relExec + lldbtest_config.lldbExec = relExec elif is_exe(relExec2): - lldbHere = relExec2 + lldbtest_config.lldbExec = relExec2 elif is_exe(baiExec): - lldbHere = baiExec + lldbtest_config.lldbExec = baiExec elif is_exe(baiExec2): - lldbHere = baiExec2 - elif lldbExec: - lldbHere = lldbExec - - # One last chance to locate the 'lldb' executable. - if not lldbExec: - lldbExec = which('lldb') - if lldbHere and not lldbExec: - lldbExec = lldbHere - if lldbExec and not lldbHere: - lldbHere = lldbExec - - if lldbHere: - os.environ["LLDB_HERE"] = lldbHere - lldbLibDir = os.path.split(lldbHere)[0] # confusingly, this is the "bin" directory - os.environ["LLDB_LIB_DIR"] = lldbLibDir - lldbImpLibDir = os.path.join(lldbLibDir, '..', 'lib') if sys.platform.startswith('win32') else lldbLibDir - os.environ["LLDB_IMPLIB_DIR"] = lldbImpLibDir - if not noHeaders: - print "LLDB library dir:", os.environ["LLDB_LIB_DIR"] - print "LLDB import library dir:", os.environ["LLDB_IMPLIB_DIR"] - os.system('%s -v' % lldbHere) + lldbtest_config.lldbExec = baiExec2 + elif lldbtest_config.lldbExec: + lldbtest_config.lldbExec = lldbtest_config.lldbExec + + if not lldbtest_config.lldbExec: + # Last, check the path + lldbtest_config.lldbExec = which('lldb') + + if lldbtest_config.lldbExec and not is_exe(lldbtest_config.lldbExec): + print "'{}' is not a path to a valid executable" + del lldbtest_config.lldbExec - if not lldbExec: + if not lldbtest_config.lldbExec: print "The 'lldb' executable cannot be located. Some of the tests may not be run as a result." - else: - os.environ["LLDB_EXEC"] = lldbExec - #print "The 'lldb' from PATH env variable", lldbExec + sys.exit(-1) + + lldbLibDir = os.path.dirname(lldbtest_config.lldbExec) # confusingly, this is the "bin" directory + os.environ["LLDB_LIB_DIR"] = lldbLibDir + lldbImpLibDir = os.path.join(lldbLibDir, '..', 'lib') if sys.platform.startswith('win32') else lldbLibDir + os.environ["LLDB_IMPLIB_DIR"] = lldbImpLibDir + if not noHeaders: + print "LLDB library dir:", os.environ["LLDB_LIB_DIR"] + print "LLDB import library dir:", os.environ["LLDB_IMPLIB_DIR"] + os.system('%s -v' % lldbtest_config.lldbExec) # Assume lldb-mi is in same place as lldb # If not found, disable the lldb-mi tests global dont_do_lldbmi_test - if lldbExec and is_exe(lldbExec + "-mi"): - lldbMiExec = lldbExec + "-mi" + if lldbtest_config.lldbExec and is_exe(lldbtest_config.lldbExec + "-mi"): + lldbMiExec = lldbtest_config.lldbExec + "-mi" if not lldbMiExec: dont_do_lldbmi_test = True if just_do_lldbmi_test: @@ -1119,11 +1105,8 @@ # If our lldb supports the -P option, use it to find the python path: init_in_python_dir = os.path.join('lldb', '__init__.py') - lldb_dash_p_result = None - lldbExecutable = lldbHere if lldbHere else lldbExec - if lldbExecutable: - lldb_dash_p_result = subprocess.check_output([lldbExecutable, "-P"], stderr=subprocess.STDOUT) + lldb_dash_p_result = subprocess.check_output([lldbtest_config.lldbExec, "-P"], stderr=subprocess.STDOUT) if lldb_dash_p_result and not lldb_dash_p_result.startswith(("<", "lldb: invalid option:")) \ and not lldb_dash_p_result.startswith("Traceback"): Index: lldb/trunk/test/driver/batch_mode/TestBatchMode.py =================================================================== --- lldb/trunk/test/driver/batch_mode/TestBatchMode.py +++ lldb/trunk/test/driver/batch_mode/TestBatchMode.py @@ -55,7 +55,7 @@ # First time through, pass CRASH so the process will crash and stop in batch mode. run_commands = ' -b -o "break set -n main" -o "run" -o "continue" -k "frame var touch_me_not"' - self.child = pexpect.spawn('%s %s %s %s -- CRASH' % (self.lldbHere, self.lldbOption, run_commands, exe)) + self.child = pexpect.spawn('%s %s %s %s -- CRASH' % (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe)) child = self.child # Turn on logging for what the child sends back. if self.TraceOn(): @@ -78,7 +78,7 @@ # Now do it again, and see make sure if we don't crash, we quit: run_commands = ' -b -o "break set -n main" -o "run" -o "continue" ' - self.child = pexpect.spawn('%s %s %s %s -- NOCRASH' % (self.lldbHere, self.lldbOption, run_commands, exe)) + self.child = pexpect.spawn('%s %s %s %s -- NOCRASH' % (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe)) child = self.child # Turn on logging for what the child sends back. if self.TraceOn(): Index: lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py =================================================================== --- lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py +++ lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py @@ -20,7 +20,7 @@ regex_prompt = "Enter one of more sed substitution commands in the form: 's///'.\r\nTerminate the substitution list with an empty line.\r\n" regex_prompt1 = "\r\n" - child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption)) + child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption)) # Turn on logging for what the child sends back. if self.TraceOn(): child.logfile_read = sys.stdout Index: lldb/trunk/test/functionalities/completion/TestCompletion.py =================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py +++ lldb/trunk/test/functionalities/completion/TestCompletion.py @@ -236,7 +236,7 @@ prompt = "(lldb) " # So that the child gets torn down after the test. - self.child = pexpect.spawn(self.lldbHere, + self.child = pexpect.spawn(lldbtest_config.lldbExec, [self.lldbOption] + ['--no-use-colors']) child = self.child # Turn on logging for input/output to/from the child. Index: lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py =================================================================== --- lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py +++ lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py @@ -41,7 +41,7 @@ python_prompt = ">>> " # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. if self.TraceOn(): Index: lldb/trunk/test/functionalities/format/TestFormats.py =================================================================== --- lldb/trunk/test/functionalities/format/TestFormats.py +++ lldb/trunk/test/functionalities/format/TestFormats.py @@ -18,7 +18,7 @@ self.buildDwarf () import pexpect prompt = "(lldb) " - child = pexpect.spawn('%s %s -x -o "b main" -o r a.out' % (self.lldbHere, self.lldbOption)) + child = pexpect.spawn('%s %s -x -o "b main" -o r a.out' % (lldbtest_config.lldbExec, self.lldbOption)) # Turn on logging for what the child sends back. if self.TraceOn(): child.logfile_read = sys.stdout Index: lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py =================================================================== --- lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py +++ lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py @@ -34,7 +34,7 @@ prompt = "(lldb) " # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s "%s"' % (self.lldbHere, self.lldbOption, self.myexe)) + self.child = pexpect.spawn('%s %s "%s"' % (lldbtest_config.lldbExec, self.lldbOption, self.myexe)) child = self.child child.setecho(True) # Turn on logging for input/output to/from the child. Index: lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py =================================================================== --- lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py +++ lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py @@ -45,7 +45,7 @@ add_prompt1 = "> " # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. if self.TraceOn(): Index: lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py =================================================================== --- lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py +++ lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py @@ -48,7 +48,7 @@ prompt = "(lldb) " # So that the child gets torn down after the test. - self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe)) + self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe)) child = self.child # Turn on logging for what the child sends back. if self.TraceOn(): Index: lldb/trunk/test/lldbpexpect.py =================================================================== --- lldb/trunk/test/lldbpexpect.py +++ lldb/trunk/test/lldbpexpect.py @@ -19,7 +19,7 @@ def launch(self, timeout=None): if timeout is None: timeout = 30 logfile = sys.stdout if self.TraceOn() else None - self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.launchArgs()), logfile=logfile) + self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.launchArgs()), logfile=logfile) self.child.timeout = timeout self.timeout = timeout Index: lldb/trunk/test/lldbtest.py =================================================================== --- lldb/trunk/test/lldbtest.py +++ lldb/trunk/test/lldbtest.py @@ -1060,19 +1060,12 @@ else: self.libcxxPath = None - if "LLDB_EXEC" in os.environ: - self.lldbExec = os.environ["LLDB_EXEC"] - else: - self.lldbExec = None if "LLDBMI_EXEC" in os.environ: self.lldbMiExec = os.environ["LLDBMI_EXEC"] else: self.lldbMiExec = None self.dont_do_lldbmi_test = True - if "LLDB_HERE" in os.environ: - self.lldbHere = os.environ["LLDB_HERE"] - else: - self.lldbHere = None + # If we spawn an lldb process for test (via pexpect), do not load the # init file unless told otherwise. if "NO_LLDBINIT" in os.environ and "NO" == os.environ["NO_LLDBINIT"]: @@ -1564,9 +1557,9 @@ # spawn local process command = [ - self.lldbHere, + lldbtest_config.lldbExec, "-o", - "file " + self.lldbHere, + "file " + lldbtest_config.lldbExec, "-o", "quit" ] @@ -1807,7 +1800,7 @@ return path # Tries to find clang at the same folder as the lldb - path = os.path.join(os.path.dirname(self.lldbExec), "clang") + path = os.path.join(os.path.dirname(lldbtest_config.lldbExec), "clang") if os.path.exists(path): return path Index: lldb/trunk/test/lldbtest_config.py =================================================================== --- lldb/trunk/test/lldbtest_config.py +++ lldb/trunk/test/lldbtest_config.py @@ -15,3 +15,7 @@ # leave logs/traces even for successful test runs log_success = False + +# path to the lldb command line executable tool +lldbExec = None + Index: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py =================================================================== --- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py +++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py @@ -63,7 +63,7 @@ child.logfile_read = None # Invoke the lldb command. - child.sendline('%s %s' % (self.lldbHere, self.lldbOption)) + child.sendline('%s %s' % (lldbtest_config.lldbExec, self.lldbOption)) child.expect_exact(lldb_prompt) # Immediately quit. Index: lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py =================================================================== --- lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py +++ lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py @@ -34,6 +34,8 @@ returns None. """ + if not lldb_exe: + return None exe_dir = os.path.dirname(lldb_exe) exe_base = os.path.basename(lldb_exe) @@ -46,27 +48,26 @@ debug_monitor_exe = os.path.join(exe_dir, new_base) if os.path.exists(debug_monitor_exe): return debug_monitor_exe - else: - return None + + new_base = regex.sub( 'LLDB.framework/Versions/A/Resources/' + debug_monitor_basename, exe_base) + debug_monitor_exe = os.path.join(exe_dir, new_base) + if os.path.exists(debug_monitor_exe): + return debug_monitor_exe + + return None def get_lldb_server_exe(): """Return the lldb-server exe path. Returns: - A path to the lldb-gdbserver exe if it is found to exist; otherwise, + A path to the lldb-server exe if it is found to exist; otherwise, returns None. """ if "LLDB_DEBUGSERVER_PATH" in os.environ: return os.environ["LLDB_DEBUGSERVER_PATH"] - elif "LLDB_EXEC" in os.environ: - lldb_exe = os.environ["LLDB_EXEC"] - if not lldb_exe: - return None - else: - return _get_debug_monitor_from_lldb(lldb_exe, "lldb-server") - else: - return None + + return _get_debug_monitor_from_lldb(lldb_exe, "lldb-server") def get_debugserver_exe(): """Return the debugserver exe path. @@ -77,15 +78,8 @@ """ if "LLDB_DEBUGSERVER_PATH" in os.environ: return os.environ["LLDB_DEBUGSERVER_PATH"] - elif "LLDB_EXEC" in os.environ: - lldb_exe = os.environ["LLDB_EXEC"] - if not lldb_exe: - return None - else: - return _get_debug_monitor_from_lldb(lldb_exe, "debugserver") - else: - return None + return _get_debug_monitor_from_lldb(lldbtest_config.lldbExec, "debugserver") _LOG_LINE_REGEX = re.compile(r'^(lldb-server|debugserver)\s+<\s*(\d+)>' + '\s+(read|send)\s+packet:\s+(.+)$')