-
-
import gdbremote_testcase
import lldbgdbserverutils
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
class TestGdbRemoteAttach(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- def attach_with_vAttach(self):
+ def test_attach_with_vAttach(self):
+ self.build()
+ self.set_inferior_startup_attach_manually()
+
# Start the inferior, start the debug monitor, nothing is attached yet.
procs = self.prep_debug_monitor_and_inferior(
inferior_args=["sleep:60"])
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.build()
- self.set_inferior_startup_attach_manually()
- self.attach_with_vAttach()
-
- @llgs_test
- def test_attach_with_vAttach_llgs(self):
- self.build()
- self.set_inferior_startup_attach_manually()
- self.attach_with_vAttach()
def generate_hex_path(self, target):
return str(os.path.join(self.getBuildDir(), target)).encode().hex()
- @llgs_test
+ @add_test_categories(["llgs"])
def test_autocomplete_path(self):
self.build()
self.init_lldb_server()
self.assertTrue(reg_info["lldb_register_index"] in expedited_registers)
self.trace("{} reg_info:{}".format(generic_register_name, reg_info))
- def stop_notification_contains_aarch64_vg_register(self):
- # Generate a stop reply, parse out expedited registers from stop
- # notification.
- expedited_registers = self.gather_expedited_registers()
- self.assertIsNotNone(expedited_registers)
- self.assertTrue(len(expedited_registers) > 0)
-
- # Gather target register infos.
- reg_infos = self.gather_register_infos()
-
- # Find the vg register.
- reg_info = self.find_register_with_name_and_dwarf_regnum(
- reg_infos, 'vg', '46')
- self.assertIsNotNone(reg_info)
-
- # Ensure the expedited registers contained it.
- self.assertTrue(reg_info["lldb_register_index"] in expedited_registers)
- self.trace("{} reg_info:{}".format('vg', reg_info))
+ def test_stop_notification_contains_any_registers(self):
+ self.build()
+ self.set_inferior_startup_launch()
- def stop_notification_contains_any_registers(self):
# Generate a stop reply, parse out expedited registers from stop
# notification.
expedited_registers = self.gather_expedited_registers()
# Verify we have at least one expedited register.
self.assertTrue(len(expedited_registers) > 0)
- @debugserver_test
- def test_stop_notification_contains_any_registers_debugserver(self):
- self.build()
- self.set_inferior_startup_launch()
- self.stop_notification_contains_any_registers()
- @llgs_test
- def test_stop_notification_contains_any_registers_llgs(self):
+ def test_stop_notification_contains_no_duplicate_registers(self):
self.build()
self.set_inferior_startup_launch()
- self.stop_notification_contains_any_registers()
- def stop_notification_contains_no_duplicate_registers(self):
# Generate a stop reply, parse out expedited registers from stop
# notification.
expedited_registers = self.gather_expedited_registers()
"expedited register number {} specified more than once ({} times)".format(
reg_num, len(value)))
- @debugserver_test
- def test_stop_notification_contains_no_duplicate_registers_debugserver(
- self):
- self.build()
- self.set_inferior_startup_launch()
- self.stop_notification_contains_no_duplicate_registers()
-
- @llgs_test
- def test_stop_notification_contains_no_duplicate_registers_llgs(self):
+ def test_stop_notification_contains_pc_register(self):
self.build()
self.set_inferior_startup_launch()
- self.stop_notification_contains_no_duplicate_registers()
-
- def stop_notification_contains_pc_register(self):
self.stop_notification_contains_generic_register("pc")
- @debugserver_test
- def test_stop_notification_contains_pc_register_debugserver(self):
+ @skipIf(triple='^powerpc64') # powerpc64 has no FP register
+ def test_stop_notification_contains_fp_register(self):
self.build()
self.set_inferior_startup_launch()
- self.stop_notification_contains_pc_register()
-
- @llgs_test
- def test_stop_notification_contains_pc_register_llgs(self):
- self.build()
- self.set_inferior_startup_launch()
- self.stop_notification_contains_pc_register()
-
- # powerpc64 has no FP register
- @skipIf(triple='^powerpc64')
- def stop_notification_contains_fp_register(self):
self.stop_notification_contains_generic_register("fp")
- @debugserver_test
- def test_stop_notification_contains_fp_register_debugserver(self):
+ def test_stop_notification_contains_sp_register(self):
self.build()
self.set_inferior_startup_launch()
- self.stop_notification_contains_fp_register()
-
- @llgs_test
- def test_stop_notification_contains_fp_register_llgs(self):
- self.build()
- self.set_inferior_startup_launch()
- self.stop_notification_contains_fp_register()
-
- def stop_notification_contains_sp_register(self):
self.stop_notification_contains_generic_register("sp")
- @debugserver_test
- def test_stop_notification_contains_sp_register_debugserver(self):
- self.build()
- self.set_inferior_startup_launch()
- self.stop_notification_contains_sp_register()
-
- @llgs_test
- def test_stop_notification_contains_sp_register_llgs(self):
- self.build()
- self.set_inferior_startup_launch()
- self.stop_notification_contains_sp_register()
-
- @llgs_test
@skipIf(archs=no_match(["aarch64"]))
@skipIf(oslist=no_match(['linux']))
- def test_stop_notification_contains_vg_register_llgs(self):
+ def test_stop_notification_contains_vg_register(self):
if not self.isAArch64SVE():
self.skipTest('SVE registers must be supported.')
self.build()
self.set_inferior_startup_launch()
- self.stop_notification_contains_aarch64_vg_register()
+
+ # Generate a stop reply, parse out expedited registers from stop
+ # notification.
+ expedited_registers = self.gather_expedited_registers()
+ self.assertIsNotNone(expedited_registers)
+ self.assertTrue(len(expedited_registers) > 0)
+
+ # Gather target register infos.
+ reg_infos = self.gather_register_infos()
+
+ # Find the vg register.
+ reg_info = self.find_register_with_name_and_dwarf_regnum(
+ reg_infos, 'vg', '46')
+ self.assertIsNotNone(reg_info)
+
+ # Ensure the expedited registers contained it.
+ self.assertTrue(reg_info["lldb_register_index"] in expedited_registers)
+ self.trace("{} reg_info:{}".format('vg', reg_info))
"qHostInfo is missing the following required "
"keys: " + str(missing_keys))
- @debugserver_test
- def test_qHostInfo_returns_at_least_one_key_val_pair_debugserver(self):
+ def test_qHostInfo_returns_at_least_one_key_val_pair(self):
self.build()
self.get_qHostInfo_response()
- @llgs_test
- def test_qHostInfo_returns_at_least_one_key_val_pair_llgs(self):
- self.build()
- self.get_qHostInfo_response()
-
- @skipUnlessDarwin
- @debugserver_test
- def test_qHostInfo_contains_darwin_required_keys_debugserver(self):
- self.build()
- host_info_dict = self.get_qHostInfo_response()
- self.validate_darwin_minimum_host_info_keys(host_info_dict)
-
@skipUnlessDarwin
- @llgs_test
- def test_qHostInfo_contains_darwin_required_keys_llgs(self):
+ def test_qHostInfo_contains_darwin_required_keys(self):
self.build()
host_info_dict = self.get_qHostInfo_response()
self.validate_darwin_minimum_host_info_keys(host_info_dict)
-
-
-
import unittest2
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
return (stop_replies, thread_dicts)
- def qThreadStopInfo_works_for_multiple_threads(self, thread_count):
- (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
+ @skipIfNetBSD
+ def test_qThreadStopInfo_works_for_multiple_threads(self):
+ self.build()
+ self.set_inferior_startup_launch()
+ (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(self.THREAD_COUNT)
triple = self.dbg.GetSelectedPlatform().GetTriple()
# Consider one more thread created by calling DebugBreakProcess.
if re.match(".*-.*-windows", triple):
- self.assertGreaterEqual(len(stop_replies), thread_count)
+ self.assertGreaterEqual(len(stop_replies), self.THREAD_COUNT)
else:
- self.assertEqual(len(stop_replies), thread_count)
+ self.assertEqual(len(stop_replies), self.THREAD_COUNT)
- @debugserver_test
- def test_qThreadStopInfo_works_for_multiple_threads_debugserver(self):
- self.build()
- self.set_inferior_startup_launch()
- self.qThreadStopInfo_works_for_multiple_threads(self.THREAD_COUNT)
-
- @llgs_test
- @skipIfNetBSD
- def test_qThreadStopInfo_works_for_multiple_threads_llgs(self):
+ @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr48418")
+ @expectedFailureNetBSD
+ def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self):
self.build()
self.set_inferior_startup_launch()
- self.qThreadStopInfo_works_for_multiple_threads(self.THREAD_COUNT)
- def qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
- self, thread_count):
- (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
+ (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(self.THREAD_COUNT)
self.assertIsNotNone(stop_replies)
no_stop_reason_count = sum(
# Consider one more thread created by calling DebugBreakProcess.
if re.match(".*-.*-windows", triple):
- self.assertGreaterEqual(no_stop_reason_count, thread_count - 1)
+ self.assertGreaterEqual(no_stop_reason_count, self.THREAD_COUNT - 1)
else:
- self.assertEqual(no_stop_reason_count, thread_count - 1)
+ self.assertEqual(no_stop_reason_count, self.THREAD_COUNT - 1)
# Only one thread should should indicate a stop reason.
self.assertEqual(with_stop_reason_count, 1)
-
- @debugserver_test
- def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_debugserver(
- self):
- self.build()
- self.set_inferior_startup_launch()
- self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
- self.THREAD_COUNT)
-
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr48418")
- @expectedFailureNetBSD
- @llgs_test
- def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_llgs(
- self):
- self.build()
- self.set_inferior_startup_launch()
- self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
- self.THREAD_COUNT)
-
- def qThreadStopInfo_has_valid_thread_names(
- self, thread_count, expected_thread_name):
- (_, thread_dicts) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
- self.assertIsNotNone(thread_dicts)
-
- for thread_dict in list(thread_dicts.values()):
- name = thread_dict.get("name")
- self.assertIsNotNone(name)
- self.assertEqual(name, expected_thread_name)
-
- @unittest2.skip("MacOSX doesn't have a default thread name")
- @debugserver_test
- def test_qThreadStopInfo_has_valid_thread_names_debugserver(self):
- self.build()
- self.set_inferior_startup_launch()
- self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out")
-
- # test requires OS with set, equal thread names by default.
- # Windows thread does not have name property, equal names as the process's by default.
- @skipUnlessPlatform(["linux", "windows"])
- @llgs_test
- def test_qThreadStopInfo_has_valid_thread_names_llgs(self):
- self.build()
- self.set_inferior_startup_launch()
- self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out")
mydir = TestBase.compute_mydir(__file__)
- @debugserver_test
- def test_reverse_connect_debugserver(self):
- self._reverse_connect()
-
- @llgs_test
@skipIfRemote # reverse connect is not a supported use case for now
def test_reverse_connect_llgs(self):
- self._reverse_connect()
-
- def _reverse_connect(self):
# Reverse connect is the default connection method.
self.connect_to_debug_monitor()
# Verify we can do the handshake. If that works, we'll call it good.
self.do_handshake(self.sock)
- @debugserver_test
- @skipIfRemote
- def test_named_pipe_debugserver(self):
- self._named_pipe()
-
- @llgs_test
@skipIfRemote
@skipIfWindows
def test_named_pipe_llgs(self):
- self._named_pipe()
-
- def _named_pipe(self):
family, type, proto, _, addr = socket.getaddrinfo(
self.stub_hostname, 0, proto=socket.IPPROTO_TCP)[0]
self.sock = socket.socket(family, type, proto)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
- @llgs_test
@skipUnlessPlatform(["linux", "android"])
def test_q_pass_signals(self):
self.build()
self.expect_signal(signo)
self.expect_exit_code(len(signals_to_ignore))
- @llgs_test
@skipUnlessPlatform(["linux", "android"])
def test_change_signals_at_runtime(self):
self.build()
@skipIfWindows # no signal support
@expectedFailureNetBSD
- @llgs_test
def test_default_signals_behavior(self):
self.build()
self.set_inferior_startup_launch()
self.expect_exit_code(0)
- @llgs_test
@skipUnlessPlatform(["linux", "android"])
def test_support_q_pass_signals(self):
self.build()