summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/plugins/python_os_plugin
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/functionalities/plugins/python_os_plugin')
-rw-r--r--lldb/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/lldb/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
index fe0b4a21bf3..16feb5f85a2 100644
--- a/lldb/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
+++ b/lldb/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
@@ -26,6 +26,19 @@ class PluginPythonOSPlugin(TestBase):
self.buildDwarf()
self.run_python_os_funcionality()
+ @skipUnlessDarwin
+ @dsym_test
+ def test_python_os_step_dsym(self):
+ """Test that the Python operating system plugin works correctly when single stepping a virtual thread"""
+ self.buildDsym()
+ self.run_python_os_step()
+
+ @dwarf_test
+ def run_python_os_step_dwarf(self):
+ """Test that the Python operating system plugin works correctly when single stepping a virtual thread"""
+ self.buildDwarf()
+ self.run_python_os_step()
+
def verify_os_thread_registers(self, thread):
frame = thread.GetFrameAtIndex(0)
registers = frame.GetRegisters().GetValueAtIndex(0)
@@ -94,6 +107,62 @@ class PluginPythonOSPlugin(TestBase):
thread = process.GetThreadByID(0x333333333);
self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x333333333 after we unload the python OS plug-in");
+ def run_python_os_step(self):
+ """Test that the Python operating system plugin works correctly and allows single stepping of a virtual thread that is backed by a real thread"""
+
+ # Set debugger into synchronous mode
+ self.dbg.SetAsync(False)
+
+ # Create a target by the debugger.
+ cwd = os.getcwd()
+ exe = os.path.join(cwd, "a.out")
+ python_os_plugin_path = os.path.join(cwd, "operating_system2.py")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # Set breakpoints inside and outside methods that take pointers to the containing struct.
+ lldbutil.run_break_set_by_source_regexp (self, "// Set breakpoint here")
+
+ # Register our shared libraries for remote targets so they get automatically uploaded
+ arguments = None
+ environment = None
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple (arguments, environment, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # Make sure there are no OS plug-in created thread when we first stop at our breakpoint in main
+ thread = process.GetThreadByID(0x111111111);
+ self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x111111111 before we load the python OS plug-in");
+
+
+ # Now load the python OS plug-in which should update the thread list and we should have
+ # OS plug-in created threads with the IDs: 0x111111111, 0x222222222, 0x333333333
+ command = "settings set target.process.python-os-plugin-path '%s'" % python_os_plugin_path
+ self.dbg.HandleCommand(command)
+
+ # Verify our OS plug-in threads showed up
+ thread = process.GetThreadByID(0x111111111);
+ self.assertTrue (thread.IsValid(), "Make sure there is a thread 0x111111111 after we load the python OS plug-in");
+
+ frame = thread.GetFrameAtIndex(0)
+ self.assertTrue(frame.IsValid(), "Make sure we get a frame from thread 0x111111111")
+ line_entry = frame.GetLineEntry()
+
+ self.assertTrue(line_entry.GetFileSpec().GetFilename() == 'main.c', "Make sure we stopped on line 5 in main.c")
+ self.assertTrue(line_entry.GetLine() == 5, "Make sure we stopped on line 5 in main.c")
+
+ # Now single step thread 0x111111111 and make sure it does what we need it to
+ thread.StepOver()
+
+ frame = thread.GetFrameAtIndex(0)
+ self.assertTrue(frame.IsValid(), "Make sure we get a frame from thread 0x111111111")
+ line_entry = frame.GetLineEntry()
+
+ self.assertTrue(line_entry.GetFileSpec().GetFilename() == 'main.c', "Make sure we stepped from line 5 to line 6 in main.c")
+ self.assertTrue(line_entry.GetLine() == 6, "Make sure we stepped from line 5 to line 6 in main.c")
+
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
OpenPOWER on IntegriCloud