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

2018-07-21 Thread Alexander Polyakov via Phabricator via lldb-commits
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


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

2018-07-21 Thread Alexander Polyakov via Phabricator via lldb-commits
apolyakov added inline comments.



Comment at: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp:963
+sbProcess.GetDescription(streamOut);
+for (uint32_t i = 0, e = sbProcess.GetNumThreads(); i < e; ++i) {
+  const lldb::SBThread thread = sbProcess.GetThreadAtIndex(i);

Am I right that here should be a synchronization block?


https://reviews.llvm.org/D49632



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2018-07-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

So with CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended() it 
will report a bunch of text back through the MI interface with this each time? 
Why would it do that? I would assume that the MI interface would handle this 
programmatically?




Comment at: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp:963
+sbProcess.GetDescription(streamOut);
+for (uint32_t i = 0, e = sbProcess.GetNumThreads(); i < e; ++i) {
+  const lldb::SBThread thread = sbProcess.GetThreadAtIndex(i);

apolyakov wrote:
> Am I right that here should be a synchronization block?
As long as the process remains stopped you are ok.


https://reviews.llvm.org/D49632



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49612: Use LLVM's new ItaniumPartialDemangler in LLDB

2018-07-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

We do need to test the performance of this as demangling is a hot spot when we 
parse any object file. If it is faster, then we should just replace it and not 
add any options to be able to switch. Also we should compare demangled names 
between the two to ensure there are no differences as we are doing this.


https://reviews.llvm.org/D49612



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2018-07-21 Thread Alexander Polyakov via Phabricator via lldb-commits
apolyakov added a comment.

In https://reviews.llvm.org/D49632#1171024, @clayborg wrote:

> So with CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended() it 
> will report a bunch of text back through the MI interface with this each 
> time? Why would it do that? I would assume that the MI interface would handle 
> this programmatically?


Could you explain more detailed what does it mean that MI interface would 
handle a report of bunch of text programmatically?


https://reviews.llvm.org/D49632



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits