[Lldb-commits] [PATCH] D49632: [lldb-mi] Re-implement MI HandleProcessEventStateSuspended.

Alexander Polyakov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Jul 21 01:48:27 PDT 2018


apolyakov created this revision.
apolyakov added reviewers: aprantl, clayborg, labath.
Herald added a subscriber: ki.stfu.

Now this function uses SB API instead of HandleCommand.


https://reviews.llvm.org/D49632

Files:
  tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp


Index: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -950,24 +950,24 @@
 bool CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended(
     const lldb::SBEvent &vEvent) {
   bool bOk = MIstatus::success;
+  lldb::SBStream streamOut;
   lldb::SBDebugger &rDebugger =
       CMICmnLLDBDebugSessionInfo::Instance().GetDebugger();
   lldb::SBProcess sbProcess =
       CMICmnLLDBDebugSessionInfo::Instance().GetProcess();
   lldb::SBTarget target = sbProcess.GetTarget();
   if (rDebugger.GetSelectedTarget() == target) {
     if (!UpdateSelectedThread())
       return MIstatus::failure;
-
-    lldb::SBCommandReturnObject result;
-    const lldb::ReturnStatus status =
-        rDebugger.GetCommandInterpreter().HandleCommand("process status",
-                                                        result, false);
-    MIunused(status);
-    bOk = TextToStderr(result.GetError());
-    bOk = bOk && TextToStdout(result.GetOutput());
+    sbProcess.GetDescription(streamOut);
+    for (uint32_t i = 0, e = sbProcess.GetNumThreads(); i < e; ++i) {
+      const lldb::SBThread thread = sbProcess.GetThreadAtIndex(i);
+      if (!thread.IsValid())
+        continue;
+      thread.GetDescription(streamOut);
+    }
+    bOk = TextToStdout(streamOut.GetData());
   } else {
-    lldb::SBStream streamOut;
     const MIuint nTargetIndex = rDebugger.GetIndexOfTarget(target);
     if (nTargetIndex != UINT_MAX)
       streamOut.Printf("Target %d: (", nTargetIndex);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49632.156668.patch
Type: text/x-patch
Size: 1646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180721/660c8909/attachment.bin>


More information about the lldb-commits mailing list