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);


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);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to