Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lldb/bindings/interface/SBThreadExtensions.i
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ STRING_EXTENSION_OUTSIDE(SBThread)
frames.append(frame)
return frames

def get_stop_description(self):
return self.GetStopDescription(1024)

def get_stop_reason_data(self):
return [
self.GetStopReasonDataAtIndex(idx)
Expand All @@ -69,6 +72,7 @@ STRING_EXTENSION_OUTSIDE(SBThread)
name = property(GetName, None, doc='''A read only property that returns the name of this thread as a string.''')
queue = property(GetQueueName, None, doc='''A read only property that returns the dispatch queue name of this thread as a string.''')
queue_id = property(GetQueueID, None, doc='''A read only property that returns the dispatch queue id of this thread as an integer.''')
stop_description = property(get_stop_description, None, doc='''A read only property that returns a string describing the reason this thread stopped.''')
stop_reason = property(GetStopReason, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eStopReason") that represents the reason this thread stopped.''')
stop_reason_data = property(get_stop_reason_data, None, doc='''A read only property that returns the stop reason data as a list.''')
is_suspended = property(IsSuspended, None, doc='''A read only property that returns a boolean value that indicates if this thread is suspended.''')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def test_step_over_read_watchpoint(self):
lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT,
)
self.assertEqual(thread.GetStopDescription(20), "watchpoint 1")
self.assertEqual(thread.stop_description, "watchpoint 1")

process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
self.assertEqual(thread.GetStopDescription(20), "step over")
self.assertEqual(thread.stop_description, "step over")

self.step_inst_for_watchpoint(1)

Expand Down Expand Up @@ -89,11 +89,11 @@ def test_step_over_write_watchpoint(self):
lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT,
)
self.assertEqual(thread.GetStopDescription(20), "watchpoint 1")
self.assertEqual(thread.stop_description, "watchpoint 1")

process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
self.assertEqual(thread.GetStopDescription(20), "step over")
self.assertEqual(thread.stop_description, "step over")

self.step_inst_for_watchpoint(1)

Expand All @@ -106,7 +106,7 @@ def step_inst_for_watchpoint(self, wp_id):
if stop_reason == lldb.eStopReasonWatchpoint:
self.assertFalse(watchpoint_hit, "Watchpoint already hit.")
expected_stop_desc = "watchpoint %d" % wp_id
actual_stop_desc = self.thread().GetStopDescription(20)
actual_stop_desc = self.thread().stop_description
self.assertEqual(
actual_stop_desc, expected_stop_desc, "Watchpoint ID didn't match."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def test_watchpoint_count(self):
self.assertStopReason(
stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x1 not hit"
)
stop_reason_descr = thread.GetStopDescription(256)
stop_reason_descr = thread.stop_description
self.assertEqual(stop_reason_descr, "watchpoint 1")

process.Continue()
stop_reason = thread.GetStopReason()
self.assertStopReason(
stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x2 not hit"
)
stop_reason_descr = thread.GetStopDescription(256)
stop_reason_descr = thread.stop_description
self.assertEqual(stop_reason_descr, "watchpoint 2")
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def cont(self):
process = self.connect(target)

self.assertEqual(process.threads[0].GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(process.threads[0].GetStopDescription(100), "signal SIGBUS")
self.assertEqual(process.threads[0].stop_description, "signal SIGBUS")

def test_signal_lldb_old(self):
class MyResponder(MockGDBServerResponder):
Expand All @@ -620,7 +620,7 @@ def cont(self):
process = self.connect(target)

self.assertEqual(process.threads[0].GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(process.threads[0].GetStopDescription(100), "signal SIGUSR1")
self.assertEqual(process.threads[0].stop_description, "signal SIGUSR1")

def test_signal_lldb(self):
class MyResponder(MockGDBServerResponder):
Expand All @@ -643,7 +643,7 @@ def cont(self):
process = self.connect(target)

self.assertEqual(process.threads[0].GetStopReason(), lldb.eStopReasonSignal)
self.assertEqual(process.threads[0].GetStopDescription(100), "signal SIGUSR1")
self.assertEqual(process.threads[0].stop_description, "signal SIGUSR1")

def do_siginfo_test(self, platform, target_yaml, raw_data, expected):
class MyResponder(MockGDBServerResponder):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,5 @@ def run_python_os_step_missing_thread(self, do_prune):
os_thread = self.get_os_thread()
self.assertTrue(os_thread.IsValid(), "The OS thread is back after continue")
self.assertIn(
"step out", os_thread.GetStopDescription(100), "Completed step out plan"
"step out", os_thread.stop_description, "Completed step out plan"
)
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_thread_info_in_minidump(self):
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
stop_description = thread.GetStopDescription(256)
stop_description = thread.stop_description
self.assertIn("SIGSEGV", stop_description)

@skipIfLLVMTargetMissing("X86")
Expand Down Expand Up @@ -153,7 +153,7 @@ def test_snapshot_minidump_dump_requested(self):
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
stop_description = thread.stop_description
self.assertEqual(stop_description, "")

def test_snapshot_minidump_null_exn_code(self):
Expand All @@ -164,7 +164,7 @@ def test_snapshot_minidump_null_exn_code(self):
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
stop_description = thread.stop_description
self.assertEqual(stop_description, "")

def check_register_unsigned(self, set, name, expected):
Expand Down Expand Up @@ -198,7 +198,7 @@ def test_arm64_registers(self):
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
stop_description = thread.stop_description
self.assertEqual(stop_description, "")
registers = thread.GetFrameAtIndex(0).GetRegisters()
# Verify the GPR registers are all correct
Expand Down Expand Up @@ -261,7 +261,7 @@ def verify_arm_registers(self, apple=False):
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
stop_description = thread.stop_description
self.assertEqual(stop_description, "")
registers = thread.GetFrameAtIndex(0).GetRegisters()
# Verify the GPR registers are all correct
Expand Down Expand Up @@ -522,7 +522,7 @@ def test_multiple_exceptions_or_signals(self):
for i in range(2):
thread = self.process.GetThreadAtIndex(i)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
stop_description = thread.GetStopDescription(256)
stop_description = thread.stop_description
self.assertIn("SIGSEGV", stop_description)

def test_breakpoint_on_minidump(self):
Expand All @@ -539,7 +539,7 @@ def test_breakpoint_on_minidump(self):
process = target.LoadCore(core)
self.assertTrue(process, VALID_PROCESS)
thread = process.GetThreadAtIndex(0)
stop_reason = thread.GetStopDescription(256)
stop_reason = thread.stop_description
self.assertIn("breakpoint 1.1", stop_reason)
finally:
if os.path.isfile(core):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_thread_info_in_mini_dump(self):
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonException)
stop_description = thread.GetStopDescription(256)
stop_description = thread.stop_description
self.assertIn("0xc0000005", stop_description)

def test_modules_in_mini_dump(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ def get_stop_reason(self) -> Dict[str, Any]:
if self.is_stopped:
if "arm64" in self.scripted_process.arch:
stop_reason["type"] = lldb.eStopReasonException
stop_reason["data"][
"desc"
] = self.corefile_thread.GetStopDescription(100)
stop_reason["data"]["desc"] = self.corefile_thread.stop_description
elif self.scripted_process.arch == "x86_64":
stop_reason["type"] = lldb.eStopReasonSignal
stop_reason["data"]["signal"] = signal.SIGTRAP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def step_out_with_scripted_plan(self, name):

frame = thread.GetFrameAtIndex(0)
self.assertEqual("main", frame.GetFunctionName())
stop_desc = thread.GetStopDescription(1000)
stop_desc = thread.stop_description
self.assertIn("Stepping out from", stop_desc, "Got right description")

def run_until_branch_instruction(self):
Expand Down Expand Up @@ -153,7 +153,7 @@ def do_test_checking_variable(self, use_cli):
self.assertTrue(foo_val.GetValueDidChange(), "Foo changed")

# And we should have a reasonable stop description:
desc = thread.GetStopDescription(1000)
desc = thread.stop_description
self.assertIn("Stepped until foo changed", desc, "Got right stop description")

def test_stop_others_from_command(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def tsan_tests(self):
stop_description = (
self.dbg.GetSelectedTarget()
.process.GetSelectedThread()
.GetStopDescription(100)
.stop_description
)

self.assertTrue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def abort_with_test(self, with_payload):
self.assertEqual(thread, sel_thread, "Selected the original thread")
# Make sure the stop reason is right:
self.assertEqual(
thread.GetStopDescription(100),
thread.stop_description,
"abort with payload or reason",
"Description was right",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test(self):
self.runCmd("fr v")

self.assertEqual(
thread.GetStopDescription(256), "ESR_EC_DABORT_EL0 (fault address: 0x0)"
thread.stop_description, "ESR_EC_DABORT_EL0 (fault address: 0x0)"
)

if self.TraceOn():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_4(self):
)
self.runCmd("thread step-inst")
# we need to step more, as some compilers do not set appropriate debug info.
while cur_thread.GetStopDescription(256) == "instruction step into":
while cur_thread.stop_description == "instruction step into":
self.runCmd("thread step-inst")
# The stop reason of the thread should be illegal opcode.
self.expect(
Expand All @@ -34,7 +34,7 @@ def test_2(self):
)
self.runCmd("thread step-inst")
# we need to step more, as some compilers do not set appropriate debug info.
while cur_thread.GetStopDescription(256) == "instruction step into":
while cur_thread.stop_description == "instruction step into":
self.runCmd("thread step-inst")
# The stop reason of the thread should be illegal opcode.
self.expect(
Expand Down
Loading