[Lldb-commits] [PATCH] Fix handling of CommandInterpreter's events in lldb-mi

Ilia K ki.stfu at gmail.com
Sat Mar 21 03:56:14 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8382

Files:
  lldb/trunk/include/lldb/API/SBCommandInterpreter.h
  lldb/trunk/source/API/SBCommandInterpreter.cpp
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp

Index: lldb/trunk/source/API/SBCommandInterpreter.cpp
===================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp
@@ -20,6 +20,7 @@
 #include "lldb/API/SBBroadcaster.h"
 #include "lldb/API/SBCommandReturnObject.h"
 #include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBEvent.h"
 #include "lldb/API/SBExecutionContext.h"
 #include "lldb/API/SBProcess.h"
 #include "lldb/API/SBTarget.h"
@@ -548,6 +549,12 @@
 }
 
 bool
+SBCommandInterpreter::EventIsCommandInterpreterEvent (const lldb::SBEvent &event)
+{
+    return strcmp (event.GetBroadcasterClass(), SBCommandInterpreter::GetBroadcasterClass()) == 0;
+}
+
+bool
 SBCommandInterpreter::SetCommandOverrideCallback (const char *command_name,
                                                   lldb::CommandOverrideCallback callback,
                                                   void *baton)
Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
===================================================================
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
@@ -296,7 +296,7 @@
     eventMask = lldb::SBCommandInterpreter::eBroadcastBitQuitCommandReceived | lldb::SBCommandInterpreter::eBroadcastBitThreadShouldExit |
                 lldb::SBCommandInterpreter::eBroadcastBitAsynchronousOutputData |
                 lldb::SBCommandInterpreter::eBroadcastBitAsynchronousErrorData;
-    bOk = bOk && RegisterForEvent(strDbgId, CMIUtilString(lldb::SBCommandInterpreter::GetBroadcasterClass()), eventMask);
+    bOk = bOk && RegisterForEvent(strDbgId, m_lldbDebugger.GetCommandInterpreter().GetBroadcaster(), eventMask);
 
     return bOk;
 }
Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===================================================================
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -28,6 +28,7 @@
 #include "MICmnLLDBDebuggerHandleEvents.h"
 #include "MICmnResources.h"
 #include "MICmnLog.h"
+#include "MICmnLLDBDebugger.h"
 #include "MICmnLLDBDebugSessionInfo.h"
 #include "MICmnMIResultRecord.h"
 #include "MICmnMIValueConst.h"
@@ -146,6 +147,11 @@
         vrbHandledEvent = true;
         bOk = HandleEventSBTarget(vEvent);
     }
+    else if (lldb::SBCommandInterpreter::EventIsCommandInterpreterEvent(vEvent))
+    {
+        vrbHandledEvent = true;
+        bOk = HandleEventSBCommandInterpreter(vEvent);
+    }
 
     return bOk;
 }
@@ -756,8 +762,12 @@
             pEventType = "eBroadcastBitResetPrompt";
             break;
         case lldb::SBCommandInterpreter::eBroadcastBitQuitCommandReceived:
+        {
             pEventType = "eBroadcastBitQuitCommandReceived";
+            const bool bForceExit = true;
+            CMICmnLLDBDebugger::Instance().GetDriver().SetExitApplicationFlag(bForceExit);
             break;
+        }
         case lldb::SBCommandInterpreter::eBroadcastBitAsynchronousOutputData:
             pEventType = "eBroadcastBitAsynchronousOutputData";
             break;
Index: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
===================================================================
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h
@@ -94,6 +94,9 @@
     
     static const char *
     GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
+
+    static bool
+    EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
     
     bool
     IsValid() const;

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8382.22410.patch
Type: text/x-patch
Size: 3661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150321/3efbfc15/attachment.bin>


More information about the lldb-commits mailing list