Skip to content

Commit

Permalink
[lldb] Add "Trace" stop reason in Scripted Thread
Browse files Browse the repository at this point in the history
This patch adds support to eStopReasonTrace to Scripted Threads.

This is necessary when using a Scrited Process with a Scripted Thread
Plan to report a special thread stop reason to the thread plan.

rdar://109425542

Differential Revision: https://reviews.llvm.org/D151043

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
  • Loading branch information
medismailben committed May 22, 2023
1 parent ac09a0e commit 8f407b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ bool ScriptedThread::CalculateStopInfo() {
stop_info_sp =
StopInfo::CreateStopReasonWithSignal(*this, signal, description.data());
} break;
case lldb::eStopReasonTrace: {
stop_info_sp = StopInfo::CreateStopReasonToTrace(*this);
} break;
case lldb::eStopReasonException: {
#if defined(__APPLE__)
StructuredData::Dictionary *mach_exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def cleanup():
self.assertTrue(thread, "Invalid thread.")
self.assertEqual(thread.GetThreadID(), 0x19)
self.assertEqual(thread.GetName(), "DummyScriptedThread.thread-1")
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonTrace)

self.assertGreater(thread.GetNumFrames(), 0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def get_state(self) -> int:
return lldb.eStateStopped

def get_stop_reason(self) -> Dict[str, Any]:
return { "type": lldb.eStopReasonSignal, "data": {
"signal": signal.SIGINT
} }
return { "type": lldb.eStopReasonTrace, "data": {} }

def get_register_context(self) -> str:
return struct.pack(
Expand Down

0 comments on commit 8f407b8

Please sign in to comment.