Changeset View
Standalone View
packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | class TestGdbRemoteThreadsInStopReply( | ||||
@skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | ||||
@debugserver_test | @debugserver_test | ||||
def test_stop_reply_reports_multiple_threads_debugserver(self): | def test_stop_reply_reports_multiple_threads_debugserver(self): | ||||
self.init_debugserver_test() | self.init_debugserver_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.stop_reply_reports_multiple_threads(5) | self.stop_reply_reports_multiple_threads(5) | ||||
# In the current implementation of llgs on Windows a response to a '\x03' packet causes the debugger | |||||
# of the native process to trigger a call to DebugBreakProcess. This will create a new thread to handle | |||||
# the exception debug event and one more stop thread will be notified to the delegate, i.e. llgs. | |||||
# Therefore, the tests below are all expected to fail on Windows. | |||||
@expectedFailureAll(oslist=["windows"]) | |||||
labath: Is this something that we consider to be a bug, or is it just how debugging is supposed to work… | |||||
You marked this as done, but it's not obvious how is this comment resolved (or indeed, if it needs to be resolved). Can you elaborate? labath: You marked this as done, but it's not obvious how is this comment resolved (or indeed, if it… | |||||
DebugBreakProcess is supposed to spawn a new thread in the debugged process and then the thread exits after the irq is handled. See below thread #1 is main thread of the debugged process and thread #2 is the newly spawned. looks like the stopped threads number is supposed to +1, but in order to be consistent with Visual Studio, To modify the python script for Windows is at some cost. Maybe just skip them? (lldb) process interrupt GDBRemoteClientBase::Lock::Lock sent packet: \x03 ... < 16> send packet: $jThreadsInfo#c1 < 354> read packet: $[{"name":"main.exe","reason":"trace","registers":{"16":"dc6b5a9af77f0000","6":"0000000000000000","7":"80fa1e8aca000000"}],"tid":23108}],{"description":"Exception 0x80000003 encountered at address 0x7ffa1701e370","name":"main.exe","reason":"exception","registers":{"16":"71e30117fa7f0000","6":"0000000000000000","7":"28fa4f8aca000000"}],"tid":23716}]]#f0 Process 27544 stopped * thread #1, name = 'main.exe', stop reason = trace frame #0: 0x00007ff79a5a6bdc main.exe`main at main.cpp:7 4 { 5 6 printf("abc"); -> 7 while(1); 8 return 1; 9 } thread #2, name = 'main.exe', stop reason = Exception 0x80000003 encountered at address 0x7ffa1701e370 frame #0: 0x00007ffa1701e371 -> 0x7ffa1701e371: retq 0x7ffa1701e372: int3 0x7ffa1701e373: int3 0x7ffa1701e374: int3 Hui: DebugBreakProcess is supposed to spawn a new thread in the debugged process and then the thread… | |||||
Ok, I see. Hiding the thread sounds like the right thing to do, though I'm not sure if it should be done at lldb-server level. My feeling is it should be done at a higher level, because lldb-server should report the thing that the OS sees, and the OS definitely sees two threads here. It may be better to hide this in the higher levels of the debugger (unless the user has requested some sort of a verbose view). If we go down that path, then I think it would be worth it to update these tests to have the correct expectation, but it does not have to happen now. We can leave them XFAILed for the time being. Thanks for explaining. labath: Ok, I see. Hiding the thread sounds like the right thing to do, though I'm not sure if it… | |||||
@llgs_test | @llgs_test | ||||
def test_stop_reply_reports_multiple_threads_llgs(self): | def test_stop_reply_reports_multiple_threads_llgs(self): | ||||
self.init_llgs_test() | self.init_llgs_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.stop_reply_reports_multiple_threads(5) | self.stop_reply_reports_multiple_threads(5) | ||||
def no_QListThreadsInStopReply_supplies_no_threads(self, thread_count): | def no_QListThreadsInStopReply_supplies_no_threads(self, thread_count): | ||||
# Gather threads from stop notification when QThreadsInStopReply is not | # Gather threads from stop notification when QThreadsInStopReply is not | ||||
# enabled. | # enabled. | ||||
stop_reply_threads = self.gather_stop_reply_threads(None, thread_count) | stop_reply_threads = self.gather_stop_reply_threads(None, thread_count) | ||||
self.assertEqual(len(stop_reply_threads), 0) | self.assertEqual(len(stop_reply_threads), 0) | ||||
@skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | ||||
@debugserver_test | @debugserver_test | ||||
def test_no_QListThreadsInStopReply_supplies_no_threads_debugserver(self): | def test_no_QListThreadsInStopReply_supplies_no_threads_debugserver(self): | ||||
self.init_debugserver_test() | self.init_debugserver_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.no_QListThreadsInStopReply_supplies_no_threads(5) | self.no_QListThreadsInStopReply_supplies_no_threads(5) | ||||
@expectedFailureAll(oslist=["windows"]) | |||||
@llgs_test | @llgs_test | ||||
def test_no_QListThreadsInStopReply_supplies_no_threads_llgs(self): | def test_no_QListThreadsInStopReply_supplies_no_threads_llgs(self): | ||||
self.init_llgs_test() | self.init_llgs_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.no_QListThreadsInStopReply_supplies_no_threads(5) | self.no_QListThreadsInStopReply_supplies_no_threads(5) | ||||
def stop_reply_reports_correct_threads(self, thread_count): | def stop_reply_reports_correct_threads(self, thread_count): | ||||
Show All 21 Lines | class TestGdbRemoteThreadsInStopReply( | ||||
@skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | ||||
@debugserver_test | @debugserver_test | ||||
def test_stop_reply_reports_correct_threads_debugserver(self): | def test_stop_reply_reports_correct_threads_debugserver(self): | ||||
self.init_debugserver_test() | self.init_debugserver_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.stop_reply_reports_correct_threads(5) | self.stop_reply_reports_correct_threads(5) | ||||
@expectedFailureAll(oslist=["windows"]) | |||||
@llgs_test | @llgs_test | ||||
def test_stop_reply_reports_correct_threads_llgs(self): | def test_stop_reply_reports_correct_threads_llgs(self): | ||||
self.init_llgs_test() | self.init_llgs_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.stop_reply_reports_correct_threads(5) | self.stop_reply_reports_correct_threads(5) | ||||
def stop_reply_contains_thread_pcs(self, thread_count): | def stop_reply_contains_thread_pcs(self, thread_count): | ||||
results = self.gather_stop_reply_pcs( | results = self.gather_stop_reply_pcs( | ||||
self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, thread_count) | self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, thread_count) | ||||
stop_reply_pcs = results["thread_pcs"] | stop_reply_pcs = results["thread_pcs"] | ||||
pc_register = results["pc_register"] | pc_register = results["pc_register"] | ||||
little_endian = results["little_endian"] | little_endian = results["little_endian"] | ||||
self.assertEqual(len(stop_reply_pcs), thread_count) | self.assertEqual(len(stop_reply_pcs), thread_count) | ||||
threads_info_pcs = self.gather_threads_info_pcs(pc_register, | threads_info_pcs = self.gather_threads_info_pcs(pc_register, | ||||
little_endian) | little_endian) | ||||
self.assertEqual(len(threads_info_pcs), thread_count) | self.assertEqual(len(threads_info_pcs), thread_count) | ||||
for thread_id in stop_reply_pcs: | for thread_id in stop_reply_pcs: | ||||
self.assertTrue(thread_id in threads_info_pcs) | self.assertTrue(thread_id in threads_info_pcs) | ||||
self.assertTrue(int(stop_reply_pcs[thread_id], 16) | self.assertTrue(int(stop_reply_pcs[thread_id], 16) | ||||
== int(threads_info_pcs[thread_id], 16)) | == int(threads_info_pcs[thread_id], 16)) | ||||
@expectedFailureAll(oslist=["windows"]) | |||||
@llgs_test | @llgs_test | ||||
def test_stop_reply_contains_thread_pcs_llgs(self): | def test_stop_reply_contains_thread_pcs_llgs(self): | ||||
self.init_llgs_test() | self.init_llgs_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.stop_reply_contains_thread_pcs(5) | self.stop_reply_contains_thread_pcs(5) | ||||
@skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | ||||
@debugserver_test | @debugserver_test | ||||
def test_stop_reply_contains_thread_pcs_debugserver(self): | def test_stop_reply_contains_thread_pcs_debugserver(self): | ||||
self.init_debugserver_test() | self.init_debugserver_test() | ||||
self.build() | self.build() | ||||
self.set_inferior_startup_launch() | self.set_inferior_startup_launch() | ||||
self.stop_reply_contains_thread_pcs(5) | self.stop_reply_contains_thread_pcs(5) |
Is this something that we consider to be a bug, or is it just how debugging is supposed to work on windows? If it's a bug then fine, but if not then we might consider adjusting the expectations in the test (or just skipping it).