summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
committerZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
commitc432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (patch)
tree4efa528e074a6e2df782345e4cd97f5d85d038c4 /lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
parenta8a3bd210086b50242903ed95048fe5e53897878 (diff)
downloadbcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.tar.gz
bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.zip
Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code structured into a bona-fide Python package. This has a number of benefits, but most notably the ability to more easily share Python code between different but related pieces of LLDB's Python infrastructure (for example, `scripts` can now share code with `test`). llvm-svn: 251532
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
new file mode 100644
index 00000000000..9667c76609a
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
@@ -0,0 +1,60 @@
+from __future__ import print_function
+
+import use_lldb_suite
+
+import gdbremote_testcase
+import lldbgdbserverutils
+
+from lldbtest import *
+
+class TestGdbRemoteAttach(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def attach_with_vAttach(self):
+ # Start the inferior, start the debug monitor, nothing is attached yet.
+ procs = self.prep_debug_monitor_and_inferior(inferior_args=["sleep:60"])
+ self.assertIsNotNone(procs)
+
+ # Make sure the target process has been launched.
+ inferior = procs.get("inferior")
+ self.assertIsNotNone(inferior)
+ self.assertTrue(inferior.pid > 0)
+ self.assertTrue(lldbgdbserverutils.process_is_running(inferior.pid, True))
+
+ # Add attach packets.
+ self.test_sequence.add_log_lines([
+ # Do the attach.
+ "read packet: $vAttach;{:x}#00".format(inferior.pid),
+ # Expect a stop notification from the attach.
+ { "direction":"send", "regex":r"^\$T([0-9a-fA-F]{2})[^#]*#[0-9a-fA-F]{2}$", "capture":{1:"stop_signal_hex"} },
+ ], True)
+ self.add_process_info_collection_packets()
+
+ # Run the stream
+ context = self.expect_gdbremote_sequence()
+ self.assertIsNotNone(context)
+
+ # Gather process info response
+ process_info = self.parse_process_info_response(context)
+ self.assertIsNotNone(process_info)
+
+ # Ensure the process id matches what we expected.
+ pid_text = process_info.get('pid', None)
+ self.assertIsNotNone(pid_text)
+ reported_pid = int(pid_text, base=16)
+ self.assertEqual(reported_pid, inferior.pid)
+
+ @debugserver_test
+ def test_attach_with_vAttach_debugserver(self):
+ self.init_debugserver_test()
+ self.build()
+ self.set_inferior_startup_attach_manually()
+ self.attach_with_vAttach()
+
+ @llgs_test
+ def test_attach_with_vAttach_llgs(self):
+ self.init_llgs_test()
+ self.build()
+ self.set_inferior_startup_attach_manually()
+ self.attach_with_vAttach()
OpenPOWER on IntegriCloud