[Lldb-commits] [PATCH] D151043: [lldb] Add "Trace" stop reason in Scripted Thread

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun May 21 00:52:54 PDT 2023


mib created this revision.
mib added a reviewer: jingham.
mib added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

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

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151043

Files:
  lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
  lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
  lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py


Index: lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
===================================================================
--- lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
@@ -67,9 +67,7 @@
         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(
Index: lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
===================================================================
--- lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -186,7 +186,7 @@
         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)
 
Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
===================================================================
--- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -258,6 +258,9 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151043.524085.patch
Type: text/x-patch
Size: 1968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230521/065e2f68/attachment.bin>


More information about the lldb-commits mailing list