<rdar://problem/12188843> Fixing a problem where a Python command created in the same module where the target function is defined causes the help string not to come out

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164172 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index a1a65ae..64f80a0 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -1162,6 +1162,7 @@
 private:
     std::string m_function_name;
     ScriptedCommandSynchronicity m_synchro;
+    bool m_fetched_help_long;
     
 public:
     
@@ -1174,15 +1175,9 @@
                           (std::string("Run Python function ") + funct).c_str(),
                           NULL),
         m_function_name(funct),
-        m_synchro(synch)
+        m_synchro(synch),
+        m_fetched_help_long(false)
     {
-        ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
-        if (scripter)
-        {
-            std::string docstring = scripter->GetDocumentationForItem(funct.c_str());
-            if (!docstring.empty())
-                SetHelpLong(docstring);
-        }
     }
     
     virtual
@@ -1208,6 +1203,23 @@
         return m_synchro;
     }
     
+    virtual const char *
+    GetHelpLong ()
+    {
+        if (!m_fetched_help_long)
+        {
+            ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
+            if (scripter)
+            {
+                std::string docstring;
+                m_fetched_help_long = scripter->GetDocumentationForItem(m_function_name.c_str(),docstring);
+                if (!docstring.empty())
+                    SetHelpLong(docstring);
+            }
+        }
+        return CommandObjectRaw::GetHelpLong();
+    }
+    
 protected:
     virtual bool
     DoExecute (const char *raw_command_line, CommandReturnObject &result)