OSDN Git Service

[lldb/test] Fix lldbutil.run_to_***_breakpoint for shared libraries
authorPavel Labath <pavel@labath.sk>
Tue, 7 Jul 2020 13:23:49 +0000 (15:23 +0200)
committerPavel Labath <pavel@labath.sk>
Tue, 7 Jul 2020 14:07:35 +0000 (16:07 +0200)
Even non-remote targets may need to set the launch environment
((DY)LD_LIBRARY_PATH, specifically) to run successfully.

Also, add an assertion to better detect the case when launching a target
fails and the breakpoint is never hit.

lldb/packages/Python/lldbsuite/test/lldbutil.py

index ef0df90..25fcd5f 100644 (file)
@@ -775,7 +775,7 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
         launch_info = target.GetLaunchInfo()
         launch_info.SetWorkingDirectory(test.get_process_working_directory())
 
-    if extra_images and lldb.remote_platform:
+    if extra_images:
         environ = test.registerSharedLibrariesWithTarget(target, extra_images)
         launch_info.SetEnvironmentEntries(environ, True)
 
@@ -788,6 +788,8 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
     test.assertFalse(error.Fail(),
                      "Process launch failed: %s" % (error.GetCString()))
 
+    test.assertEqual(process.GetState(), lldb.eStateStopped)
+
     # Frame #0 should be at our breakpoint.
     threads = get_threads_stopped_at_breakpoint(
                 process, bkpt)