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

Greg Clayton clayborg at gmail.com
Thu Mar 19 11:32:11 PDT 2015


SBBroadcaster::CheckInWithManager() should not be exposed as no one should have to worry about this from a public API perspective. CommandInterpreter::CommandInterpreter() calls CheckInWithManager() already.


================
Comment at: include/lldb/API/SBBroadcaster.h:58-60
@@ -57,2 +57,5 @@
 
+    void
+    CheckInWithManager ();
+
     // This comparison is checking if the internal opaque pointer value
----------------
Remove this. See comments below.

================
Comment at: source/API/SBBroadcaster.cpp:155-161
@@ -154,2 +154,9 @@
 
+void
+SBBroadcaster::CheckInWithManager ()
+{
+    if (m_opaque_ptr)
+        return m_opaque_ptr->CheckInWithManager ();
+}
+
 Broadcaster *
----------------
Remove this. You shouldn't have to do this. CommandInterpreter::CommandInterpreter() already calls CheckInWithManager ();


================
Comment at: source/API/SBCommandInterpreter.cpp:554
@@ +553,3 @@
+{
+    return strcmp (event.GetBroadcasterClass(), SBCommandInterpreter::GetBroadcasterClass()) == 0;
+}
----------------
The strings are returns as the "const char *" from a lldb_private::ConstString object, so just do a pointer compare instead of a strcmp.

================
Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:300
@@ -299,2 +299,3 @@
     bOk = bOk && RegisterForEvent(strDbgId, CMIUtilString(lldb::SBCommandInterpreter::GetBroadcasterClass()), eventMask);
+    m_lldbDebugger.GetCommandInterpreter().GetBroadcaster().CheckInWithManager();
 
----------------
ki.stfu wrote:
> abidh wrote:
> > Why we have to do this for command interpreter? 
> Because CommandInterpreter object already has been created in contrast to Target/Thread/Process.
You shouldn't have to do this, it is being done in the lldb_private::CommandInterpreter::CommandInterpreter(). How did you manage to not contract a CommandInterpreter and yet you are able to listen to events from it?

http://reviews.llvm.org/D8382

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list