[Lldb-commits] [lldb] r114252 - in /lldb/trunk: include/lldb/API/ include/lldb/Core/ include/lldb/Interpreter/ include/lldb/Target/ lldb.xcodeproj/ source/API/ source/Commands/ source/Core/ source/Interpreter/ tools/driver/

Greg Clayton gclayton at apple.com
Fri Sep 17 18:14:36 PDT 2010


Author: gclayton
Date: Fri Sep 17 20:14:36 2010
New Revision: 114252

URL: http://llvm.org/viewvc/llvm-project?rev=114252&view=rev
Log:
Fixed the way set/show variables were being accessed to being natively 
accessed by the objects that own the settings. The previous approach wasn't
very usable and made for a lot of unnecessary code just to access variables
that were already owned by the objects.

While I fixed those things, I saw that CommandObject objects should really
have a reference to their command interpreter so they can access the terminal
with if they want to output usaage. Fixed up all CommandObjects to take
an interpreter and cleaned up the API to not need the interpreter to be
passed in.

Fixed the disassemble command to output the usage if no options are passed
down and arguments are passed (all disassebmle variants take options, there
are no "args only").


Modified:
    lldb/trunk/include/lldb/API/SBDebugger.h
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/include/lldb/Interpreter/CommandObject.h
    lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h
    lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
    lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
    lldb/trunk/include/lldb/Interpreter/Options.h
    lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
    lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h
    lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/Commands/CommandObjectApropos.cpp
    lldb/trunk/source/Commands/CommandObjectApropos.h
    lldb/trunk/source/Commands/CommandObjectArgs.cpp
    lldb/trunk/source/Commands/CommandObjectArgs.h
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpoint.h
    lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h
    lldb/trunk/source/Commands/CommandObjectCall.cpp
    lldb/trunk/source/Commands/CommandObjectCall.h
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Commands/CommandObjectCrossref.cpp
    lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
    lldb/trunk/source/Commands/CommandObjectDisassemble.h
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Commands/CommandObjectExpression.h
    lldb/trunk/source/Commands/CommandObjectFile.cpp
    lldb/trunk/source/Commands/CommandObjectFile.h
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Commands/CommandObjectHelp.cpp
    lldb/trunk/source/Commands/CommandObjectHelp.h
    lldb/trunk/source/Commands/CommandObjectImage.cpp
    lldb/trunk/source/Commands/CommandObjectLog.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Commands/CommandObjectMultiword.cpp
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Commands/CommandObjectQuit.cpp
    lldb/trunk/source/Commands/CommandObjectQuit.h
    lldb/trunk/source/Commands/CommandObjectRegister.cpp
    lldb/trunk/source/Commands/CommandObjectSettings.cpp
    lldb/trunk/source/Commands/CommandObjectSettings.h
    lldb/trunk/source/Commands/CommandObjectSource.cpp
    lldb/trunk/source/Commands/CommandObjectSyntax.cpp
    lldb/trunk/source/Commands/CommandObjectSyntax.h
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Interpreter/CommandObject.cpp
    lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
    lldb/trunk/source/Interpreter/CommandObjectScript.cpp
    lldb/trunk/source/Interpreter/CommandObjectScript.h
    lldb/trunk/source/Interpreter/Options.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Fri Sep 17 20:14:36 2010
@@ -154,6 +154,24 @@
     static lldb::SBStringList
     GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
 
+    uint32_t
+    GetTerminalWidth () const;
+
+    void
+    SetTerminalWidth (uint32_t term_width);
+
+    const char *
+    GetPrompt() const;
+
+    void
+    SetPrompt (const char *prompt);
+        
+    lldb::ScriptLanguage 
+    GetScriptLanguage() const;
+
+    void
+    SetScriptLanguage (lldb::ScriptLanguage script_lang);
+
 private:
 
 #ifndef SWIG

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Fri Sep 17 20:14:36 2010
@@ -65,6 +65,45 @@
                               const ConstString &var_name,
                               StringList &value);
 
+    uint32_t
+    GetTerminalWidth () const
+    {
+        return m_term_width;
+    }
+
+    void
+    SetTerminalWidth (uint32_t term_width)
+    {
+        m_term_width = term_width;
+    }
+    
+    const char *
+    GetPrompt() const
+    {
+        return m_prompt.c_str();
+    }
+
+    void
+    SetPrompt(const char *p)
+    {
+        if (p)
+            m_prompt.assign (p);
+        else
+            m_prompt.assign ("(lldb) ");
+    }
+        
+    lldb::ScriptLanguage 
+    GetScriptLanguage() const
+    {
+        return m_script_lang;
+    }
+
+    void
+    SetScriptLanguage (lldb::ScriptLanguage script_lang)
+    {
+        m_script_lang = script_lang;
+    }
+
 protected:
 
     void
@@ -91,7 +130,7 @@
   
 private:
 
-    int m_term_width;
+    uint32_t m_term_width;
     std::string m_prompt;
     lldb::ScriptLanguage m_script_lang;
 };

Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Fri Sep 17 20:14:36 2010
@@ -28,7 +28,8 @@
     typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;
 
 
-    CommandObject (const char *name,
+    CommandObject (CommandInterpreter &interpreter,
+                   const char *name,
                    const char *help = NULL,
                    const char *syntax = NULL,
                    uint32_t flags = 0);
@@ -36,6 +37,12 @@
     virtual
     ~CommandObject ();
 
+    CommandInterpreter &
+    GetCommandInterpreter ()
+    {
+        return m_interpreter;
+    }
+
     const char *
     GetHelp ();
 
@@ -89,23 +96,19 @@
 
     // Do not override this
     bool
-    ExecuteCommandString (CommandInterpreter &interpreter,
-                          const char *command,
+    ExecuteCommandString (const char *command,
                           CommandReturnObject &result);
 
     bool
-    ParseOptions (CommandInterpreter &interpreter,
-                  Args& args,
+    ParseOptions (Args& args,
                   CommandReturnObject &result);
 
     bool
-    ExecuteWithOptions (CommandInterpreter &interpreter,
-                        Args& command,
+    ExecuteWithOptions (Args& command,
                         CommandReturnObject &result);
 
     virtual bool
-    ExecuteRawCommandString (CommandInterpreter &interpreter,
-                             const char *command,
+    ExecuteRawCommandString (const char *command,
                              CommandReturnObject &result)
     {
         return false;
@@ -113,8 +116,7 @@
 
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result) = 0;
 
     void
@@ -169,8 +171,7 @@
     ///     \btrue if we were in an option, \bfalse otherwise.
     //------------------------------------------------------------------
     virtual int
-    HandleCompletion (CommandInterpreter &interpreter,
-                      Args &input,
+    HandleCompletion (Args &input,
                       int &cursor_index,
                       int &cursor_char_position,
                       int match_start_point,
@@ -219,8 +220,7 @@
     //------------------------------------------------------------------
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -233,7 +233,7 @@
     }
     
     bool
-    HelpTextContainsWord (const char *search_word, CommandInterpreter &interpreter);
+    HelpTextContainsWord (const char *search_word);
 
     //------------------------------------------------------------------
     /// The flags accessor.
@@ -270,6 +270,7 @@
     }
 
 protected:
+    CommandInterpreter &m_interpreter;
     std::string m_cmd_name;
     std::string m_cmd_help_short;
     std::string m_cmd_help_long;

Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h Fri Sep 17 20:14:36 2010
@@ -26,10 +26,11 @@
 class CommandObjectCrossref : public CommandObject
 {
 public:
-    CommandObjectCrossref (const char *name,
-                             const char *help = NULL,
-                             const char *syntax = NULL);
-
+    CommandObjectCrossref (CommandInterpreter &interpreter,
+                           const char *name,
+                           const char *help = NULL,
+                           const char *syntax = NULL);
+    
     virtual
     ~CommandObjectCrossref ();
 
@@ -37,8 +38,7 @@
     GenerateHelpText (CommandReturnObject &result);
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h Fri Sep 17 20:14:36 2010
@@ -27,7 +27,8 @@
 class CommandObjectMultiword : public CommandObject
 {
 public:
-    CommandObjectMultiword (const char *name,
+    CommandObjectMultiword (CommandInterpreter &interpreter,
+                            const char *name,
                             const char *help = NULL,
                             const char *syntax = NULL,
                             uint32_t flags = 0);
@@ -39,12 +40,11 @@
     IsMultiwordObject () { return true; }
 
     bool
-    LoadSubCommand (CommandInterpreter &interpreter, 
-                    const char *cmd_name, 
+    LoadSubCommand (const char *cmd_name, 
                     const lldb::CommandObjectSP& command_obj);
 
     void
-    GenerateHelpText (CommandInterpreter &interpreter, CommandReturnObject &result);
+    GenerateHelpText (CommandReturnObject &result);
 
     lldb::CommandObjectSP
     GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
@@ -53,13 +53,11 @@
     GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleCompletion (CommandInterpreter &interpreter,
-                      Args &input,
+    HandleCompletion (Args &input,
                       int &cursor_index,
                       int &cursor_char_position,
                       int match_start_point,

Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h Fri Sep 17 20:14:36 2010
@@ -29,22 +29,24 @@
 {
 public:
 
-    CommandObjectRegexCommand (const char *name, const char *help, const char *syntax, uint32_t max_matches);
-
+    CommandObjectRegexCommand (CommandInterpreter &interpreter,
+                               const char *name, 
+                               const char *help, 
+                               const char *syntax, 
+                               uint32_t max_matches);
+    
     virtual
     ~CommandObjectRegexCommand ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual bool
     WantsRawCommandString() { return true; }
 
     virtual bool
-    ExecuteRawCommandString (CommandInterpreter &interpreter,
-                             const char *command,
+    ExecuteRawCommandString (const char *command,
                              CommandReturnObject &result);
 
 

Modified: lldb/trunk/include/lldb/Interpreter/Options.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Options.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Options.h Fri Sep 17 20:14:36 2010
@@ -157,10 +157,9 @@
                               uint32_t output_max_columns);
 
     void
-    GenerateOptionUsage (Stream &strm,
-                         CommandObject *cmd,
-                         const char *debugger_instance_name,
-                         const char *program_name = NULL);
+    GenerateOptionUsage (CommandInterpreter &interpreter,
+                         Stream &strm,
+                         CommandObject *cmd);
 
     // The following two pure virtual functions must be defined by every class that inherits from
     // this class.

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Fri Sep 17 20:14:36 2010
@@ -38,15 +38,15 @@
     } ReturnType;
 
 
-    ScriptInterpreter (lldb::ScriptLanguage script_lang);
+    ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang);
 
     virtual ~ScriptInterpreter ();
 
     virtual bool
-    ExecuteOneLine (CommandInterpreter &interpreter, const char *command, CommandReturnObject *result) = 0;
+    ExecuteOneLine (const char *command, CommandReturnObject *result) = 0;
 
     virtual void
-    ExecuteInterpreterLoop (CommandInterpreter &interpreter) = 0;
+    ExecuteInterpreterLoop () = 0;
 
     virtual bool
     ExecuteOneLineWithReturn (const char *in_string, ReturnType return_type, void *ret_value)
@@ -73,14 +73,12 @@
     }
 
     virtual void 
-    CollectDataForBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                             BreakpointOptions *bp_options,
+    CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
                                              CommandReturnObject &result);
 
     /// Set a one-liner as the callback for the breakpoint.
     virtual void 
-    SetBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                  BreakpointOptions *bp_options,
+    SetBreakpointCommandCallback (BreakpointOptions *bp_options,
                                   const char *oneliner)
     {
         return;
@@ -98,6 +96,9 @@
     static std::string
     LanguageToString (lldb::ScriptLanguage);
 
+protected:
+    CommandInterpreter &m_interpreter;
+
 private:
     lldb::ScriptLanguage m_script_lang;
 

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h Fri Sep 17 20:14:36 2010
@@ -23,10 +23,10 @@
     ~ScriptInterpreterNone ();
 
     bool
-    ExecuteOneLine (CommandInterpreter &interpreter, const char *command, CommandReturnObject *result);
+    ExecuteOneLine (const char *command, CommandReturnObject *result);
 
     void
-    ExecuteInterpreterLoop (CommandInterpreter &interpreter);
+    ExecuteInterpreterLoop ();
 
 };
 

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Fri Sep 17 20:14:36 2010
@@ -25,10 +25,10 @@
     ~ScriptInterpreterPython ();
 
     bool
-    ExecuteOneLine (CommandInterpreter &interpreter, const char *command, CommandReturnObject *result);
+    ExecuteOneLine (const char *command, CommandReturnObject *result);
 
     void
-    ExecuteInterpreterLoop (CommandInterpreter &interpreter);
+    ExecuteInterpreterLoop ();
 
     bool
     ExecuteOneLineWithReturn (const char *in_string, 
@@ -58,14 +58,12 @@
                                 lldb::user_id_t break_loc_id);
 
     void
-    CollectDataForBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                             BreakpointOptions *bp_options,
+    CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
                                              CommandReturnObject &result);
 
     /// Set a Python one-liner as the callback for the breakpoint.
     void 
-    SetBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                  BreakpointOptions *bp_options,
+    SetBreakpointCommandCallback (BreakpointOptions *bp_options,
                                   const char *oneliner);
 
     StringList

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Sep 17 20:14:36 2010
@@ -75,6 +75,107 @@
                               StringList &value);
 
 
+    const Args &
+    GetRunArguments () const
+    {
+        return m_run_args;
+    }
+
+    void
+    SetRunArguments (const Args &args)
+    {
+        m_run_args = args;
+    }
+
+    size_t
+    GetEnvironmentAsArgs (Args &env) const
+    {
+        dictionary::const_iterator pos, end = m_env_vars.end();
+        for (pos = m_env_vars.begin(); pos != end; ++pos)
+        {
+            std::string env_var_equal_value (pos->first);
+            env_var_equal_value.append(1, '=');
+            env_var_equal_value.append (pos->second);
+            env.AppendArgument (env_var_equal_value.c_str());
+        }
+        return env.GetArgumentCount();
+    }
+
+    const char *
+    GetStandardInputPath () const
+    {
+        if (m_input_path.empty())
+            return NULL;
+        return m_input_path.c_str();
+    }
+
+    void
+    SetStandardInputPath (const char *path)
+    {
+        if (path && path[0])
+            m_input_path.assign (path);
+        else
+        {
+            // Make sure we deallocate memory in string...
+            std::string tmp;
+            tmp.swap (m_input_path);
+        }
+    }
+
+    const char *
+    GetStandardOutputPath () const
+    {
+        if (m_output_path.empty())
+            return NULL;
+        return m_output_path.c_str();
+    }
+
+    void
+    SetStandardOutputPath (const char *path)
+    {
+        if (path && path[0])
+            m_output_path.assign (path);
+        else
+        {
+            // Make sure we deallocate memory in string...
+            std::string tmp;
+            tmp.swap (m_output_path);
+        }
+    }
+
+    const char *
+    GetStandardErrorPath () const
+    {
+        if (m_error_path.empty())
+            return NULL;
+        return m_error_path.c_str();
+    }
+
+    void
+    SetStandardErrorPath (const char *path)
+    {
+        if (path && path[0])
+            m_error_path.assign (path);
+        else
+        {
+            // Make sure we deallocate memory in string...
+            std::string tmp;
+            tmp.swap (m_error_path);
+        }
+    }
+    
+    bool
+    GetDisableASLR () const
+    {
+        return m_disable_aslr;
+    }
+    
+    void
+    SetDisableASLR (bool b)
+    {
+        m_disable_aslr = b;
+    }
+
 protected:
 
     void
@@ -108,8 +209,9 @@
 
 private:
 
+    typedef std::map<std::string, std::string> dictionary;
     Args m_run_args;
-    std::map<std::string, std::string> m_env_vars;
+    dictionary m_env_vars;
     std::string m_input_path;
     std::string m_output_path;
     std::string m_error_path;

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Sep 17 20:14:36 2010
@@ -2339,6 +2339,7 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
 			compatibilityVersion = "Xcode 3.1";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				en,

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Fri Sep 17 20:14:36 2010
@@ -602,6 +602,55 @@
     return ret_value;
 }
 
+uint32_t
+SBDebugger::GetTerminalWidth () const
+{
+    if (m_opaque_sp)
+        return m_opaque_sp->GetTerminalWidth ();
+    return 0;
+}
+
+void
+SBDebugger::SetTerminalWidth (uint32_t term_width)
+{
+    if (m_opaque_sp)
+        m_opaque_sp->SetTerminalWidth (term_width);
+}
+
+const char *
+SBDebugger::GetPrompt() const
+{
+    if (m_opaque_sp)
+        return m_opaque_sp->GetPrompt ();
+    return 0;
+}
+
+void
+SBDebugger::SetPrompt (const char *prompt)
+{
+    if (m_opaque_sp)
+        m_opaque_sp->SetPrompt (prompt);
+}
+
+    
+lldb::ScriptLanguage 
+SBDebugger::GetScriptLanguage() const
+{
+    if (m_opaque_sp)
+        return m_opaque_sp->GetScriptLanguage ();
+    return eScriptLanguageNone;
+}
+
+void
+SBDebugger::SetScriptLanguage (lldb::ScriptLanguage script_lang)
+{
+    if (m_opaque_sp)
+        m_opaque_sp->SetScriptLanguage (script_lang);
+}
+
+
+
+
 bool
 SBDebugger::SetUseExternalEditor (bool value)
 {

Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Fri Sep 17 20:14:36 2010
@@ -26,10 +26,11 @@
 // CommandObjectApropos
 //-------------------------------------------------------------------------
 
-CommandObjectApropos::CommandObjectApropos () :
-    CommandObject ("apropos",
-                     "Find a list of debugger commands related to a particular word/subject.",
-                     "apropos <search-word>")
+CommandObjectApropos::CommandObjectApropos (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "apropos",
+                   "Find a list of debugger commands related to a particular word/subject.",
+                   "apropos <search-word>")
 {
 }
 
@@ -41,7 +42,6 @@
 bool
 CommandObjectApropos::Execute
 (
-    CommandInterpreter &interpreter,
     Args& args,
     CommandReturnObject &result
 )
@@ -58,7 +58,7 @@
             // is private.
             StringList commands_found;
             StringList commands_help;
-            interpreter.FindCommandsForApropos (search_word, commands_found, commands_help);
+            m_interpreter.FindCommandsForApropos (search_word, commands_found, commands_help);
             if (commands_found.GetSize() == 0)
             {
                 result.AppendMessageWithFormat ("No commands found pertaining to '%s'.", search_word);
@@ -77,12 +77,12 @@
                 }
 
                 for (size_t i = 0; i < commands_found.GetSize(); ++i)
-                    interpreter.OutputFormattedHelpText (result.GetOutputStream(), 
-                                                         commands_found.GetStringAtIndex(i),
-                                                         "--", commands_help.
-                                                         GetStringAtIndex(i), 
-                                                         max_len);
-
+                    m_interpreter.OutputFormattedHelpText (result.GetOutputStream(), 
+                                                           commands_found.GetStringAtIndex(i),
+                                                           "--", commands_help.
+                                                           GetStringAtIndex(i), 
+                                                           max_len);
+                
             }
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
         }

Modified: lldb/trunk/source/Commands/CommandObjectApropos.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectApropos.h (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.h Fri Sep 17 20:14:36 2010
@@ -26,14 +26,13 @@
 {
 public:
 
-    CommandObjectApropos ();
+    CommandObjectApropos (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectApropos ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 

Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Fri Sep 17 20:14:36 2010
@@ -77,8 +77,9 @@
     return g_option_table;
 }
 
-CommandObjectArgs::CommandObjectArgs () :
-    CommandObject ("args",
+CommandObjectArgs::CommandObjectArgs (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "args",
                    "When stopped at the start of a function, reads function arguments of type (u?)int(8|16|32|64)_t, (void|char)*",
                    "args")
 {
@@ -97,7 +98,6 @@
 bool
 CommandObjectArgs::Execute
 (
-    CommandInterpreter &interpreter,
     Args& args,
     CommandReturnObject &result
 )
@@ -105,7 +105,7 @@
     ConstString target_triple;
     
     
-    Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+    Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
     if (!process)
     {
         result.AppendError ("Args found no process.");
@@ -131,7 +131,7 @@
         return false;
     }
     
-    Thread *thread = interpreter.GetDebugger().GetExecutionContext ().thread;
+    Thread *thread = m_interpreter.GetDebugger().GetExecutionContext ().thread;
     
     if (!thread)
     {

Modified: lldb/trunk/source/Commands/CommandObjectArgs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.h (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.h Fri Sep 17 20:14:36 2010
@@ -47,7 +47,7 @@
             static lldb::OptionDefinition g_option_table[];
         };
         
-        CommandObjectArgs ();
+        CommandObjectArgs (CommandInterpreter &interpreter);
         
         virtual
         ~CommandObjectArgs ();
@@ -58,8 +58,7 @@
         
         
         virtual bool
-        Execute (CommandInterpreter &interpreter,
-                 Args& command,
+        Execute (    Args& command,
                  CommandReturnObject &result);
         
         virtual bool

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Sep 17 20:14:36 2010
@@ -247,8 +247,10 @@
 //-------------------------------------------------------------------------
 #pragma mark Set
 
-CommandObjectBreakpointSet::CommandObjectBreakpointSet () :
-    CommandObject ("breakpoint set", "Sets a breakpoint or set of breakpoints in the executable.", 
+CommandObjectBreakpointSet::CommandObjectBreakpointSet (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "breakpoint set", 
+                   "Sets a breakpoint or set of breakpoints in the executable.", 
                    "breakpoint set <cmd-options>")
 {
 }
@@ -266,12 +268,11 @@
 bool
 CommandObjectBreakpointSet::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
     if (target == NULL)
     {
         result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -312,7 +313,7 @@
             FileSpec file;
             if (m_options.m_filename.empty())
             {
-                StackFrame *cur_frame = interpreter.GetDebugger().GetExecutionContext().frame;
+                StackFrame *cur_frame = m_interpreter.GetDebugger().GetExecutionContext().frame;
                 if (cur_frame == NULL)
                 {
                     result.AppendError ("Attempting to set breakpoint by line number alone with no selected frame.");
@@ -503,19 +504,20 @@
 #pragma mark MultiwordBreakpoint
 
 CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("breakpoint",
-                              "A set of commands for operating on breakpoints. Also see regexp-break.",
-                              "breakpoint <command> [<command-options>]")
+    CommandObjectMultiword (interpreter, 
+                            "breakpoint",
+                            "A set of commands for operating on breakpoints. Also see regexp-break.",
+                            "breakpoint <command> [<command-options>]")
 {
     bool status;
 
-    CommandObjectSP list_command_object (new CommandObjectBreakpointList ());
-    CommandObjectSP delete_command_object (new CommandObjectBreakpointDelete ());
-    CommandObjectSP enable_command_object (new CommandObjectBreakpointEnable ());
-    CommandObjectSP disable_command_object (new CommandObjectBreakpointDisable ());
-    CommandObjectSP set_command_object (new CommandObjectBreakpointSet ());
+    CommandObjectSP list_command_object (new CommandObjectBreakpointList (interpreter));
+    CommandObjectSP delete_command_object (new CommandObjectBreakpointDelete (interpreter));
+    CommandObjectSP enable_command_object (new CommandObjectBreakpointEnable (interpreter));
+    CommandObjectSP disable_command_object (new CommandObjectBreakpointDisable (interpreter));
+    CommandObjectSP set_command_object (new CommandObjectBreakpointSet (interpreter));
     CommandObjectSP command_command_object (new CommandObjectBreakpointCommand (interpreter));
-    CommandObjectSP modify_command_object (new CommandObjectBreakpointModify());
+    CommandObjectSP modify_command_object (new CommandObjectBreakpointModify(interpreter));
 
     command_command_object->SetCommandName ("breakpoint command");
     enable_command_object->SetCommandName("breakpoint enable");
@@ -524,13 +526,13 @@
     modify_command_object->SetCommandName ("breakpoint modify");
     set_command_object->SetCommandName("breakpoint set");
 
-    status = LoadSubCommand (interpreter, "list",       list_command_object);
-    status = LoadSubCommand (interpreter, "enable",     enable_command_object);
-    status = LoadSubCommand (interpreter, "disable",    disable_command_object);
-    status = LoadSubCommand (interpreter, "delete",     delete_command_object);
-    status = LoadSubCommand (interpreter, "set",        set_command_object);
-    status = LoadSubCommand (interpreter, "command",    command_command_object);
-    status = LoadSubCommand (interpreter, "modify",     modify_command_object);
+    status = LoadSubCommand ("list",       list_command_object);
+    status = LoadSubCommand ("enable",     enable_command_object);
+    status = LoadSubCommand ("disable",    disable_command_object);
+    status = LoadSubCommand ("delete",     delete_command_object);
+    status = LoadSubCommand ("set",        set_command_object);
+    status = LoadSubCommand ("command",    command_command_object);
+    status = LoadSubCommand ("modify",     modify_command_object);
 }
 
 CommandObjectMultiwordBreakpoint::~CommandObjectMultiwordBreakpoint ()
@@ -679,10 +681,11 @@
 //-------------------------------------------------------------------------
 #pragma mark List
 
-CommandObjectBreakpointList::CommandObjectBreakpointList () :
-    CommandObject ("breakpoint list",
-                     "List some or all breakpoints at configurable levels of detail.",
-                     "breakpoint list [<breakpoint-id>]")
+CommandObjectBreakpointList::CommandObjectBreakpointList (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "breakpoint list",
+                   "List some or all breakpoints at configurable levels of detail.",
+                   "breakpoint list [<breakpoint-id>]")
 {
 }
 
@@ -699,12 +702,11 @@
 bool
 CommandObjectBreakpointList::Execute
 (
-    CommandInterpreter &interpreter,
     Args& args,
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
     if (target == NULL)
     {
         result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -769,10 +771,11 @@
 //-------------------------------------------------------------------------
 #pragma mark Enable
 
-CommandObjectBreakpointEnable::CommandObjectBreakpointEnable () :
-    CommandObject ("enable",
-                     "Enable the specified disabled breakpoint(s).  If no breakpoints are specified, enable all of them.",
-                     "breakpoint enable [<breakpoint-id> | <breakpoint-id-list>]")
+CommandObjectBreakpointEnable::CommandObjectBreakpointEnable (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "enable",
+                   "Enable the specified disabled breakpoint(s).  If no breakpoints are specified, enable all of them.",
+                   "breakpoint enable [<breakpoint-id> | <breakpoint-id-list>]")
 {
     // This command object can either be called via 'enable' or 'breakpoint enable'.  Because it has two different
     // potential invocation methods, we need to be a little tricky about generating the syntax string.
@@ -790,12 +793,11 @@
 bool
 CommandObjectBreakpointEnable::Execute 
 (
-    CommandInterpreter &interpreter,
     Args& args, 
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
     if (target == NULL)
     {
         result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -871,8 +873,9 @@
 //-------------------------------------------------------------------------
 #pragma mark Disable
 
-CommandObjectBreakpointDisable::CommandObjectBreakpointDisable () :
-    CommandObject ("disable",
+CommandObjectBreakpointDisable::CommandObjectBreakpointDisable (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "disable",
                    "Disable the specified breakpoint(s) without removing it/them.  If no breakpoints are specified, disable them all.",
                    "disable [<breakpoint-id> | <breakpoint-id-list>]")
 {
@@ -890,12 +893,11 @@
 bool
 CommandObjectBreakpointDisable::Execute
 (
-    CommandInterpreter &interpreter,
     Args& args, 
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
     if (target == NULL)
     {
         result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -971,8 +973,9 @@
 //-------------------------------------------------------------------------
 #pragma mark Delete
 
-CommandObjectBreakpointDelete::CommandObjectBreakpointDelete() :
-    CommandObject ("breakpoint delete",
+CommandObjectBreakpointDelete::CommandObjectBreakpointDelete(CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "breakpoint delete",
                    "Delete the specified breakpoint(s).  If no breakpoints are specified, delete them all.",
                    "breakpoint delete [<breakpoint-id> | <breakpoint-id-list>]")
 {
@@ -986,12 +989,11 @@
 bool
 CommandObjectBreakpointDelete::Execute 
 (
-    CommandInterpreter &interpreter,
     Args& args, 
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
     if (target == NULL)
     {
         result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -1207,8 +1209,10 @@
 //-------------------------------------------------------------------------
 #pragma mark Modify
 
-CommandObjectBreakpointModify::CommandObjectBreakpointModify () :
-    CommandObject ("breakpoint modify", "Modify the options on a breakpoint or set of breakpoints in the executable.", 
+CommandObjectBreakpointModify::CommandObjectBreakpointModify (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "breakpoint modify", 
+                   "Modify the options on a breakpoint or set of breakpoints in the executable.", 
                    "breakpoint modify <cmd-options> <breakpoint-id> [<breakpoint-id> ...]")
 {
 }
@@ -1226,7 +1230,6 @@
 bool
 CommandObjectBreakpointModify::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
@@ -1238,7 +1241,7 @@
         return false;
     }
 
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
     if (target == NULL)
     {
         result.AppendError ("Invalid target, set executable file using 'file' command.");

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Fri Sep 17 20:14:36 2010
@@ -60,14 +60,13 @@
         eSetTypeFunctionRegexp
     } BreakpointSetType;
 
-    CommandObjectBreakpointSet ();
+    CommandObjectBreakpointSet (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointSet ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual Options *
@@ -127,14 +126,13 @@
 {
 public:
 
-    CommandObjectBreakpointModify ();
+    CommandObjectBreakpointModify (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointModify ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual Options *
@@ -187,14 +185,13 @@
 class CommandObjectBreakpointEnable : public CommandObject
 {
 public:
-    CommandObjectBreakpointEnable ();
+    CommandObjectBreakpointEnable (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointEnable ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 private:
@@ -207,14 +204,13 @@
 class CommandObjectBreakpointDisable : public CommandObject
 {
 public:
-    CommandObjectBreakpointDisable ();
+    CommandObjectBreakpointDisable (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointDisable ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 private:
@@ -227,14 +223,13 @@
 class CommandObjectBreakpointList : public CommandObject
 {
 public:
-    CommandObjectBreakpointList ();
+    CommandObjectBreakpointList (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointList ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual Options *
@@ -280,14 +275,13 @@
 class CommandObjectBreakpointDelete : public CommandObject
 {
 public:
-    CommandObjectBreakpointDelete ();
+    CommandObjectBreakpointDelete (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointDelete ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 private:

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Fri Sep 17 20:14:36 2010
@@ -125,8 +125,9 @@
 //-------------------------------------------------------------------------
 
 
-CommandObjectBreakpointCommandAdd::CommandObjectBreakpointCommandAdd () :
-    CommandObject ("add",
+CommandObjectBreakpointCommandAdd::CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "add",
                    "Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit.",
                    "breakpoint command add <cmd-options> <breakpoint-id>")
 {
@@ -239,12 +240,11 @@
 bool
 CommandObjectBreakpointCommandAdd::Execute 
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
 
     if (target == NULL)
     {
@@ -307,24 +307,20 @@
                 {
                     // Special handling for one-liner specified inline.
                     if (m_options.m_use_one_liner)
-                        interpreter.GetScriptInterpreter()->SetBreakpointCommandCallback (interpreter,
-                                                                                          bp_options,
-                                                                                          m_options.m_one_liner.c_str());
+                        m_interpreter.GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
+                                                                                            m_options.m_one_liner.c_str());
                     else
-                        interpreter.GetScriptInterpreter()->CollectDataForBreakpointCommandCallback (interpreter,
-                                                                                                     bp_options,
-                                                                                                     result);
+                        m_interpreter.GetScriptInterpreter()->CollectDataForBreakpointCommandCallback (bp_options,
+                                                                                                       result);
                 }
                 else
                 {
                     // Special handling for one-liner specified inline.
                     if (m_options.m_use_one_liner)
-                        SetBreakpointCommandCallback (interpreter,
-                                                      bp_options,
+                        SetBreakpointCommandCallback (bp_options,
                                                       m_options.m_one_liner.c_str());
                     else
-                        CollectDataForBreakpointCommandCallback (interpreter, 
-                                                                 bp_options, 
+                        CollectDataForBreakpointCommandCallback (bp_options, 
                                                                  result);
                 }
             }
@@ -345,12 +341,11 @@
 void
 CommandObjectBreakpointCommandAdd::CollectDataForBreakpointCommandCallback
 (
-    CommandInterpreter &interpreter,
     BreakpointOptions *bp_options,
     CommandReturnObject &result
 )
 {
-    InputReaderSP reader_sp (new InputReader(interpreter.GetDebugger()));
+    InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
     std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
     if (reader_sp && data_ap.get())
     {
@@ -365,7 +360,7 @@
                                           true));                       // echo input
         if (err.Success())
         {
-            interpreter.GetDebugger().PushInputReader (reader_sp);
+            m_interpreter.GetDebugger().PushInputReader (reader_sp);
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
         }
         else
@@ -384,8 +379,7 @@
 
 // Set a one-liner as the callback for the breakpoint.
 void
-CommandObjectBreakpointCommandAdd::SetBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                                                 BreakpointOptions *bp_options,
+CommandObjectBreakpointCommandAdd::SetBreakpointCommandCallback (BreakpointOptions *bp_options,
                                                                  const char *oneliner)
 {
     std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
@@ -460,8 +454,9 @@
 // CommandObjectBreakpointCommandRemove
 //-------------------------------------------------------------------------
 
-CommandObjectBreakpointCommandRemove::CommandObjectBreakpointCommandRemove () :
-    CommandObject ("remove",
+CommandObjectBreakpointCommandRemove::CommandObjectBreakpointCommandRemove (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "remove",
                    "Remove the set of commands from a breakpoint.",
                    "breakpoint command remove <breakpoint-id>")
 {
@@ -474,12 +469,11 @@
 bool
 CommandObjectBreakpointCommandRemove::Execute 
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
 
     if (target == NULL)
     {
@@ -546,8 +540,9 @@
 // CommandObjectBreakpointCommandList
 //-------------------------------------------------------------------------
 
-CommandObjectBreakpointCommandList::CommandObjectBreakpointCommandList () :
-    CommandObject ("List",
+CommandObjectBreakpointCommandList::CommandObjectBreakpointCommandList (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "list",
                    "List the script or set of commands to be executed when the breakpoint is hit.",
                    "breakpoint command list <breakpoint-id>")
 {
@@ -560,12 +555,11 @@
 bool
 CommandObjectBreakpointCommandList::Execute 
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
 
     if (target == NULL)
     {
@@ -663,22 +657,23 @@
 //-------------------------------------------------------------------------
 
 CommandObjectBreakpointCommand::CommandObjectBreakpointCommand (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("command",
+    CommandObjectMultiword (interpreter,
+                            "command",
                             "A set of commands for adding, removing and examining bits of code to be executed when the breakpoint is hit (breakpoint 'commmands').",
                             "command <sub-command> [<sub-command-options>] <breakpoint-id>")
 {
     bool status;
-    CommandObjectSP add_command_object (new CommandObjectBreakpointCommandAdd ());
-    CommandObjectSP remove_command_object (new CommandObjectBreakpointCommandRemove ());
-    CommandObjectSP list_command_object (new CommandObjectBreakpointCommandList ());
+    CommandObjectSP add_command_object (new CommandObjectBreakpointCommandAdd (interpreter));
+    CommandObjectSP remove_command_object (new CommandObjectBreakpointCommandRemove (interpreter));
+    CommandObjectSP list_command_object (new CommandObjectBreakpointCommandList (interpreter));
 
     add_command_object->SetCommandName ("breakpoint command add");
     remove_command_object->SetCommandName ("breakpoint command remove");
     list_command_object->SetCommandName ("breakpoint command list");
 
-    status = LoadSubCommand (interpreter, "add",    add_command_object);
-    status = LoadSubCommand (interpreter, "remove", remove_command_object);
-    status = LoadSubCommand (interpreter, "list",   list_command_object);
+    status = LoadSubCommand ("add",    add_command_object);
+    status = LoadSubCommand ("remove", remove_command_object);
+    status = LoadSubCommand ("list",   list_command_object);
 }
 
 

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h Fri Sep 17 20:14:36 2010
@@ -56,28 +56,25 @@
 {
 public:
 
-    CommandObjectBreakpointCommandAdd ();
+    CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointCommandAdd ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual Options *
     GetOptions ();
 
     void
-    CollectDataForBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                             BreakpointOptions *bp_options, 
+    CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options, 
                                              CommandReturnObject &result);
 
     /// Set a one-liner as the callback for the breakpoint.
     void 
-    SetBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                  BreakpointOptions *bp_options,
+    SetBreakpointCommandCallback (BreakpointOptions *bp_options,
                                   const char *oneliner);
 
     static size_t
@@ -138,14 +135,13 @@
 class CommandObjectBreakpointCommandRemove : public CommandObject
 {
 public:
-    CommandObjectBreakpointCommandRemove ();
+    CommandObjectBreakpointCommandRemove (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointCommandRemove ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 private:
@@ -158,14 +154,13 @@
 class CommandObjectBreakpointCommandList : public CommandObject
 {
 public:
-    CommandObjectBreakpointCommandList ();
+    CommandObjectBreakpointCommandList (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectBreakpointCommandList ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 private:

Modified: lldb/trunk/source/Commands/CommandObjectCall.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCall.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCall.cpp Fri Sep 17 20:14:36 2010
@@ -128,7 +128,6 @@
 bool
 CommandObjectCall::Execute
 (
-    CommandInterpreter &interpreter,
     Args &command,
     CommandReturnObject &result
 )

Modified: lldb/trunk/source/Commands/CommandObjectCall.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCall.h (original)
+++ lldb/trunk/source/Commands/CommandObjectCall.h Fri Sep 17 20:14:36 2010
@@ -66,8 +66,7 @@
 
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual bool

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Sep 17 20:14:36 2010
@@ -31,10 +31,11 @@
 class CommandObjectCommandsSource : public CommandObject
 {
 public:
-    CommandObjectCommandsSource() :
-        CommandObject ("commands source",
-                   "Read in debugger commands from the file <filename> and execute them.",
-                   "command source <filename>")
+    CommandObjectCommandsSource(CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "commands source",
+                       "Read in debugger commands from the file <filename> and execute them.",
+                       "command source <filename>")
     {
     }
 
@@ -45,7 +46,6 @@
     bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& args,
         CommandReturnObject &result
     )
@@ -89,8 +89,10 @@
                     size_t i;
                     for (i = 0; i<num_commands; ++i)
                     {
-                        result.GetOutputStream().Printf("%s %s\n", interpreter.GetPrompt(), commands[i].c_str());
-                        if (!interpreter.HandleCommand(commands[i].c_str(), false, result))
+                        result.GetOutputStream().Printf ("%s %s\n", 
+                                                         m_interpreter.GetPrompt(), 
+                                                         commands[i].c_str());
+                        if (!m_interpreter.HandleCommand(commands[i].c_str(), false, result))
                             break;
                     }
 
@@ -137,8 +139,9 @@
 class CommandObjectCommandsAlias : public CommandObject
 {
 public:
-    CommandObjectCommandsAlias () :
-        CommandObject ("commands alias",
+    CommandObjectCommandsAlias (CommandInterpreter &interpreter) :
+        CommandObject (interpreter, 
+                       "commands alias",
                        "Allow users to define their own debugger command abbreviations.",
                        "commands alias <new_command> <old_command> [<options-for-aliased-command>]")
     {
@@ -200,7 +203,6 @@
     bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& args,
         CommandReturnObject &result
     )
@@ -222,7 +224,7 @@
 
         // Verify that the command is alias'able, and get the appropriate command object.
 
-        if (interpreter.CommandExists (alias_command.c_str()))
+        if (m_interpreter.CommandExists (alias_command.c_str()))
         {
             result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be redefined.\n",
                                          alias_command.c_str());
@@ -230,7 +232,7 @@
         }
         else
         {
-             CommandObjectSP command_obj_sp(interpreter.GetCommandSPExact (actual_command.c_str(), true));
+             CommandObjectSP command_obj_sp(m_interpreter.GetCommandSPExact (actual_command.c_str(), true));
              CommandObjectSP subcommand_obj_sp;
              bool use_subcommand = false;
              if (command_obj_sp.get())
@@ -307,25 +309,25 @@
 
                  // Create the alias.
 
-                 if (interpreter.AliasExists (alias_command.c_str())
-                     || interpreter.UserCommandExists (alias_command.c_str()))
+                 if (m_interpreter.AliasExists (alias_command.c_str())
+                     || m_interpreter.UserCommandExists (alias_command.c_str()))
                  {
-                     OptionArgVectorSP tmp_option_arg_sp (interpreter.GetAliasOptions (alias_command.c_str()));
+                     OptionArgVectorSP tmp_option_arg_sp (m_interpreter.GetAliasOptions (alias_command.c_str()));
                      if (tmp_option_arg_sp.get())
                      {
                          if (option_arg_vector->size() == 0)
-                             interpreter.RemoveAliasOptions (alias_command.c_str());
+                             m_interpreter.RemoveAliasOptions (alias_command.c_str());
                      }
                      result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", 
                                                      alias_command.c_str());
                  }
 
                  if (use_subcommand)
-                     interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp);
+                     m_interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp);
                  else
-                     interpreter.AddAlias (alias_command.c_str(), command_obj_sp);
+                     m_interpreter.AddAlias (alias_command.c_str(), command_obj_sp);
                  if (option_arg_vector->size() > 0)
-                     interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp);
+                     m_interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp);
                  result.SetStatus (eReturnStatusSuccessFinishNoResult);
              }
              else
@@ -347,8 +349,9 @@
 class CommandObjectCommandsUnalias : public CommandObject
 {
 public:
-    CommandObjectCommandsUnalias () :
-        CommandObject ("commands unalias",
+    CommandObjectCommandsUnalias (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "commands unalias",
                        "Allow the user to remove/delete a user-defined command abbreviation.",
                        "unalias <alias-name-to-be-removed>")
     {
@@ -362,7 +365,6 @@
     bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& args,
         CommandReturnObject &result
     )
@@ -373,10 +375,10 @@
         if (args.GetArgumentCount() != 0)
         {
             const char *command_name = args.GetArgumentAtIndex(0);
-            cmd_obj = interpreter.GetCommandObject(command_name);
+            cmd_obj = m_interpreter.GetCommandObject(command_name);
             if (cmd_obj)
             {
-                if (interpreter.CommandExists (command_name))
+                if (m_interpreter.CommandExists (command_name))
                 {
                     result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be removed.\n",
                                                   command_name);
@@ -385,9 +387,9 @@
                 else
                 {
 
-                    if (interpreter.RemoveAlias (command_name) == false)
+                    if (m_interpreter.RemoveAlias (command_name) == false)
                     {
-                        if (interpreter.AliasExists (command_name))
+                        if (m_interpreter.AliasExists (command_name))
                             result.AppendErrorWithFormat ("Error occurred while attempting to unalias '%s'.\n", 
                                                           command_name);
                         else
@@ -423,13 +425,14 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMultiwordCommands::CommandObjectMultiwordCommands (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("commands",
+    CommandObjectMultiword (interpreter,
+                            "commands",
                             "A set of commands for managing or customizing the debugger commands.",
                             "commands <subcommand> [<subcommand-options>]")
 {
-    LoadSubCommand (interpreter, "source",   CommandObjectSP (new CommandObjectCommandsSource ()));
-    LoadSubCommand (interpreter, "alias",   CommandObjectSP (new CommandObjectCommandsAlias ()));
-    LoadSubCommand (interpreter, "unalias", CommandObjectSP (new CommandObjectCommandsUnalias ()));
+    LoadSubCommand ("source",  CommandObjectSP (new CommandObjectCommandsSource (interpreter)));
+    LoadSubCommand ("alias",   CommandObjectSP (new CommandObjectCommandsAlias (interpreter)));
+    LoadSubCommand ("unalias", CommandObjectSP (new CommandObjectCommandsUnalias (interpreter)));
 }
 
 CommandObjectMultiwordCommands::~CommandObjectMultiwordCommands ()

Modified: lldb/trunk/source/Commands/CommandObjectCrossref.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCrossref.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCrossref.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCrossref.cpp Fri Sep 17 20:14:36 2010
@@ -24,11 +24,12 @@
 
 CommandObjectCrossref::CommandObjectCrossref
 (
+    CommandInterpreter &interpreter,
     const char *name,
     const char *help,
     const char *syntax
 ) :
-    CommandObject (name, help, syntax),
+    CommandObject (interpreter, name, help, syntax),
     m_crossref_object_types()
 {
 }
@@ -40,7 +41,6 @@
 bool
 CommandObjectCrossref::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Fri Sep 17 20:14:36 2010
@@ -141,10 +141,11 @@
 // CommandObjectDisassemble
 //-------------------------------------------------------------------------
 
-CommandObjectDisassemble::CommandObjectDisassemble () :
-    CommandObject ("disassemble",
-                     "Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
-                     "disassemble [<cmd-options>]")
+CommandObjectDisassemble::CommandObjectDisassemble (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "disassemble",
+                   "Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
+                   "disassemble [<cmd-options>]")
 {
 }
 
@@ -155,12 +156,11 @@
 bool
 CommandObjectDisassemble::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
 {
-    Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
     if (target == NULL)
     {
         result.AppendError ("invalid target, set executable file using 'file' command");
@@ -189,11 +189,15 @@
 
     if (command.GetArgumentCount() != 0)
     {
-        result.AppendErrorWithFormat ("\"disassemble\" doesn't take any arguments.\n");
+        result.AppendErrorWithFormat ("\"disassemble\" arguments are specified as options.\n");
+        GetOptions()->GenerateOptionUsage (m_interpreter,
+                                           result.GetErrorStream(), 
+                                           this);
+
         result.SetStatus (eReturnStatusFailed);
         return false;
     }
-    ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+    ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
 
     if (m_options.show_mixed && m_options.num_lines_context == 0)
         m_options.num_lines_context = 1;
@@ -202,7 +206,7 @@
     {
         ConstString name(m_options.m_func_name.c_str());
         
-        if (Disassembler::Disassemble (interpreter.GetDebugger(), 
+        if (Disassembler::Disassemble (m_interpreter.GetDebugger(), 
                                        arch,
                                        exe_ctx,
                                        name,
@@ -260,7 +264,7 @@
         if (range.GetByteSize() == 0)
             range.SetByteSize(DEFAULT_DISASM_BYTE_SIZE);
 
-        if (Disassembler::Disassemble (interpreter.GetDebugger(), 
+        if (Disassembler::Disassemble (m_interpreter.GetDebugger(), 
                                        arch,
                                        exe_ctx,
                                        range,

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.h (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.h Fri Sep 17 20:14:36 2010
@@ -54,7 +54,7 @@
         static lldb::OptionDefinition g_option_table[];
     };
 
-    CommandObjectDisassemble ();
+    CommandObjectDisassemble (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectDisassemble ();
@@ -67,8 +67,7 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 protected:

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Sep 17 20:14:36 2010
@@ -95,12 +95,12 @@
     return g_option_table;
 }
 
-CommandObjectExpression::CommandObjectExpression () :
-    CommandObject (
-            "expression",
-            "Evaluate an Objective-C++ expression in the current program context, using variables currently in scope.",
-            "expression [<cmd-options>] <expr>"),
-    m_expr_line_count (0),
+CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "expression",
+                   "Evaluate an Objective-C++ expression in the current program context, using variables currently in scope.",
+                   "expression [<cmd-options>] <expr>"),
+m_expr_line_count (0),
     m_expr_lines ()
 {
   SetHelpLong(
@@ -125,7 +125,6 @@
 bool
 CommandObjectExpression::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
@@ -259,12 +258,11 @@
 bool
 CommandObjectExpression::ExecuteRawCommandString
 (
-    CommandInterpreter &interpreter,
     const char *command,
     CommandReturnObject &result
 )
 {
-    m_exe_ctx = interpreter.GetDebugger().GetExecutionContext();
+    m_exe_ctx = m_interpreter.GetDebugger().GetExecutionContext();
 
     m_options.ResetOptionValues();
 
@@ -275,7 +273,7 @@
         m_expr_lines.clear();
         m_expr_line_count = 0;
         
-        InputReaderSP reader_sp (new InputReader(interpreter.GetDebugger()));
+        InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
         if (reader_sp)
         {
             Error err (reader_sp->Initialize (CommandObjectExpression::MultiLineExpressionCallback,
@@ -286,7 +284,7 @@
                                               true));                       // echo input
             if (err.Success())
             {
-                interpreter.GetDebugger().PushInputReader (reader_sp);
+                m_interpreter.GetDebugger().PushInputReader (reader_sp);
                 result.SetStatus (eReturnStatusSuccessFinishNoResult);
             }
             else
@@ -328,7 +326,7 @@
         if (end_options)
         {
             Args args (command, end_options - command);
-            if (!ParseOptions (interpreter, args, result))
+            if (!ParseOptions (args, result))
                 return false;
         }
     }

Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Sep 17 20:14:36 2010
@@ -54,7 +54,7 @@
         bool        show_summary;
     };
 
-    CommandObjectExpression ();
+    CommandObjectExpression (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectExpression ();
@@ -65,16 +65,14 @@
 
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual bool
     WantsRawCommandString() { return true; }
 
     virtual bool
-    ExecuteRawCommandString (CommandInterpreter &interpreter,
-                             const char *command,
+    ExecuteRawCommandString (const char *command,
                              CommandReturnObject &result);
 
 protected:

Modified: lldb/trunk/source/Commands/CommandObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFile.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFile.cpp Fri Sep 17 20:14:36 2010
@@ -85,8 +85,9 @@
 // CommandObjectFile
 //-------------------------------------------------------------------------
 
-CommandObjectFile::CommandObjectFile() :
-    CommandObject ("file",
+CommandObjectFile::CommandObjectFile(CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "file",
                    "Set the file to be used as the main executable by the debugger.",
                    "file [<cmd-options>] <filename>")
 {
@@ -105,7 +106,6 @@
 bool
 CommandObjectFile::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
@@ -127,7 +127,7 @@
         TargetSP target_sp;
 
         ArchSpec arch = m_options.m_arch;
-        Debugger &debugger = interpreter.GetDebugger();
+        Debugger &debugger = m_interpreter.GetDebugger();
         Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, m_options.m_arch, NULL, true, target_sp);
 
         if (target_sp)
@@ -152,27 +152,28 @@
 }
 
 int
-CommandObjectFile::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
-                              int &cursor_index,
-                              int &cursor_char_position,
-                              OptionElementVector &opt_element_vector,
-                              int match_start_point,
-                              int max_return_elements,
-                              bool &word_complete,
-                              StringList &matches)
+CommandObjectFile::HandleArgumentCompletion 
+(
+    Args &input,
+    int &cursor_index,
+    int &cursor_char_position,
+    OptionElementVector &opt_element_vector,
+    int match_start_point,
+    int max_return_elements,
+    bool &word_complete,
+    StringList &matches
+)
 {
-        std::string completion_str (input.GetArgumentAtIndex(cursor_index));
-        completion_str.erase (cursor_char_position);
+    std::string completion_str (input.GetArgumentAtIndex(cursor_index));
+    completion_str.erase (cursor_char_position);
 
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter, 
-                                                             CommandCompletions::eDiskFileCompletion,
-                                                             completion_str.c_str(),
-                                                             match_start_point,
-                                                             max_return_elements,
-                                                             NULL,
-                                                             word_complete,
-                                                             matches);
-        return matches.GetSize();
-    
+    CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, 
+                                                         CommandCompletions::eDiskFileCompletion,
+                                                         completion_str.c_str(),
+                                                         match_start_point,
+                                                         max_return_elements,
+                                                         NULL,
+                                                         word_complete,
+                                                         matches);
+    return matches.GetSize();
 }

Modified: lldb/trunk/source/Commands/CommandObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFile.h (original)
+++ lldb/trunk/source/Commands/CommandObjectFile.h Fri Sep 17 20:14:36 2010
@@ -28,14 +28,13 @@
 {
 public:
 
-    CommandObjectFile ();
+    CommandObjectFile (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectFile ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual Options *
@@ -69,8 +68,7 @@
     };
     
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Fri Sep 17 20:14:36 2010
@@ -51,11 +51,12 @@
 {
 public:
 
-    CommandObjectFrameInfo () :
-    CommandObject ("frame info",
-                   "List information about the currently selected frame in the current thread.",
-                   "frame info",
-                   eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+    CommandObjectFrameInfo (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "frame info",
+                       "List information about the currently selected frame in the current thread.",
+                       "frame info",
+                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
     {
     }
 
@@ -64,11 +65,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
         if (exe_ctx.frame)
         {
             exe_ctx.frame->Dump (&result.GetOutputStream(), true, false);
@@ -94,12 +94,12 @@
 {
 public:
 
-    CommandObjectFrameSelect () :
-    CommandObject ("frame select",
-                   //"Select the current frame by index in the current thread.",
-                   "Select a frame by index from within the current thread and make it the current frame.",
-                   "frame select <frame-index>",
-                   eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+    CommandObjectFrameSelect (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "frame select",
+                       "Select a frame by index from within the current thread and make it the current frame.",
+                       "frame select <frame-index>",
+                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
     {
     }
 
@@ -108,11 +108,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        ExecutionContext exe_ctx (interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx (m_interpreter.GetDebugger().GetExecutionContext());
         if (exe_ctx.thread)
         {
             if (command.GetArgumentCount() == 1)
@@ -130,14 +129,14 @@
                     {
                         bool already_shown = false;
                         SymbolContext frame_sc(exe_ctx.frame->GetSymbolContext(eSymbolContextLineEntry));
-                        if (interpreter.GetDebugger().UseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
+                        if (m_interpreter.GetDebugger().UseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
                         {
                             already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
                         }
 
                         if (DisplayFrameForExecutionContext (exe_ctx.thread,
                                                              exe_ctx.frame,
-                                                             interpreter,
+                                                             m_interpreter,
                                                              result.GetOutputStream(),
                                                              true,
                                                              !already_shown,
@@ -288,11 +287,11 @@
         // Instance variables to hold the values for command options.
     };
 
-    CommandObjectFrameVariable () :
-        CommandObject (
-                "frame variable",
-                "Show specified argument, local variable, static variable or global variable for the current frame.  If none specified, list them all.",
-                "frame variable [<cmd-options>] [<var-name1> [<var-name2>...]]")
+    CommandObjectFrameVariable (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "frame variable",
+                       "Show specified argument, local variable, static variable or global variable for the current frame.  If none specified, list them all.",
+                       "frame variable [<cmd-options>] [<var-name1> [<var-name2>...]]")
     {
     }
 
@@ -431,12 +430,11 @@
     virtual bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
-        ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
         if (exe_ctx.frame == NULL)
         {
             result.AppendError ("invalid frame");
@@ -789,13 +787,14 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMultiwordFrame::CommandObjectMultiwordFrame (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("frame",
+    CommandObjectMultiword (interpreter,
+                            "frame",
                             "A set of commands for operating on the current thread's frames.",
                             "frame <subcommand> [<subcommand-options>]")
 {
-    LoadSubCommand (interpreter, "info",   CommandObjectSP (new CommandObjectFrameInfo ()));
-    LoadSubCommand (interpreter, "select", CommandObjectSP (new CommandObjectFrameSelect ()));
-    LoadSubCommand (interpreter, "variable", CommandObjectSP (new CommandObjectFrameVariable ()));
+    LoadSubCommand ("info",   CommandObjectSP (new CommandObjectFrameInfo (interpreter)));
+    LoadSubCommand ("select", CommandObjectSP (new CommandObjectFrameSelect (interpreter)));
+    LoadSubCommand ("variable", CommandObjectSP (new CommandObjectFrameVariable (interpreter)));
 }
 
 CommandObjectMultiwordFrame::~CommandObjectMultiwordFrame ()

Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Fri Sep 17 20:14:36 2010
@@ -25,8 +25,9 @@
 // CommandObjectHelp
 //-------------------------------------------------------------------------
 
-CommandObjectHelp::CommandObjectHelp () :
-    CommandObject ("help",
+CommandObjectHelp::CommandObjectHelp (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "help",
                    "Show a list of all debugger commands, or give details about specific commands.",
                    "help [<cmd-name>]")
 {
@@ -38,7 +39,7 @@
 
 
 bool
-CommandObjectHelp::Execute (CommandInterpreter &interpreter, Args& command, CommandReturnObject &result)
+CommandObjectHelp::Execute (Args& command, CommandReturnObject &result)
 {
     CommandObject::CommandMap::iterator pos;
     CommandObject *cmd_obj;
@@ -49,13 +50,13 @@
     if (argc == 0)
     {
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        interpreter.GetHelp (result);  // General help, for ALL commands.
+        m_interpreter.GetHelp (result);  // General help, for ALL commands.
     }
     else
     {
         // Get command object for the first command argument. Only search built-in command dictionary.
         StringList matches;
-        cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches);
+        cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches);
         
         if (cmd_obj != NULL)
         {
@@ -94,10 +95,9 @@
                 Stream &output_strm = result.GetOutputStream();
                 if (sub_cmd_obj->GetOptions() != NULL)
                 {
-                    interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
+                    m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
                     output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
-                    sub_cmd_obj->GetOptions()->GenerateOptionUsage (output_strm, sub_cmd_obj,
-                                                                    interpreter.GetDebugger().GetInstanceName().AsCString());
+                    sub_cmd_obj->GetOptions()->GenerateOptionUsage (m_interpreter, output_strm, sub_cmd_obj);
                     const char *long_help = sub_cmd_obj->GetHelpLong();
                     if ((long_help != NULL)
                         && (strlen (long_help) > 0))
@@ -105,8 +105,8 @@
                 }
                 else if (sub_cmd_obj->IsMultiwordObject())
                 {
-                    interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
-                    ((CommandObjectMultiword *) sub_cmd_obj)->GenerateHelpText (interpreter, result);
+                    m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
+                    ((CommandObjectMultiword *) sub_cmd_obj)->GenerateHelpText (result);
                 }
                 else
                 {
@@ -115,7 +115,7 @@
                         && (strlen (long_help) > 0))
                         output_strm.Printf ("\n%s", long_help);
                     else
-                        interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
+                        m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1);
                     output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
                 }
             }
@@ -145,7 +145,6 @@
 int
 CommandObjectHelp::HandleCompletion
 (
-    CommandInterpreter &interpreter,
     Args &input,
     int &cursor_index,
     int &cursor_char_position,
@@ -158,15 +157,25 @@
     // Return the completions of the commands in the help system:
     if (cursor_index == 0)
     {
-        return interpreter.HandleCompletionMatches(input, cursor_index, cursor_char_position, match_start_point, 
-                                                   max_return_elements, word_complete, matches);
+        return m_interpreter.HandleCompletionMatches (input, 
+                                                    cursor_index, 
+                                                    cursor_char_position, 
+                                                    match_start_point, 
+                                                    max_return_elements, 
+                                                    word_complete, 
+                                                    matches);
     }
     else
     {
-        CommandObject *cmd_obj = interpreter.GetCommandObject (input.GetArgumentAtIndex(0));
+        CommandObject *cmd_obj = m_interpreter.GetCommandObject (input.GetArgumentAtIndex(0));
         input.Shift();
         cursor_index--;
-        return cmd_obj->HandleCompletion (interpreter, input, cursor_index, cursor_char_position, match_start_point, 
-                                          max_return_elements, word_complete, matches);
+        return cmd_obj->HandleCompletion (input, 
+                                          cursor_index, 
+                                          cursor_char_position, 
+                                          match_start_point, 
+                                          max_return_elements, 
+                                          word_complete, 
+                                          matches);
     }
 }

Modified: lldb/trunk/source/Commands/CommandObjectHelp.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.h (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.h Fri Sep 17 20:14:36 2010
@@ -26,19 +26,17 @@
 {
 public:
 
-    CommandObjectHelp ();
+    CommandObjectHelp (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectHelp ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleCompletion (CommandInterpreter &interpreter,
-                      Args &input,
+    HandleCompletion (Args &input,
                       int &cursor_index,
                       int &cursor_char_position,
                       int match_start_point,

Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.cpp Fri Sep 17 20:14:36 2010
@@ -476,10 +476,11 @@
 {
 public:
 
-    CommandObjectImageDumpModuleList (const char *name,
+    CommandObjectImageDumpModuleList (CommandInterpreter &interpreter,
+                                      const char *name,
                                       const char *help,
                                       const char *syntax) :
-        CommandObject (name, help, syntax)
+        CommandObject (interpreter, name, help, syntax)
     {
     }
 
@@ -489,8 +490,7 @@
     }
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -503,7 +503,7 @@
         std::string completion_str (input.GetArgumentAtIndex(cursor_index));
         completion_str.erase (cursor_char_position);
 
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eModuleCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -519,10 +519,11 @@
 {
 public:
 
-    CommandObjectImageDumpSourceFileList (const char *name,
+    CommandObjectImageDumpSourceFileList (CommandInterpreter &interpreter,
+                                          const char *name,
                                           const char *help,
                                           const char *syntax) :
-        CommandObject (name, help, syntax)
+        CommandObject (interpreter, name, help, syntax)
     {
     }
 
@@ -532,8 +533,7 @@
     }
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -546,7 +546,7 @@
         std::string completion_str (input.GetArgumentAtIndex(cursor_index));
         completion_str.erase (cursor_char_position);
 
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter, 
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, 
                                                              CommandCompletions::eSourceFileCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -562,10 +562,11 @@
 class CommandObjectImageDumpSymtab : public CommandObjectImageDumpModuleList
 {
 public:
-    CommandObjectImageDumpSymtab () :
-        CommandObjectImageDumpModuleList ("image dump symtab",
-                         "Dump the symbol table from one or more executable images.",
-                         "image dump symtab [<file1> ...]")
+    CommandObjectImageDumpSymtab (CommandInterpreter &interpreter) :
+        CommandObjectImageDumpModuleList (interpreter,
+                                          "image dump symtab",
+                                          "Dump the symbol table from one or more executable images.",
+                                          "image dump symtab [<file1> ...]")
     {
     }
 
@@ -575,11 +576,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target == NULL)
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
@@ -604,7 +604,7 @@
                     for (uint32_t image_idx = 0;  image_idx<num_modules; ++image_idx)
                     {
                         num_dumped++;
-                        DumpModuleSymtab (interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
+                        DumpModuleSymtab (m_interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
                     }
                 }
                 else
@@ -642,7 +642,7 @@
                             if (image_module)
                             {
                                 num_dumped++;
-                                DumpModuleSymtab (interpreter, result.GetOutputStream(), image_module);
+                                DumpModuleSymtab (m_interpreter, result.GetOutputStream(), image_module);
                             }
                         }
                     }
@@ -670,8 +670,9 @@
 class CommandObjectImageDumpSections : public CommandObjectImageDumpModuleList
 {
 public:
-    CommandObjectImageDumpSections () :
-        CommandObjectImageDumpModuleList ("image dump sections",
+    CommandObjectImageDumpSections (CommandInterpreter &interpreter) :
+        CommandObjectImageDumpModuleList (interpreter,
+                                          "image dump sections",
                                           "Dump the sections from one or more executable images.",
                                           "image dump sections [<file1> ...]")
     {
@@ -683,11 +684,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target == NULL)
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
@@ -712,7 +712,7 @@
                     for (uint32_t image_idx = 0;  image_idx<num_modules; ++image_idx)
                     {
                         num_dumped++;
-                        DumpModuleSections (interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
+                        DumpModuleSections (m_interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
                     }
                 }
                 else
@@ -750,7 +750,7 @@
                             if (image_module)
                             {
                                 num_dumped++;
-                                DumpModuleSections (interpreter, result.GetOutputStream(), image_module);
+                                DumpModuleSections (m_interpreter, result.GetOutputStream(), image_module);
                             }
                         }
                     }
@@ -777,10 +777,11 @@
 class CommandObjectImageDumpSymfile : public CommandObjectImageDumpModuleList
 {
 public:
-    CommandObjectImageDumpSymfile () :
-        CommandObjectImageDumpModuleList ("image dump symfile",
-                         "Dump the debug symbol file for one or more executable images.",
-                         "image dump symfile [<file1> ...]")
+    CommandObjectImageDumpSymfile (CommandInterpreter &interpreter) :
+        CommandObjectImageDumpModuleList (interpreter,
+                                          "image dump symfile",
+                                          "Dump the debug symbol file for one or more executable images.",
+                                          "image dump symfile [<file1> ...]")
     {
     }
 
@@ -790,11 +791,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target == NULL)
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
@@ -884,10 +884,11 @@
 class CommandObjectImageDumpLineTable : public CommandObjectImageDumpSourceFileList
 {
 public:
-    CommandObjectImageDumpLineTable () :
-        CommandObjectImageDumpSourceFileList ("image dump line-table",
-                         "Dump the debug symbol file for one or more executable images.",
-                         "image dump line-table <source-file1> [<source-file2> ...]")
+    CommandObjectImageDumpLineTable (CommandInterpreter &interpreter) :
+        CommandObjectImageDumpSourceFileList (interpreter,
+                                              "image dump line-table",
+                                              "Dump the debug symbol file for one or more executable images.",
+                                              "image dump line-table <source-file1> [<source-file2> ...]")
     {
     }
 
@@ -897,11 +898,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target == NULL)
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
@@ -910,7 +910,7 @@
         }
         else
         {
-            ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+            ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
             uint32_t total_num_dumped = 0;
 
             uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
@@ -935,7 +935,7 @@
                         uint32_t num_dumped = 0;
                         for (uint32_t i = 0; i<num_modules; ++i)
                         {
-                            if (DumpCompileUnitLineTable (interpreter,
+                            if (DumpCompileUnitLineTable (m_interpreter,
                                                           result.GetOutputStream(),
                                                           target->GetImages().GetModulePointerAtIndex(i),
                                                           file_spec,
@@ -973,14 +973,15 @@
     // Constructors and Destructors
     //------------------------------------------------------------------
     CommandObjectImageDump(CommandInterpreter &interpreter) :
-        CommandObjectMultiword ("image dump",
+        CommandObjectMultiword (interpreter, 
+                                "image dump",
                                 "A set of commands for dumping information about one or more executable images; 'line-table' expects a source file name",
                                 "image dump [symtab|sections|symfile|line-table] [<file1> <file2> ...]")
     {
-        LoadSubCommand (interpreter, "symtab",      CommandObjectSP (new CommandObjectImageDumpSymtab ()));
-        LoadSubCommand (interpreter, "sections",    CommandObjectSP (new CommandObjectImageDumpSections ()));
-        LoadSubCommand (interpreter, "symfile",     CommandObjectSP (new CommandObjectImageDumpSymfile ()));
-        LoadSubCommand (interpreter, "line-table",  CommandObjectSP (new CommandObjectImageDumpLineTable ()));
+        LoadSubCommand ("symtab",      CommandObjectSP (new CommandObjectImageDumpSymtab (interpreter)));
+        LoadSubCommand ("sections",    CommandObjectSP (new CommandObjectImageDumpSections (interpreter)));
+        LoadSubCommand ("symfile",     CommandObjectSP (new CommandObjectImageDumpSymfile (interpreter)));
+        LoadSubCommand ("line-table",  CommandObjectSP (new CommandObjectImageDumpLineTable (interpreter)));
     }
 
     virtual
@@ -1045,11 +1046,11 @@
         FormatWidthCollection m_format_array;
     };
 
-    CommandObjectImageList () :
-        CommandObject (
-                "image list",
-                "List current executable and dependent shared library images.",
-                "image list [<cmd-options>]")
+    CommandObjectImageList (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "image list",
+                       "List current executable and dependent shared library images.",
+                       "image list [<cmd-options>]")
     {
     }
 
@@ -1066,11 +1067,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target == NULL)
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
@@ -1322,11 +1322,11 @@
 
     };
 
-    CommandObjectImageLookup () :
-        CommandObject (
-                "image lookup",
-                "Look up information within executable and dependent shared library images.",
-                "image lookup [<cmd-options>] [<file1>...]")
+    CommandObjectImageLookup (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "image lookup",
+                       "Look up information within executable and dependent shared library images.",
+                       "image lookup [<cmd-options>] [<file1>...]")
     {
     }
 
@@ -1351,7 +1351,7 @@
         case eLookupTypeAddress:
             if (m_options.m_addr != LLDB_INVALID_ADDRESS)
             {
-                if (LookupAddressInModule (interpreter, 
+                if (LookupAddressInModule (m_interpreter, 
                                            result.GetOutputStream(), 
                                            module, 
                                            eSymbolContextEverything, 
@@ -1368,7 +1368,7 @@
         case eLookupTypeSymbol:
             if (!m_options.m_str.empty())
             {
-                if (LookupSymbolInModule (interpreter, result.GetOutputStream(), module, m_options.m_str.c_str(), m_options.m_use_regex))
+                if (LookupSymbolInModule (m_interpreter, result.GetOutputStream(), module, m_options.m_str.c_str(), m_options.m_use_regex))
                 {
                     result.SetStatus(eReturnStatusSuccessFinishResult);
                     return true;
@@ -1380,7 +1380,7 @@
             if (m_options.m_file)
             {
 
-                if (LookupFileAndLineInModule (interpreter,
+                if (LookupFileAndLineInModule (m_interpreter,
                                                result.GetOutputStream(),
                                                module,
                                                m_options.m_file,
@@ -1396,7 +1396,7 @@
         case eLookupTypeFunction:
             if (!m_options.m_str.empty())
             {
-                if (LookupFunctionInModule (interpreter,
+                if (LookupFunctionInModule (m_interpreter,
                                             result.GetOutputStream(),
                                             module,
                                             m_options.m_str.c_str(),
@@ -1411,7 +1411,7 @@
         case eLookupTypeType:
             if (!m_options.m_str.empty())
             {
-                if (LookupTypeInModule (interpreter,
+                if (LookupTypeInModule (m_interpreter,
                                         result.GetOutputStream(),
                                         module,
                                         m_options.m_str.c_str(),
@@ -1424,7 +1424,7 @@
             break;
 
         default:
-            m_options.GenerateOptionUsage (result.GetErrorStream(), this, interpreter.GetDebugger().GetInstanceName().AsCString());
+            m_options.GenerateOptionUsage (m_interpreter, result.GetErrorStream(), this);
             syntax_error = true;
             break;
         }
@@ -1434,11 +1434,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target == NULL)
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
@@ -1463,7 +1462,7 @@
                 {
                     for (i = 0; i<num_modules && syntax_error == false; ++i)
                     {
-                        if (LookupInModule (interpreter, target->GetImages().GetModulePointerAtIndex(i), result, syntax_error))
+                        if (LookupInModule (m_interpreter, target->GetImages().GetModulePointerAtIndex(i), result, syntax_error))
                         {
                             result.GetOutputStream().EOL();
                             num_successful_lookups++;
@@ -1504,7 +1503,7 @@
                             Module * image_module = matching_modules.GetModulePointerAtIndex(j);
                             if (image_module)
                             {
-                                if (LookupInModule (interpreter, image_module, result, syntax_error))
+                                if (LookupInModule (m_interpreter, image_module, result, syntax_error))
                                 {
                                     result.GetOutputStream().EOL();
                                     num_successful_lookups++;
@@ -1553,13 +1552,14 @@
 // CommandObjectImage constructor
 //----------------------------------------------------------------------
 CommandObjectImage::CommandObjectImage(CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("image",
+    CommandObjectMultiword (interpreter,
+                            "image",
                             "A set of commands for accessing information for one or more executable images.",
                             "image <sub-command> ...")
 {
-    LoadSubCommand (interpreter, "dump",    CommandObjectSP (new CommandObjectImageDump (interpreter)));
-    LoadSubCommand (interpreter, "list",    CommandObjectSP (new CommandObjectImageList ()));
-    LoadSubCommand (interpreter, "lookup",  CommandObjectSP (new CommandObjectImageLookup ()));
+    LoadSubCommand ("dump",    CommandObjectSP (new CommandObjectImageDump (interpreter)));
+    LoadSubCommand ("list",    CommandObjectSP (new CommandObjectImageList (interpreter)));
+    LoadSubCommand ("lookup",  CommandObjectSP (new CommandObjectImageLookup (interpreter)));
 }
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Fri Sep 17 20:14:36 2010
@@ -58,8 +58,9 @@
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    CommandObjectLogEnable() :
-        CommandObject ("log enable",
+    CommandObjectLogEnable(CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "log enable",
                        "Enable logging for a single log channel.",
                        "log enable [<cmd-options>] <channel>")
     {
@@ -77,8 +78,7 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter, 
-             Args& args,
+    Execute (Args& args,
              CommandReturnObject &result)
     {
         if (args.GetArgumentCount() < 1)
@@ -95,7 +95,7 @@
 
             if (m_options.log_file.empty())
             {
-                log_stream_sp.reset(new StreamFile(interpreter.GetDebugger().GetOutputFileHandle()));
+                log_stream_sp.reset(new StreamFile(m_interpreter.GetDebugger().GetOutputFileHandle()));
             }
             else
             {
@@ -234,10 +234,11 @@
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    CommandObjectLogDisable() :
-        CommandObject ("log disable",
-                        "Disable one or more log channels.",
-                        "log disable <channel> [<channel> ...]")
+    CommandObjectLogDisable(CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "log disable",
+                       "Disable one or more log channels.",
+                       "log disable <channel> [<channel> ...]")
     {
     }
 
@@ -247,8 +248,7 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter, 
-             Args& args,
+    Execute (Args& args,
              CommandReturnObject &result)
     {
         const size_t argc = args.GetArgumentCount();
@@ -295,8 +295,9 @@
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    CommandObjectLogList() :
-        CommandObject ("log list",
+    CommandObjectLogList(CommandInterpreter &interpreter) :
+        CommandObject (interpreter, 
+                       "log list",
                        "List the log categories for one or more log channels.",
                        "log list <channel> [<channel> ...]")
     {
@@ -308,8 +309,7 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter, 
-             Args& args,
+    Execute (Args& args,
              CommandReturnObject &result)
     {
         const size_t argc = args.GetArgumentCount();
@@ -358,8 +358,9 @@
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    CommandObjectLogTimer() :
-        CommandObject ("log timers",
+    CommandObjectLogTimer(CommandInterpreter &interpreter) :
+        CommandObject (interpreter, 
+                       "log timers",
                        "Enable, disable, dump, and reset LLDB internal performance timers.",
                        "log timers < enable | disable | dump | reset >")
     {
@@ -371,8 +372,7 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter, 
-             Args& args,
+    Execute (Args& args,
              CommandReturnObject &result)
     {
         const size_t argc = args.GetArgumentCount();
@@ -418,14 +418,15 @@
 // CommandObjectLog constructor
 //----------------------------------------------------------------------
 CommandObjectLog::CommandObjectLog(CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("log",
+    CommandObjectMultiword (interpreter,
+                            "log",
                             "A set of commands for operating on logs.",
                             "log <command> [<command-options>]")
 {
-    LoadSubCommand (interpreter, "enable",  CommandObjectSP (new CommandObjectLogEnable));
-    LoadSubCommand (interpreter, "disable", CommandObjectSP (new CommandObjectLogDisable));
-    LoadSubCommand (interpreter, "list",    CommandObjectSP (new CommandObjectLogList));
-    LoadSubCommand (interpreter, "timers",  CommandObjectSP (new CommandObjectLogTimer));
+    LoadSubCommand ("enable",  CommandObjectSP (new CommandObjectLogEnable (interpreter)));
+    LoadSubCommand ("disable", CommandObjectSP (new CommandObjectLogDisable (interpreter)));
+    LoadSubCommand ("list",    CommandObjectSP (new CommandObjectLogList (interpreter)));
+    LoadSubCommand ("timers",  CommandObjectSP (new CommandObjectLogTimer (interpreter)));
 }
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Sep 17 20:14:36 2010
@@ -176,8 +176,9 @@
         uint32_t m_num_per_line;
     };
 
-    CommandObjectMemoryRead () :
-        CommandObject ("memory read",
+    CommandObjectMemoryRead (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "memory read",
                        "Read from the memory of the process being debugged.",
                        "memory read [<cmd-options>] <start-addr> [<end-addr>]",
                        eFlagProcessMustBeLaunched)
@@ -196,11 +197,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError("need a process to read memory");
@@ -394,8 +394,9 @@
         uint32_t m_byte_size;
     };
 
-    CommandObjectMemoryWrite () :
-        CommandObject ("memory write",
+    CommandObjectMemoryWrite (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "memory write",
                        "Write to the memory of the process being debugged.",
                        "memory write [<cmd-options>] <addr> [value1 value2 ...]",
                        eFlagProcessMustBeLaunched)
@@ -441,11 +442,10 @@
     }
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError("need a process to read memory");
@@ -677,12 +677,13 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMemory::CommandObjectMemory (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("memory",
+    CommandObjectMultiword (interpreter,
+                            "memory",
                             "A set of commands for operating on memory.",
                             "memory <subcommand> [<subcommand-options>]")
 {
-    LoadSubCommand (interpreter, "read",  CommandObjectSP (new CommandObjectMemoryRead ()));
-    LoadSubCommand (interpreter, "write", CommandObjectSP (new CommandObjectMemoryWrite ()));
+    LoadSubCommand ("read",  CommandObjectSP (new CommandObjectMemoryRead (interpreter)));
+    LoadSubCommand ("write", CommandObjectSP (new CommandObjectMemoryWrite (interpreter)));
 }
 
 CommandObjectMemory::~CommandObjectMemory ()

Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Fri Sep 17 20:14:36 2010
@@ -26,12 +26,13 @@
 
 CommandObjectMultiword::CommandObjectMultiword
 (
+    CommandInterpreter &interpreter,
     const char *name,
     const char *help,
     const char *syntax,
     uint32_t flags
 ) :
-    CommandObject (name, help, syntax, flags)
+    CommandObject (interpreter, name, help, syntax, flags)
 {
 }
 
@@ -82,7 +83,6 @@
 bool
 CommandObjectMultiword::LoadSubCommand 
 (
-    CommandInterpreter &interpreter, 
     const char *name,
     const CommandObjectSP& cmd_obj
 )
@@ -94,7 +94,7 @@
     if (pos == m_subcommand_dict.end())
     {
         m_subcommand_dict[name] = cmd_obj;
-        interpreter.CrossRegisterCommand (name, GetCommandName());
+        m_interpreter.CrossRegisterCommand (name, GetCommandName());
     }
     else
         success = false;
@@ -105,7 +105,6 @@
 bool
 CommandObjectMultiword::Execute
 (
-    CommandInterpreter &interpreter,
     Args& args,
     CommandReturnObject &result
 )
@@ -113,7 +112,7 @@
     const size_t argc = args.GetArgumentCount();
     if (argc == 0)
     {
-        GenerateHelpText (interpreter, result);
+        GenerateHelpText (result);
     }
     else
     {
@@ -123,7 +122,7 @@
         {
             if (::strcasecmp (sub_command, "help") == 0)
             {
-                GenerateHelpText (interpreter, result);
+                GenerateHelpText (result);
             }
             else if (!m_subcommand_dict.empty())
             {
@@ -136,7 +135,7 @@
 
                     args.Shift();
 
-                    sub_cmd_obj->ExecuteWithOptions (interpreter, args, result);
+                    sub_cmd_obj->ExecuteWithOptions (args, result);
                 }
                 else
                 {
@@ -179,7 +178,7 @@
 }
 
 void
-CommandObjectMultiword::GenerateHelpText (CommandInterpreter &interpreter, CommandReturnObject &result)
+CommandObjectMultiword::GenerateHelpText (CommandReturnObject &result)
 {
     // First time through here, generate the help text for the object and
     // push it to the return result object as well
@@ -188,7 +187,7 @@
     output_stream.PutCString ("The following subcommands are supported:\n\n");
 
     CommandMap::iterator pos;
-    uint32_t max_len = interpreter.FindLongestCommandWord (m_subcommand_dict);
+    uint32_t max_len = m_interpreter.FindLongestCommandWord (m_subcommand_dict);
 
     if (max_len)
         max_len += 4; // Indent the output by 4 spaces.
@@ -197,11 +196,11 @@
     {
         std::string indented_command ("    ");
         indented_command.append (pos->first);
-        interpreter.OutputFormattedHelpText (result.GetOutputStream(), 
-                                             indented_command.c_str(),
-                                             "--", 
-                                             pos->second->GetHelp(), 
-                                             max_len);
+        m_interpreter.OutputFormattedHelpText (result.GetOutputStream(), 
+                                               indented_command.c_str(),
+                                               "--", 
+                                               pos->second->GetHelp(), 
+                                               max_len);
     }
 
     output_stream.PutCString ("\nFor more help on any particular subcommand, type 'help <command> <subcommand>'.\n");
@@ -212,7 +211,6 @@
 int
 CommandObjectMultiword::HandleCompletion
 (
-    CommandInterpreter &interpreter,
     Args &input,
     int &cursor_index,
     int &cursor_char_position,
@@ -245,8 +243,8 @@
                 input.Shift();
                 cursor_char_position = 0;
                 input.AppendArgument ("");
-                return cmd_obj->HandleCompletion (interpreter, 
-                                                  input, cursor_index, 
+                return cmd_obj->HandleCompletion (input, 
+                                                  cursor_index, 
                                                   cursor_char_position, 
                                                   match_start_point,
                                                   max_return_elements,
@@ -273,8 +271,7 @@
             matches.DeleteStringAtIndex(0);
             input.Shift();
             cursor_index--;
-            return sub_command_object->HandleCompletion (interpreter, 
-                                                         input, 
+            return sub_command_object->HandleCompletion (input, 
                                                          cursor_index, 
                                                          cursor_char_position, 
                                                          match_start_point,

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Fri Sep 17 20:14:36 2010
@@ -101,8 +101,9 @@
 
     };
 
-    CommandObjectProcessLaunch () :
-        CommandObject ("process launch",
+    CommandObjectProcessLaunch (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "process launch",
                        "Launch the executable in the debugger.",
                        "process launch [<cmd-options>] [<arguments-for-running-the-program>]")
     {
@@ -120,12 +121,11 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& launch_args,
+    Execute (Args& launch_args,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
-        bool synchronous_execution = interpreter.GetSynchronous ();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+        bool synchronous_execution = m_interpreter.GetSynchronous ();
     //    bool launched = false;
     //    bool stopped_after_launch = false;
 
@@ -141,16 +141,13 @@
         Module *exe_module = target->GetExecutableModule().get();
         exe_module->GetFileSpec().GetPath(filename, sizeof(filename));
 
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
-        if (process)
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
+        if (process && process->IsAlive())
         {
-            if (process->IsAlive())
-            {
-               result.AppendErrorWithFormat ("Process %u is currently being debugged, kill the process before running again.\n",
-                                            process->GetID());
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
+            result.AppendErrorWithFormat ("Process %u is currently being debugged, kill the process before running again.\n",
+                                          process->GetID());
+            result.SetStatus (eReturnStatusFailed);
+            return false;
         }
 
         const char *plugin_name;
@@ -159,130 +156,91 @@
         else
             plugin_name = NULL;
 
-        process = target->CreateProcess (interpreter.GetDebugger().GetListener(), plugin_name).get();
+        process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name).get();
 
-        const char *process_name = process->GetInstanceName().AsCString();
-        const char *debugger_instance_name = interpreter.GetDebugger().GetInstanceName().AsCString();
-        StreamString run_args_var_name;
-        StreamString env_vars_var_name;
-        StreamString disable_aslr_var_name;
-        lldb::SettableVariableType var_type;
-        
-        Args *run_args = NULL;
-        run_args_var_name.Printf ("process.[%s].run-args", process_name);
-        StringList run_args_value = Debugger::GetSettingsController()->GetVariable (run_args_var_name.GetData(), 
-                                                                                    var_type, debugger_instance_name);
-
-        if (run_args_value.GetSize() > 0)
-        {
-            run_args = new Args;
-            for (unsigned i = 0, e = run_args_value.GetSize(); i != e; ++i)
-                run_args->AppendArgument(run_args_value.GetStringAtIndex(i));
-        }
-        
-        Args *environment = NULL;
-        env_vars_var_name.Printf ("process.[%s].env-vars", process_name);
-        StringList env_vars_value = Debugger::GetSettingsController()->GetVariable (env_vars_var_name.GetData(), 
-                                                                                    var_type, debugger_instance_name);
-
-        if (env_vars_value.GetSize() > 0)
-        {
-            environment = new Args;
-            for (unsigned i = 0, e = env_vars_value.GetSize(); i != e; ++i)
-                environment->AppendArgument (env_vars_value.GetStringAtIndex (i));
+        if (process == NULL)
+        {
+            result.AppendErrorWithFormat ("Failed to find a process plugin for executable");
+            result.SetStatus (eReturnStatusFailed);
+            return false;
         }
 
-        uint32_t launch_flags = eLaunchFlagNone;
-        disable_aslr_var_name.Printf ("process.[%s].disable-aslr", process_name);
-        StringList disable_aslr_value = Debugger::GetSettingsController()->GetVariable(disable_aslr_var_name.GetData(),
-                                                                                       var_type, 
-                                                                                       debugger_instance_name);
-
-        if (disable_aslr_value.GetSize() > 0)
+        // If no launch args were given on the command line, then use any that
+        // might have been set using the "run-args" set variable.
+        if (launch_args.GetArgumentCount() == 0)
         {
-            if (strcmp (disable_aslr_value.GetStringAtIndex(0), "true") == 0)
-                launch_flags |= eLaunchFlagDisableASLR;
-
+            if (process->GetRunArguments().GetArgumentCount() > 0)
+                launch_args = process->GetRunArguments();
         }
+        
+        Args environment;
+        
+        process->GetEnvironmentAsArgs (environment);
+        
+        uint32_t launch_flags = eLaunchFlagNone;
+        
+        if (process->GetDisableASLR())
+            launch_flags |= eLaunchFlagDisableASLR;
 
-        // There are two possible sources of args to be passed to the process upon launching:  Those the user
-        // typed at the run command (launch_args); or those the user pre-set in the run-args variable (run_args).
+        const char *archname = exe_module->GetArchitecture().AsCString();
 
-        // If launch_args is empty, use run_args.
-        if (launch_args.GetArgumentCount() == 0)
-        {
-            if (run_args != NULL)
-                launch_args.AppendArguments (*run_args);
+        const char * stdin_path = NULL;
+        const char * stdout_path = NULL;
+        const char * stderr_path = NULL;
+
+        // Were any standard input/output/error paths given on the command line?
+        if (m_options.stdin_path.empty() &&
+            m_options.stdout_path.empty() &&
+            m_options.stderr_path.empty())
+        {
+            // No standard file handles were given on the command line, check
+            // with the process object in case they were give using "set settings"
+            stdin_path = process->GetStandardInputPath();
+            stdout_path = process->GetStandardOutputPath(); 
+            stderr_path = process->GetStandardErrorPath(); 
         }
         else
         {
-            // launch-args was not empty; use that, AND re-set run-args to contains launch-args values.
-            std::string new_run_args;
-            launch_args.GetCommandString (new_run_args);
-            Debugger::GetSettingsController()->SetVariable (run_args_var_name.GetData(), new_run_args.c_str(), 
-                                                            lldb::eVarSetOperationAssign, false,
-                                                            interpreter.GetDebugger().GetInstanceName().AsCString());
-        }
-
-
-        if (process)
+            stdin_path = m_options.stdin_path.empty()  ? NULL : m_options.stdin_path.c_str();
+            stdout_path = m_options.stdout_path.empty() ? NULL : m_options.stdout_path.c_str();
+            stderr_path = m_options.stderr_path.empty() ? NULL : m_options.stderr_path.c_str();
+        }
+
+        if (stdin_path == NULL)
+            stdin_path = "/dev/null";
+        if (stdout_path == NULL)
+            stdout_path = "/dev/null";
+        if (stderr_path == NULL)
+            stderr_path = "/dev/null";
+
+        Error error (process->Launch (launch_args.GetArgumentCount() ? launch_args.GetConstArgumentVector() : NULL,
+                                      environment.GetArgumentCount() ? environment.GetConstArgumentVector() : NULL,
+                                      launch_flags,
+                                      stdin_path,
+                                      stdout_path,
+                                      stderr_path));
+                     
+        if (error.Success())
         {
-            const char *archname = exe_module->GetArchitecture().AsCString();
-
-            const char * stdin_path = NULL;
-            const char * stdout_path = NULL;
-            const char * stderr_path = NULL;
-
-            if (!(m_options.stdin_path.empty() &&
-                m_options.stdout_path.empty() &&
-                m_options.stderr_path.empty()))
-            {
-                stdin_path =    m_options.stdin_path.empty()  ? "/dev/null" : m_options.stdin_path.c_str();
-                stdout_path =   m_options.stdout_path.empty() ? "/dev/null" : m_options.stdout_path.c_str();
-                stderr_path =   m_options.stderr_path.empty() ? "/dev/null" : m_options.stderr_path.c_str();
-            }
-
-            Error error (process->Launch (launch_args.GetConstArgumentVector(),
-                                          environment ? environment->GetConstArgumentVector() : NULL,
-                                          launch_flags,
-                                          stdin_path,
-                                          stdout_path,
-                                          stderr_path));
-                         
-            if (error.Success())
+            result.AppendMessageWithFormat ("Launching '%s'  (%s)\n", filename, archname);
+            result.SetStatus (eReturnStatusSuccessContinuingNoResult);
+            if (m_options.stop_at_entry == false)
             {
-                result.AppendMessageWithFormat ("Launching '%s'  (%s)\n", filename, archname);
-                result.SetStatus (eReturnStatusSuccessContinuingNoResult);
-                if (m_options.stop_at_entry == false)
-                {
-                    StateType state = process->WaitForProcessToStop (NULL);
+                StateType state = process->WaitForProcessToStop (NULL);
 
-                    if (state == eStateStopped)
-                    {
-                        // Call continue_command.
-                        CommandReturnObject continue_result;
-                        interpreter.HandleCommand("process continue", false, continue_result);
-                    }
+                if (state == eStateStopped)
+                {
+                    // Call continue_command.
+                    CommandReturnObject continue_result;
+                    m_interpreter.HandleCommand("process continue", false, continue_result);
+                }
 
-                    if (synchronous_execution)
-                    {
-                        result.SetDidChangeProcessState (true);
-                        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                    }
+                if (synchronous_execution)
+                {
+                    result.SetDidChangeProcessState (true);
+                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
                 }
             }
-            else
-            {
-                result.AppendErrorWithFormat ("Process launch failed: %s",
-                                              error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendErrorWithFormat ("Process launch failed: unable to create a process object.\n");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
         }
 
         return result.Succeeded();
@@ -386,7 +344,7 @@
         }
 
         virtual bool
-        HandleOptionArgumentCompletion (CommandInterpreter &interpreter,
+        HandleOptionArgumentCompletion (CommandInterpreter &interpeter, 
                                         Args &input,
                                         int cursor_index,
                                         int char_pos,
@@ -409,7 +367,7 @@
                 
                 // Look to see if there is a -P argument provided, and if so use that plugin, otherwise
                 // use the default plugin.
-                Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+                Process *process = interpeter.GetDebugger().GetExecutionContext().process;
                 bool need_to_delete_process = false;
                 
                 const char *partial_name = NULL;
@@ -418,7 +376,7 @@
                 if (process && process->IsAlive())
                     return true;
                     
-                Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+                Target *target = interpeter.GetDebugger().GetSelectedTarget().get();
                 if (target == NULL)
                 {
                     // No target has been set yet, for now do host completion.  Otherwise I don't know how we would
@@ -429,7 +387,7 @@
                 }
                 if (!process)
                 {
-                    process = target->CreateProcess (interpreter.GetDebugger().GetListener(), partial_name).get();
+                    process = target->CreateProcess (interpeter.GetDebugger().GetListener(), partial_name).get();
                     need_to_delete_process = true;
                 }
                 
@@ -459,8 +417,9 @@
         bool waitfor;
     };
 
-    CommandObjectProcessAttach () :
-        CommandObject ("process attach",
+    CommandObjectProcessAttach (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "process attach",
                        "Attach to a process.",
                        "process attach <cmd-options>")
     {
@@ -471,13 +430,12 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
 
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process)
         {
             if (process->IsAlive())
@@ -497,19 +455,19 @@
             ArchSpec emptyArchSpec;
             Error error;
             
-            error = interpreter.GetDebugger().GetTargetList().CreateTarget(interpreter.GetDebugger(), 
-                                                                           emptyFileSpec,
-                                                                           emptyArchSpec, 
-                                                                           NULL, 
-                                                                           false,
-                                                                           new_target_sp);
+            error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(), 
+                                                                              emptyFileSpec,
+                                                                              emptyArchSpec, 
+                                                                              NULL, 
+                                                                              false,
+                                                                              new_target_sp);
             target = new_target_sp.get();
             if (target == NULL || error.Fail())
             {
                 result.AppendError(error.AsCString("Error creating empty target"));
                 return false;
             }
-            interpreter.GetDebugger().GetTargetList().SetSelectedTarget(target);
+            m_interpreter.GetDebugger().GetTargetList().SetSelectedTarget(target);
         }
         
         // Record the old executable module, we want to issue a warning if the process of attaching changed the
@@ -530,7 +488,7 @@
             if (!m_options.plugin_name.empty())
                 plugin_name = m_options.plugin_name.c_str();
 
-            process = target->CreateProcess (interpreter.GetDebugger().GetListener(), plugin_name).get();
+            process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name).get();
 
             if (process)
             {
@@ -562,7 +520,7 @@
                         return false;
                     }
 
-                    interpreter.GetDebugger().GetOutputStream().Printf("Waiting to attach to a process named \"%s\".\n", wait_name);
+                    m_interpreter.GetDebugger().GetOutputStream().Printf("Waiting to attach to a process named \"%s\".\n", wait_name);
                     error = process->Attach (wait_name, m_options.waitfor);
                     if (error.Success())
                     {
@@ -700,8 +658,9 @@
 {
 public:
 
-    CommandObjectProcessContinue () :
-        CommandObject ("process continue",
+    CommandObjectProcessContinue (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "process continue",
                        "Continue execution of all threads in the current process.",
                        "process continue",
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
@@ -714,12 +673,11 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
-        bool synchronous_execution = interpreter.GetSynchronous ();
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
+        bool synchronous_execution = m_interpreter.GetSynchronous ();
 
         if (process == NULL)
         {
@@ -787,8 +745,9 @@
 {
 public:
 
-    CommandObjectProcessDetach () :
-        CommandObject ("process detach",
+    CommandObjectProcessDetach (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "process detach",
                        "Detach from the current process being debugged.",
                        "process detach",
                        eFlagProcessMustBeLaunched)
@@ -800,11 +759,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError ("must have a valid process in order to detach");
@@ -835,8 +793,9 @@
 {
 public:
 
-    CommandObjectProcessSignal () :
-        CommandObject ("process signal",
+    CommandObjectProcessSignal (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "process signal",
                        "Send a UNIX signal to the current process being debugged.",
                        "process signal <unix-signal-number>")
     {
@@ -847,11 +806,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError ("no process to signal");
@@ -901,8 +859,9 @@
 public:
 
 
-    CommandObjectProcessInterrupt () :
-    CommandObject ("process interrupt",
+    CommandObjectProcessInterrupt (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "process interrupt",
                    "Interrupt the current process being debugged.",
                    "process interrupt",
                    eFlagProcessMustBeLaunched)
@@ -914,11 +873,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError ("no process to halt");
@@ -962,8 +920,9 @@
 {
 public:
 
-    CommandObjectProcessKill () :
-    CommandObject ("process kill",
+    CommandObjectProcessKill (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "process kill",
                    "Terminate the current process being debugged.",
                    "process kill",
                    eFlagProcessMustBeLaunched)
@@ -975,11 +934,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError ("no process to kill");
@@ -1017,8 +975,9 @@
 class CommandObjectProcessStatus : public CommandObject
 {
 public:
-    CommandObjectProcessStatus () :
-    CommandObject ("process status",
+    CommandObjectProcessStatus (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "process status",
                    "Show the current status and location of executing process.",
                    "process status",
                    0)
@@ -1033,14 +992,13 @@
     bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
         StreamString &output_stream = result.GetOutputStream();
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
         if (exe_ctx.process)
         {
             const StateType state = exe_ctx.process->GetState();
@@ -1063,7 +1021,7 @@
                         exe_ctx.thread = exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get();
                     if (exe_ctx.thread != NULL)
                     {
-                        DisplayThreadsInfo (interpreter, &exe_ctx, result, true, true);
+                        DisplayThreadsInfo (m_interpreter, &exe_ctx, result, true, true);
                     }
                     else
                     {
@@ -1092,18 +1050,19 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("process",
-                              "A set of commands for operating on a process.",
-                              "process <subcommand> [<subcommand-options>]")
-{
-    LoadSubCommand (interpreter, "attach",      CommandObjectSP (new CommandObjectProcessAttach ()));
-    LoadSubCommand (interpreter, "launch",      CommandObjectSP (new CommandObjectProcessLaunch ()));
-    LoadSubCommand (interpreter, "continue",    CommandObjectSP (new CommandObjectProcessContinue ()));
-    LoadSubCommand (interpreter, "detach",      CommandObjectSP (new CommandObjectProcessDetach ()));
-    LoadSubCommand (interpreter, "signal",      CommandObjectSP (new CommandObjectProcessSignal ()));
-    LoadSubCommand (interpreter, "status",      CommandObjectSP (new CommandObjectProcessStatus ()));
-    LoadSubCommand (interpreter, "interrupt",   CommandObjectSP (new CommandObjectProcessInterrupt ()));
-    LoadSubCommand (interpreter, "kill",        CommandObjectSP (new CommandObjectProcessKill ()));
+    CommandObjectMultiword (interpreter,
+                            "process",
+                            "A set of commands for operating on a process.",
+                            "process <subcommand> [<subcommand-options>]")
+{
+    LoadSubCommand ("attach",      CommandObjectSP (new CommandObjectProcessAttach (interpreter)));
+    LoadSubCommand ("launch",      CommandObjectSP (new CommandObjectProcessLaunch (interpreter)));
+    LoadSubCommand ("continue",    CommandObjectSP (new CommandObjectProcessContinue (interpreter)));
+    LoadSubCommand ("detach",      CommandObjectSP (new CommandObjectProcessDetach (interpreter)));
+    LoadSubCommand ("signal",      CommandObjectSP (new CommandObjectProcessSignal (interpreter)));
+    LoadSubCommand ("status",      CommandObjectSP (new CommandObjectProcessStatus (interpreter)));
+    LoadSubCommand ("interrupt",   CommandObjectSP (new CommandObjectProcessInterrupt (interpreter)));
+    LoadSubCommand ("kill",        CommandObjectSP (new CommandObjectProcessKill (interpreter)));
 }
 
 CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess ()

Modified: lldb/trunk/source/Commands/CommandObjectQuit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectQuit.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectQuit.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectQuit.cpp Fri Sep 17 20:14:36 2010
@@ -23,8 +23,8 @@
 // CommandObjectQuit
 //-------------------------------------------------------------------------
 
-CommandObjectQuit::CommandObjectQuit () :
-    CommandObject ("quit", "Quit out of the LLDB debugger.", "quit")
+CommandObjectQuit::CommandObjectQuit (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, "quit", "Quit out of the LLDB debugger.", "quit")
 {
 }
 
@@ -35,12 +35,11 @@
 bool
 CommandObjectQuit::Execute
 (
-    CommandInterpreter &interpreter, 
     Args& args,
     CommandReturnObject &result
 )
 {
-    interpreter.BroadcastEvent (CommandInterpreter::eBroadcastBitQuitCommandReceived);
+    m_interpreter.BroadcastEvent (CommandInterpreter::eBroadcastBitQuitCommandReceived);
     result.SetStatus (eReturnStatusQuit);
     return true;
 }

Modified: lldb/trunk/source/Commands/CommandObjectQuit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectQuit.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectQuit.h (original)
+++ lldb/trunk/source/Commands/CommandObjectQuit.h Fri Sep 17 20:14:36 2010
@@ -22,25 +22,17 @@
 // CommandObjectQuit
 //-------------------------------------------------------------------------
 
-// SPECIAL NOTE!! The CommandObjectQuit is special, because the actual function to execute
-// when the user types 'quit' is passed (via function pointer) to the Command Interpreter when it
-// is constructed.  The function pointer is then stored in this CommandObjectQuit, and is invoked
-// via the CommandObjectQuit::Execute function.  This is the only command object that works this
-// way; it was done this way because different Command Interpreter callers may want or need different things
-// to be done in order to shut down properly.
-
 class CommandObjectQuit : public CommandObject
 {
 public:
 
-    CommandObjectQuit ();
+    CommandObjectQuit (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectQuit ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter, 
-             Args& args,
+    Execute (Args& args,
              CommandReturnObject &result);
 
 };

Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Fri Sep 17 20:14:36 2010
@@ -31,8 +31,9 @@
 class CommandObjectRegisterRead : public CommandObject
 {
 public:
-    CommandObjectRegisterRead () :
-        CommandObject ("register read",
+    CommandObjectRegisterRead (CommandInterpreter &interpreter) :
+        CommandObject (interpreter, 
+                       "register read",
                        "Dump the contents of one or more register values from the current frame.",
                        "register read [<reg-name1> [<reg-name2> [...]]]",
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
@@ -47,14 +48,13 @@
     virtual bool
     Execute 
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
         StreamString &output_stream = result.GetOutputStream();
         DataExtractor reg_data;
-        ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
         RegisterContext *reg_context = exe_ctx.GetRegisterContext ();
 
         if (reg_context)
@@ -139,8 +139,9 @@
 class CommandObjectRegisterWrite : public CommandObject
 {
 public:
-    CommandObjectRegisterWrite () :
-        CommandObject ("register write",
+    CommandObjectRegisterWrite (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "register write",
                        "Modify a single register value.",
                        "register write <reg-name> <value>",
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
@@ -155,13 +156,12 @@
     virtual bool
     Execute 
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
         DataExtractor reg_data;
-        ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
         RegisterContext *reg_context = exe_ctx.GetRegisterContext ();
 
         if (reg_context)
@@ -219,12 +219,13 @@
 // CommandObjectRegister constructor
 //----------------------------------------------------------------------
 CommandObjectRegister::CommandObjectRegister(CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("register",
+    CommandObjectMultiword (interpreter,
+                            "register",
                             "A set of commands to access thread registers.",
                             "register [read|write] ...")
 {
-    LoadSubCommand (interpreter, "read",  CommandObjectSP (new CommandObjectRegisterRead ()));
-    LoadSubCommand (interpreter, "write", CommandObjectSP (new CommandObjectRegisterWrite ()));
+    LoadSubCommand ("read",  CommandObjectSP (new CommandObjectRegisterRead (interpreter)));
+    LoadSubCommand ("write", CommandObjectSP (new CommandObjectRegisterWrite (interpreter)));
 }
 
 

Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Fri Sep 17 20:14:36 2010
@@ -25,31 +25,32 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMultiwordSettings::CommandObjectMultiwordSettings (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("settings",
+    CommandObjectMultiword (interpreter,
+                            "settings",
                             "A set of commands for manipulating internal settable debugger variables.",
                             "settings <command> [<command-options>]")
 {
     bool status;
 
-    CommandObjectSP set_command_object (new CommandObjectSettingsSet ());
-    CommandObjectSP show_command_object (new CommandObjectSettingsShow ());
-    CommandObjectSP list_command_object (new CommandObjectSettingsList ());
-    CommandObjectSP remove_command_object (new CommandObjectSettingsRemove ());
-    CommandObjectSP replace_command_object (new CommandObjectSettingsReplace ());
-    CommandObjectSP insert_before_command_object (new CommandObjectSettingsInsertBefore ());
-    CommandObjectSP insert_after_command_object (new CommandObjectSettingsInsertAfter());
-    CommandObjectSP append_command_object (new CommandObjectSettingsAppend());
-    CommandObjectSP clear_command_object (new CommandObjectSettingsClear());
-
-    status = LoadSubCommand (interpreter, "set",           set_command_object);
-    status = LoadSubCommand (interpreter, "show",          show_command_object);
-    status = LoadSubCommand (interpreter, "list",          list_command_object);
-    status = LoadSubCommand (interpreter, "remove",        remove_command_object);
-    status = LoadSubCommand (interpreter, "replace",       replace_command_object);
-    status = LoadSubCommand (interpreter, "insert-before", insert_before_command_object);
-    status = LoadSubCommand (interpreter, "insert-after",  insert_after_command_object);
-    status = LoadSubCommand (interpreter, "append",        append_command_object);
-    status = LoadSubCommand (interpreter, "clear",         clear_command_object);
+    CommandObjectSP set_command_object (new CommandObjectSettingsSet (interpreter));
+    CommandObjectSP show_command_object (new CommandObjectSettingsShow (interpreter));
+    CommandObjectSP list_command_object (new CommandObjectSettingsList (interpreter));
+    CommandObjectSP remove_command_object (new CommandObjectSettingsRemove (interpreter));
+    CommandObjectSP replace_command_object (new CommandObjectSettingsReplace (interpreter));
+    CommandObjectSP insert_before_command_object (new CommandObjectSettingsInsertBefore (interpreter));
+    CommandObjectSP insert_after_command_object (new CommandObjectSettingsInsertAfter(interpreter));
+    CommandObjectSP append_command_object (new CommandObjectSettingsAppend(interpreter));
+    CommandObjectSP clear_command_object (new CommandObjectSettingsClear(interpreter));
+
+    status = LoadSubCommand ("set",           set_command_object);
+    status = LoadSubCommand ("show",          show_command_object);
+    status = LoadSubCommand ("list",          list_command_object);
+    status = LoadSubCommand ("remove",        remove_command_object);
+    status = LoadSubCommand ("replace",       replace_command_object);
+    status = LoadSubCommand ("insert-before", insert_before_command_object);
+    status = LoadSubCommand ("insert-after",  insert_after_command_object);
+    status = LoadSubCommand ("append",        append_command_object);
+    status = LoadSubCommand ("clear",         clear_command_object);
 }
 
 CommandObjectMultiwordSettings::~CommandObjectMultiwordSettings ()
@@ -60,8 +61,9 @@
 // CommandObjectSettingsSet
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsSet::CommandObjectSettingsSet () :
-    CommandObject ("settings set",
+CommandObjectSettingsSet::CommandObjectSettingsSet (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "settings set",
                    "Set or change the value of a single debugger setting variable.",
                    "settings set [<cmd-options>] <setting-variable-name> <value>"),
     m_options ()
@@ -74,9 +76,7 @@
 
 
 bool
-CommandObjectSettingsSet::Execute (CommandInterpreter &interpreter,
-                                   Args& command,
-                                   CommandReturnObject &result)
+CommandObjectSettingsSet::Execute (Args& command, CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
 
@@ -116,9 +116,11 @@
     }
     else
     {
-      Error err = root_settings->SetVariable (var_name_string.c_str(), var_value, lldb::eVarSetOperationAssign, 
+      Error err = root_settings->SetVariable (var_name_string.c_str(), 
+                                              var_value, 
+                                              lldb::eVarSetOperationAssign, 
                                               m_options.m_override, 
-                                              interpreter.GetDebugger().GetInstanceName().AsCString());
+                                              m_interpreter.GetDebugger().GetInstanceName().AsCString());
         if (err.Fail ())
         {
             result.AppendError (err.AsCString());
@@ -132,8 +134,7 @@
 }
 
 int
-CommandObjectSettingsSet::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                    Args &input,
+CommandObjectSettingsSet::HandleArgumentCompletion (Args &input,
                                                     int &cursor_index,
                                                     int &cursor_char_position,
                                                     OptionElementVector &opt_element_vector,
@@ -147,7 +148,7 @@
 
     // Attempting to complete variable name
     if (cursor_index == 1)
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eSettingsNameCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -258,10 +259,11 @@
 // CommandObjectSettingsShow -- Show current values
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsShow::CommandObjectSettingsShow () :
-    CommandObject ("settings show",
-                    "Show the specified internal debugger setting variable and its value, or show all the currently set variables and their values, if nothing is specified.",
-                    "settings show [<setting-variable-name>]")
+CommandObjectSettingsShow::CommandObjectSettingsShow (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "settings show",
+                   "Show the specified internal debugger setting variable and its value, or show all the currently set variables and their values, if nothing is specified.",
+                   "settings show [<setting-variable-name>]")
 {
 }
 
@@ -271,8 +273,7 @@
 
 
 bool
-CommandObjectSettingsShow::Execute (CommandInterpreter &interpreter,
-                                    Args& command,
+CommandObjectSettingsShow::Execute (                       Args& command,
                                     CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -286,7 +287,7 @@
         lldb::SettableVariableType var_type;
         const char *variable_name = command.GetArgumentAtIndex (0);
         StringList value = root_settings->GetVariable (variable_name, var_type, 
-                                                       interpreter.GetDebugger().GetInstanceName().AsCString());
+                                                       m_interpreter.GetDebugger().GetInstanceName().AsCString());
         
         if (value.GetSize() == 0)
         {
@@ -320,8 +321,11 @@
     }
     else
     {
-        UserSettingsController::GetAllVariableValues (interpreter, root_settings, current_prefix, 
-                                                      result.GetOutputStream(), err);
+        UserSettingsController::GetAllVariableValues (m_interpreter, 
+                                                      root_settings, 
+                                                      current_prefix, 
+                                                      result.GetOutputStream(), 
+                                                      err);
         if (err.Fail ())
         {
             result.AppendError (err.AsCString());
@@ -337,8 +341,7 @@
 }
 
 int
-CommandObjectSettingsShow::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                     Args &input,
+CommandObjectSettingsShow::HandleArgumentCompletion (Args &input,
                                                      int &cursor_index,
                                                      int &cursor_char_position,
                                                      OptionElementVector &opt_element_vector,
@@ -350,7 +353,7 @@
     std::string completion_str (input.GetArgumentAtIndex (cursor_index));
     completion_str.erase (cursor_char_position);
 
-    CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+    CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                          CommandCompletions::eSettingsNameCompletion,
                                                          completion_str.c_str(),
                                                          match_start_point,
@@ -365,8 +368,9 @@
 // CommandObjectSettingsList
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsList::CommandObjectSettingsList () :
-    CommandObject ("settings list",
+CommandObjectSettingsList::CommandObjectSettingsList (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "settings list",
                    "List and describe all the internal debugger settings variables that are available to the user to 'set' or 'show', or describe a particular variable or set of variables (by specifying the variable name or a common prefix).",
                    "settings list [<setting-name> | <setting-name-prefix>]")
 {
@@ -378,8 +382,7 @@
 
 
 bool
-CommandObjectSettingsList::Execute (CommandInterpreter &interpreter,
-                                    Args& command,
+CommandObjectSettingsList::Execute (                       Args& command,
                                     CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -389,14 +392,21 @@
 
     if (command.GetArgumentCount() == 0)
     {
-        UserSettingsController::FindAllSettingsDescriptions (interpreter, root_settings, current_prefix, 
-                                                             result.GetOutputStream(), err);
+        UserSettingsController::FindAllSettingsDescriptions (m_interpreter, 
+                                                             root_settings, 
+                                                             current_prefix, 
+                                                             result.GetOutputStream(), 
+                                                             err);
     }
     else if (command.GetArgumentCount() == 1)
     {
         const char *search_name = command.GetArgumentAtIndex (0);
-        UserSettingsController::FindSettingsDescriptions (interpreter, root_settings, current_prefix,
-                                                          search_name, result.GetOutputStream(), err);
+        UserSettingsController::FindSettingsDescriptions (m_interpreter, 
+                                                          root_settings, 
+                                                          current_prefix,
+                                                          search_name, 
+                                                          result.GetOutputStream(), 
+                                                          err);
     }
     else
     {
@@ -419,8 +429,7 @@
 }
 
 int
-CommandObjectSettingsList::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                     Args &input,
+CommandObjectSettingsList::HandleArgumentCompletion (Args &input,
                                                      int &cursor_index,
                                                      int &cursor_char_position,
                                                      OptionElementVector &opt_element_vector,
@@ -432,7 +441,7 @@
     std::string completion_str (input.GetArgumentAtIndex (cursor_index));
     completion_str.erase (cursor_char_position);
 
-    CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+    CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                          CommandCompletions::eSettingsNameCompletion,
                                                          completion_str.c_str(),
                                                          match_start_point,
@@ -447,8 +456,9 @@
 // CommandObjectSettingsRemove
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsRemove::CommandObjectSettingsRemove () :
-    CommandObject ("settings remove",
+CommandObjectSettingsRemove::CommandObjectSettingsRemove (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "settings remove",
                    "Remove the specified element from an internal debugger settings array or dictionary variable.",
                    "settings remove <setting-variable-name> [<index>|\"key\"]")
 {
@@ -459,8 +469,7 @@
 }
 
 bool
-CommandObjectSettingsRemove::Execute (CommandInterpreter &interpreter,
-                                     Args& command,
+CommandObjectSettingsRemove::Execute (                        Args& command,
                                      CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -497,8 +506,11 @@
 
     index_value_string = index_value;
 
-    Error err = root_settings->SetVariable (var_name_string.c_str(), NULL, lldb::eVarSetOperationRemove,  
-                                            false, interpreter.GetDebugger().GetInstanceName().AsCString(),
+    Error err = root_settings->SetVariable (var_name_string.c_str(), 
+                                            NULL, 
+                                            lldb::eVarSetOperationRemove,  
+                                            false, 
+                                            m_interpreter.GetDebugger().GetInstanceName().AsCString(),
                                             index_value_string.c_str());
     if (err.Fail ())
     {
@@ -512,8 +524,7 @@
 }
 
 int
-CommandObjectSettingsRemove::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                       Args &input,
+CommandObjectSettingsRemove::HandleArgumentCompletion (Args &input,
                                                        int &cursor_index,
                                                        int &cursor_char_position,
                                                        OptionElementVector &opt_element_vector,
@@ -527,7 +538,7 @@
 
     // Attempting to complete variable name
     if (cursor_index < 2)
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eSettingsNameCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -543,8 +554,9 @@
 // CommandObjectSettingsReplace
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsReplace::CommandObjectSettingsReplace () :
-    CommandObject ("settings replace",
+CommandObjectSettingsReplace::CommandObjectSettingsReplace (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "settings replace",
                    "Replace the specified element from an internal debugger settings array or dictionary variable with the specified new value.",
                    "settings replace <setting-variable-name> [<index>|\"<key>\"] <new-value>")
 {
@@ -555,8 +567,7 @@
 }
 
 bool
-CommandObjectSettingsReplace::Execute (CommandInterpreter &interpreter,
-                                      Args& command,
+CommandObjectSettingsReplace::Execute (                         Args& command,
                                       CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -607,8 +618,11 @@
     }
     else
     {
-        Error err = root_settings->SetVariable (var_name_string.c_str(), var_value, lldb::eVarSetOperationReplace, 
-                                                false, interpreter.GetDebugger().GetInstanceName().AsCString(),
+        Error err = root_settings->SetVariable (var_name_string.c_str(), 
+                                                var_value, 
+                                                lldb::eVarSetOperationReplace, 
+                                                false, 
+                                                m_interpreter.GetDebugger().GetInstanceName().AsCString(),
                                                 index_value_string.c_str());
         if (err.Fail ())
         {
@@ -623,8 +637,7 @@
 }
 
 int
-CommandObjectSettingsReplace::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                        Args &input,
+CommandObjectSettingsReplace::HandleArgumentCompletion (Args &input,
                                                         int &cursor_index,
                                                         int &cursor_char_position,
                                                         OptionElementVector &opt_element_vector,
@@ -638,7 +651,7 @@
 
     // Attempting to complete variable name
     if (cursor_index < 2)
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eSettingsNameCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -654,8 +667,9 @@
 // CommandObjectSettingsInsertBefore
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsInsertBefore::CommandObjectSettingsInsertBefore () :
-    CommandObject ("settings insert-before",
+CommandObjectSettingsInsertBefore::CommandObjectSettingsInsertBefore (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "settings insert-before",
                    "Insert value(s) into an internal debugger settings array variable, immediately before the specified element.",
                    "settings insert-before <setting-variable-name> [<index>] <new-value>")
 {
@@ -666,8 +680,7 @@
 }
 
 bool
-CommandObjectSettingsInsertBefore::Execute (CommandInterpreter &interpreter,
-                                           Args& command,
+CommandObjectSettingsInsertBefore::Execute (                              Args& command,
                                            CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -719,8 +732,11 @@
     }
     else
     {
-        Error err = root_settings->SetVariable (var_name_string.c_str(), var_value, lldb::eVarSetOperationInsertBefore,
-                                                false, interpreter.GetDebugger().GetInstanceName().AsCString(),
+        Error err = root_settings->SetVariable (var_name_string.c_str(), 
+                                                var_value, 
+                                                lldb::eVarSetOperationInsertBefore,
+                                                false, 
+                                                m_interpreter.GetDebugger().GetInstanceName().AsCString(),
                                                 index_value_string.c_str());
         if (err.Fail ())
         {
@@ -736,8 +752,7 @@
 
 
 int
-CommandObjectSettingsInsertBefore::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                             Args &input,
+CommandObjectSettingsInsertBefore::HandleArgumentCompletion (Args &input,
                                                              int &cursor_index,
                                                              int &cursor_char_position,
                                                              OptionElementVector &opt_element_vector,
@@ -751,7 +766,7 @@
 
     // Attempting to complete variable name
     if (cursor_index < 2)
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eSettingsNameCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -767,8 +782,9 @@
 // CommandObjectSettingInsertAfter
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsInsertAfter::CommandObjectSettingsInsertAfter () :
-    CommandObject ("settings insert-after",
+CommandObjectSettingsInsertAfter::CommandObjectSettingsInsertAfter (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "settings insert-after",
                    "Insert value(s) into an internal debugger settings array variable, immediately after the specified element.",
                    "settings insert-after <setting-variable-name> [<index>] <new-value>")
 {
@@ -779,8 +795,7 @@
 }
 
 bool
-CommandObjectSettingsInsertAfter::Execute (CommandInterpreter &interpreter,
-                                          Args& command,
+CommandObjectSettingsInsertAfter::Execute (                             Args& command,
                                           CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -832,8 +847,11 @@
     }
     else
     {
-        Error err = root_settings->SetVariable (var_name_string.c_str(), var_value, lldb::eVarSetOperationInsertAfter,
-                                                false, interpreter.GetDebugger().GetInstanceName().AsCString(), 
+        Error err = root_settings->SetVariable (var_name_string.c_str(), 
+                                                var_value, 
+                                                lldb::eVarSetOperationInsertAfter,
+                                                false, 
+                                                m_interpreter.GetDebugger().GetInstanceName().AsCString(), 
                                                 index_value_string.c_str());
         if (err.Fail ())
         {
@@ -849,8 +867,7 @@
 
 
 int
-CommandObjectSettingsInsertAfter::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                            Args &input,
+CommandObjectSettingsInsertAfter::HandleArgumentCompletion (Args &input,
                                                             int &cursor_index,
                                                             int &cursor_char_position,
                                                             OptionElementVector &opt_element_vector,
@@ -864,7 +881,7 @@
 
     // Attempting to complete variable name
     if (cursor_index < 2)
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eSettingsNameCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -880,8 +897,9 @@
 // CommandObjectSettingsAppend
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsAppend::CommandObjectSettingsAppend () :
-    CommandObject ("settings append",
+CommandObjectSettingsAppend::CommandObjectSettingsAppend (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "settings append",
                    "Append a new value to the end of an internal debugger settings array, dictionary or string variable.",
                    "settings append <setting-variable-name> <new-value>")
 {
@@ -892,8 +910,7 @@
 }
 
 bool
-CommandObjectSettingsAppend::Execute (CommandInterpreter &interpreter,
-                                     Args& command,
+CommandObjectSettingsAppend::Execute (                        Args& command,
                                      CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -933,8 +950,11 @@
     }
     else
     {
-        Error err = root_settings->SetVariable (var_name_string.c_str(), var_value, lldb::eVarSetOperationAppend, 
-                                                false, interpreter.GetDebugger().GetInstanceName().AsCString());
+        Error err = root_settings->SetVariable (var_name_string.c_str(), 
+                                                var_value, 
+                                                lldb::eVarSetOperationAppend, 
+                                                false, 
+                                                m_interpreter.GetDebugger().GetInstanceName().AsCString());
         if (err.Fail ())
         {
             result.AppendError (err.AsCString());
@@ -949,8 +969,7 @@
 
 
 int
-CommandObjectSettingsAppend::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                       Args &input,
+CommandObjectSettingsAppend::HandleArgumentCompletion (Args &input,
                                                        int &cursor_index,
                                                        int &cursor_char_position,
                                                        OptionElementVector &opt_element_vector,
@@ -964,7 +983,7 @@
 
     // Attempting to complete variable name
     if (cursor_index < 2)
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eSettingsNameCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,
@@ -980,8 +999,9 @@
 // CommandObjectSettingsClear
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsClear::CommandObjectSettingsClear () :
-    CommandObject ("settings clear",
+CommandObjectSettingsClear::CommandObjectSettingsClear (CommandInterpreter &interpreter) :
+    CommandObject (interpreter, 
+                   "settings clear",
                    "Erase all the contents of an internal debugger settings variables; this is only valid for variables with clearable types, i.e. strings, arrays or dictionaries.",
                    "settings clear")
 {
@@ -992,8 +1012,7 @@
 }
 
 bool
-CommandObjectSettingsClear::Execute (CommandInterpreter &interpreter,
-                                    Args& command,
+CommandObjectSettingsClear::Execute (                       Args& command,
                                     CommandReturnObject &result)
 {
     UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
@@ -1015,8 +1034,11 @@
         return false;
     }
 
-    Error err = root_settings->SetVariable (var_name, NULL, lldb::eVarSetOperationClear, false, 
-                                            interpreter.GetDebugger().GetInstanceName().AsCString());
+    Error err = root_settings->SetVariable (var_name, 
+                                            NULL, 
+                                            lldb::eVarSetOperationClear, 
+                                            false, 
+                                            m_interpreter.GetDebugger().GetInstanceName().AsCString());
 
     if (err.Fail ())
     {
@@ -1031,8 +1053,7 @@
 
 
 int
-CommandObjectSettingsClear::HandleArgumentCompletion (CommandInterpreter &interpreter,
-                                                      Args &input,
+CommandObjectSettingsClear::HandleArgumentCompletion (Args &input,
                                                       int &cursor_index,
                                                       int &cursor_char_position,
                                                       OptionElementVector &opt_element_vector,
@@ -1046,7 +1067,7 @@
 
     // Attempting to complete variable name
     if (cursor_index < 2)
-        CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+        CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                              CommandCompletions::eSettingsNameCompletion,
                                                              completion_str.c_str(),
                                                              match_start_point,

Modified: lldb/trunk/source/Commands/CommandObjectSettings.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.h Fri Sep 17 20:14:36 2010
@@ -43,14 +43,13 @@
 class CommandObjectSettingsSet : public CommandObject
 {
 public:
-    CommandObjectSettingsSet ();
+    CommandObjectSettingsSet (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsSet ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual Options *
@@ -86,8 +85,7 @@
     };
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -107,20 +105,18 @@
 class CommandObjectSettingsShow : public CommandObject
 {
 public:
-    CommandObjectSettingsShow ();
+    CommandObjectSettingsShow (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsShow ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -139,19 +135,17 @@
 class CommandObjectSettingsList : public CommandObject
 {
 public: 
-    CommandObjectSettingsList ();
+    CommandObjectSettingsList (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsList ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -170,19 +164,17 @@
 class CommandObjectSettingsRemove : public CommandObject
 {
 public:
-    CommandObjectSettingsRemove ();
+    CommandObjectSettingsRemove (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsRemove ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -201,19 +193,17 @@
 class CommandObjectSettingsReplace : public CommandObject
 {
 public:
-    CommandObjectSettingsReplace ();
+    CommandObjectSettingsReplace (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsReplace ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -232,19 +222,17 @@
 class CommandObjectSettingsInsertBefore : public CommandObject
 {
 public:
-    CommandObjectSettingsInsertBefore ();
+    CommandObjectSettingsInsertBefore (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsInsertBefore ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -263,19 +251,17 @@
 class CommandObjectSettingsInsertAfter : public CommandObject
 {
 public:
-    CommandObjectSettingsInsertAfter ();
+    CommandObjectSettingsInsertAfter (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsInsertAfter ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -294,19 +280,17 @@
 class CommandObjectSettingsAppend : public CommandObject
 {
 public:
-    CommandObjectSettingsAppend ();
+    CommandObjectSettingsAppend (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsAppend ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,
@@ -325,19 +309,17 @@
 class CommandObjectSettingsClear : public CommandObject
 {
 public:
-    CommandObjectSettingsClear ();
+    CommandObjectSettingsClear (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSettingsClear ();
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     virtual int
-    HandleArgumentCompletion (CommandInterpreter &interpreter,
-                              Args &input,
+    HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
                               OptionElementVector &opt_element_vector,

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Fri Sep 17 20:14:36 2010
@@ -96,10 +96,11 @@
     };
  
 public:   
-    CommandObjectSourceInfo() :
-        CommandObject ("source info",
-                         "Display information about the source lines from the current executable's debug info.",
-                         "source info [<cmd-options>]")
+    CommandObjectSourceInfo(CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "source info",
+                       "Display information about the source lines from the current executable's debug info.",
+                       "source info [<cmd-options>]")
     {
     }
 
@@ -118,7 +119,6 @@
     bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& args,
         CommandReturnObject &result
     )
@@ -227,10 +227,11 @@
     };
  
 public:   
-    CommandObjectSourceList() :
-        CommandObject ("source list",
-                         "Display source code (as specified) based on the current executable's debug info.",
-                         "source list [<cmd-options>] [<filename>]")
+    CommandObjectSourceList(CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "source list",
+                       "Display source code (as specified) based on the current executable's debug info.",
+                       "source list [<cmd-options>] [<filename>]")
     {
     }
 
@@ -249,7 +250,6 @@
     bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& args,
         CommandReturnObject &result
     )
@@ -262,12 +262,12 @@
             result.SetStatus (eReturnStatusFailed);
         }
 
-        ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
         
         if (!m_options.symbol_name.empty())
         {
             // Displaying the source for a symbol:
-            Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+            Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
             if (target == NULL)
             {
                 result.AppendError ("invalid target, set executable file using 'file' command");
@@ -400,12 +400,12 @@
             char path_buf[PATH_MAX+1];
             start_file.GetPath(path_buf, PATH_MAX);
             result.AppendMessageWithFormat("File: %s.\n", path_buf);
-            interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (start_file,
-                                                                                             line_no,
-                                                                                             0,
-                                                                                             m_options.num_lines,
-                                                                                             "",
-                                                                                             &result.GetOutputStream());
+            m_interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (start_file,
+                                                                                              line_no,
+                                                                                              0,
+                                                                                              m_options.num_lines,
+                                                                                              "",
+                                                                                              &result.GetOutputStream());
             
             result.SetStatus (eReturnStatusSuccessFinishResult);
             return true;
@@ -419,14 +419,14 @@
             // more likely because you typed it once, then typed it again
             if (m_options.start_line == 0)
             {
-                if (interpreter.GetDebugger().GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream()))
+                if (m_interpreter.GetDebugger().GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream()))
                 {
                     result.SetStatus (eReturnStatusSuccessFinishResult);
                 }
             }
             else
             {
-                if (interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
+                if (m_interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
                             m_options.start_line,   // Line to display
                             0,                      // Lines before line to display
                             m_options.num_lines,    // Lines after line to display
@@ -441,7 +441,7 @@
         else
         {
             const char *filename = m_options.file_name.c_str();
-            Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+            Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
             if (target == NULL)
             {
                 result.AppendError ("invalid target, set executable file using 'file' command");
@@ -524,12 +524,12 @@
             {
                 if (sc.comp_unit)
                 {
-                    interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
-                                                                                                     m_options.start_line,
-                                                                                                     0,
-                                                                                                     m_options.num_lines,
-                                                                                                     "",
-                                                                                                     &result.GetOutputStream());
+                    m_interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
+                                                                                                      m_options.start_line,
+                                                                                                      0,
+                                                                                                      m_options.num_lines,
+                                                                                                      "",
+                                                                                                      &result.GetOutputStream());
                     
                     result.SetStatus (eReturnStatusSuccessFinishResult);
                 }
@@ -574,12 +574,13 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMultiwordSource::CommandObjectMultiwordSource (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("source",
+    CommandObjectMultiword (interpreter,
+                            "source",
                             "A set of commands for accessing source file information",
                             "source <subcommand> [<subcommand-options>]")
 {
-    LoadSubCommand (interpreter, "info",   CommandObjectSP (new CommandObjectSourceInfo ()));
-    LoadSubCommand (interpreter, "list",   CommandObjectSP (new CommandObjectSourceList ()));
+    LoadSubCommand ("info",   CommandObjectSP (new CommandObjectSourceInfo (interpreter)));
+    LoadSubCommand ("list",   CommandObjectSP (new CommandObjectSourceList (interpreter)));
 }
 
 CommandObjectMultiwordSource::~CommandObjectMultiwordSource ()

Modified: lldb/trunk/source/Commands/CommandObjectSyntax.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSyntax.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSyntax.cpp Fri Sep 17 20:14:36 2010
@@ -27,10 +27,11 @@
 // CommandObjectSyntax
 //-------------------------------------------------------------------------
 
-CommandObjectSyntax::CommandObjectSyntax () :
-    CommandObject ("syntax",
-                     "Shows the correct syntax for a given debugger command.",
-                     "syntax <command>")
+CommandObjectSyntax::CommandObjectSyntax (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "syntax",
+                   "Shows the correct syntax for a given debugger command.",
+                   "syntax <command>")
 {
 }
 
@@ -42,7 +43,6 @@
 bool
 CommandObjectSyntax::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
@@ -53,7 +53,7 @@
 
     if (argc > 0)
     {
-        cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex(0));
+        cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex(0));
         bool all_okay = true;
         for (int i = 1; i < argc; ++i)
         {

Modified: lldb/trunk/source/Commands/CommandObjectSyntax.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSyntax.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSyntax.h Fri Sep 17 20:14:36 2010
@@ -26,14 +26,13 @@
 {
 public:
 
-    CommandObjectSyntax ();
+    CommandObjectSyntax (CommandInterpreter &interpreter);
 
     virtual
     ~CommandObjectSyntax ();
     
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
 

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Sep 17 20:14:36 2010
@@ -34,8 +34,9 @@
 {
 public:
 
-    CommandObjectTargetImageSearchPathsAdd () :
-        CommandObject ("target image-search-paths add",
+    CommandObjectTargetImageSearchPathsAdd (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "target image-search-paths add",
                        "Add new image search paths substitution pairs to the current target.",
                        "target image-search-paths add <path-prefix> <new-path-prefix> [<path-prefix> <new-path-prefix>] ...")
     {
@@ -46,11 +47,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target)
         {
             uint32_t argc = command.GetArgumentCount();
@@ -97,8 +97,9 @@
 {
 public:
 
-    CommandObjectTargetImageSearchPathsClear () :
-        CommandObject ("target image-search-paths clear",
+    CommandObjectTargetImageSearchPathsClear (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "target image-search-paths clear",
                        "Clear all current image search path substitution pairs from the current target.",
                        "target image-search-paths clear")
     {
@@ -109,11 +110,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target)
         {
             bool notify = true;
@@ -132,8 +132,9 @@
 {
 public:
 
-    CommandObjectTargetImageSearchPathsInsert () :
-        CommandObject ("target image-search-paths insert",
+    CommandObjectTargetImageSearchPathsInsert (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "target image-search-paths insert",
                        "Insert a new image search path substitution pair into the current target at the specified index.",
                        "target image-search-paths insert <index> <path-prefix> <new-path-prefix> [<path-prefix> <new-path-prefix>] ...")
     {
@@ -144,11 +145,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target)
         {
             uint32_t argc = command.GetArgumentCount();
@@ -215,8 +215,9 @@
 {
 public:
 
-    CommandObjectTargetImageSearchPathsList () :
-        CommandObject ("target image-search-paths list",
+    CommandObjectTargetImageSearchPathsList (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "target image-search-paths list",
                        "List all current image search path substitution pairs in the current target.",
                        "target image-search-paths list")
     {
@@ -227,11 +228,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target)
         {
             if (command.GetArgumentCount() != 0)
@@ -256,8 +256,9 @@
 {
 public:
 
-    CommandObjectTargetImageSearchPathsQuery () :
-    CommandObject ("target image-search-paths query",
+    CommandObjectTargetImageSearchPathsQuery (CommandInterpreter &interpreter) :
+    CommandObject (interpreter,
+                   "target image-search-paths query",
                    "Transform a path using the first applicable image search path.",
                    "target image-search-paths query <path>")
     {
@@ -268,11 +269,10 @@
     }
 
     bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result)
     {
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target)
         {
             if (command.GetArgumentCount() != 1)
@@ -310,7 +310,8 @@
 //public:
 //
 //    CommandObjectTargetSelect () :
-//    CommandObject ("frame select",
+//    CommandObject (interpreter,
+//                   frame select",
 //                   "Select the current frame by index in the current thread.",
 //                   "frame select <frame-index>")
 //    {
@@ -323,7 +324,7 @@
 //    bool
 //    Execute (Args& command,
 //             Debugger *context,
-//             CommandInterpreter &interpreter,
+//             CommandInterpreter &m_interpreter,
 //             CommandReturnObject &result)
 //    {
 //        ExecutionContext exe_ctx (context->GetExecutionContext());
@@ -344,7 +345,7 @@
 //                    {
 //                        if (DisplayFrameForExecutionContext (exe_ctx.thread,
 //                                                             exe_ctx.frame,
-//                                                             interpreter,
+//                                                             m_interpreter,
 //                                                             result.GetOutputStream(),
 //                                                             true,
 //                                                             true,
@@ -388,15 +389,16 @@
 public:
 
     CommandObjectMultiwordImageSearchPaths (CommandInterpreter &interpreter) :
-        CommandObjectMultiword ("target image-search-paths",
+        CommandObjectMultiword (interpreter, 
+                                "target image-search-paths",
                                 "A set of commands for operating on debugger target image search paths.",
                                 "target image-search-paths <subcommand> [<subcommand-options>]")
     {
-        LoadSubCommand (interpreter, "add",     CommandObjectSP (new CommandObjectTargetImageSearchPathsAdd ()));
-        LoadSubCommand (interpreter, "clear",   CommandObjectSP (new CommandObjectTargetImageSearchPathsClear ()));
-        LoadSubCommand (interpreter, "insert",  CommandObjectSP (new CommandObjectTargetImageSearchPathsInsert ()));
-        LoadSubCommand (interpreter, "list",    CommandObjectSP (new CommandObjectTargetImageSearchPathsList ()));
-        LoadSubCommand (interpreter, "query",   CommandObjectSP (new CommandObjectTargetImageSearchPathsQuery ()));
+        LoadSubCommand ("add",     CommandObjectSP (new CommandObjectTargetImageSearchPathsAdd (interpreter)));
+        LoadSubCommand ("clear",   CommandObjectSP (new CommandObjectTargetImageSearchPathsClear (interpreter)));
+        LoadSubCommand ("insert",  CommandObjectSP (new CommandObjectTargetImageSearchPathsInsert (interpreter)));
+        LoadSubCommand ("list",    CommandObjectSP (new CommandObjectTargetImageSearchPathsList (interpreter)));
+        LoadSubCommand ("query",   CommandObjectSP (new CommandObjectTargetImageSearchPathsQuery (interpreter)));
     }
 
     ~CommandObjectMultiwordImageSearchPaths()
@@ -412,11 +414,12 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMultiwordTarget::CommandObjectMultiwordTarget (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("target",
+    CommandObjectMultiword (interpreter,
+                            "target",
                             "A set of commands for operating on debugger targets.",
                             "target <subcommand> [<subcommand-options>]")
 {
-    LoadSubCommand (interpreter, "image-search-paths", CommandObjectSP (new CommandObjectMultiwordImageSearchPaths (interpreter)));
+    LoadSubCommand ("image-search-paths", CommandObjectSP (new CommandObjectMultiwordImageSearchPaths (interpreter)));
 }
 
 CommandObjectMultiwordTarget::~CommandObjectMultiwordTarget ()

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Sep 17 20:14:36 2010
@@ -330,8 +330,9 @@
         uint32_t m_start;
     };
 
-    CommandObjectThreadBacktrace () :
-        CommandObject ("thread backtrace",
+    CommandObjectThreadBacktrace (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "thread backtrace",
                        "Show the stack for one or more threads.  If no threads are specified, show the currently selected thread.  Use the thread-index \"all\" to see all threads.",
                        "thread backtrace [<thread-index>] ...",
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
@@ -350,12 +351,7 @@
     }
 
     virtual bool
-    Execute
-    (
-        CommandInterpreter &interpreter,
-        Args& command,
-        CommandReturnObject &result
-    )
+    Execute (Args& command, CommandReturnObject &result)
     {
 
         bool show_frame_info = true;
@@ -365,11 +361,11 @@
         
         if (command.GetArgumentCount() == 0)
         {
-            ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+            ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
             if (exe_ctx.thread)
             {
                 if (DisplayFramesForExecutionContext (exe_ctx.thread,
-                                                      interpreter,
+                                                      m_interpreter,
                                                       result.GetOutputStream(),
                                                       m_options.m_start,
                                                       m_options.m_count,
@@ -389,13 +385,13 @@
         }
         else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
         {
-            Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+            Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
             uint32_t num_threads = process->GetThreadList().GetSize();
             for (uint32_t i = 0; i < num_threads; i++)
             {
                 ThreadSP thread_sp = process->GetThreadList().GetThreadAtIndex(i);
                 if (!DisplayFramesForExecutionContext (thread_sp.get(),
-                                                      interpreter,
+                                                      m_interpreter,
                                                       result.GetOutputStream(),
                                                       m_options.m_start,
                                                       m_options.m_count,
@@ -415,7 +411,7 @@
         else
         {
             uint32_t num_args = command.GetArgumentCount();
-            Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+            Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
             std::vector<ThreadSP> thread_sps;
 
             for (uint32_t i = 0; i < num_args; i++)
@@ -444,7 +440,7 @@
             for (uint32_t i = 0; i < num_args; i++)
             {
                 if (!DisplayFramesForExecutionContext (thread_sps[i].get(),
-                                                      interpreter,
+                                                      m_interpreter,
                                                       result.GetOutputStream(),
                                                       m_options.m_start,
                                                       m_options.m_count,
@@ -566,13 +562,14 @@
         std::string m_avoid_regexp;
     };
 
-    CommandObjectThreadStepWithTypeAndScope (const char *name,
-                         const char *help,
-                         const char *syntax,
-                         uint32_t flags,
-                         StepType step_type,
-                         StepScope step_scope) :
-        CommandObject (name, help, syntax, flags),
+    CommandObjectThreadStepWithTypeAndScope (CommandInterpreter &interpreter,
+                                             const char *name,
+                                             const char *help,
+                                             const char *syntax,
+                                             uint32_t flags,
+                                             StepType step_type,
+                                             StepScope step_scope) :
+        CommandObject (interpreter, name, help, syntax, flags),
         m_step_type (step_type),
         m_step_scope (step_scope),
         m_options ()
@@ -594,13 +591,12 @@
     virtual bool
     Execute 
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
-        bool synchronous_execution = interpreter.GetSynchronous();
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
+        bool synchronous_execution = m_interpreter.GetSynchronous();
 
         if (process == NULL)
         {
@@ -791,8 +787,9 @@
 {
 public:
 
-    CommandObjectThreadContinue () :
-        CommandObject ("thread continue",
+    CommandObjectThreadContinue (CommandInterpreter &interpreter) :
+        CommandObject (interpreter, 
+                       "thread continue",
                        "Continue execution of one or more threads in an active process.",
                        "thread continue <thread-index> [<thread-index> ...]",
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
@@ -808,21 +805,20 @@
     virtual bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
-        bool synchronous_execution = interpreter.GetSynchronous ();
+        bool synchronous_execution = m_interpreter.GetSynchronous ();
 
-        if (!interpreter.GetDebugger().GetSelectedTarget().get())
+        if (!m_interpreter.GetDebugger().GetSelectedTarget().get())
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
             result.SetStatus (eReturnStatusFailed);
             return false;
         }
 
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError ("no process exists. Cannot continue");
@@ -1035,8 +1031,9 @@
         // Instance variables to hold the values for command options.
     };
 
-    CommandObjectThreadUntil () :
-        CommandObject ("thread until",
+    CommandObjectThreadUntil (CommandInterpreter &interpreter) :
+        CommandObject (interpreter, 
+                       "thread until",
                        "Run the current or specified thread until it reaches a given line number or leaves the current function.",
                        "thread until [<cmd-options>] <line-number>",
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
@@ -1060,14 +1057,13 @@
     virtual bool
     Execute 
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
-        bool synchronous_execution = interpreter.GetSynchronous ();
+        bool synchronous_execution = m_interpreter.GetSynchronous ();
 
-        Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target == NULL)
         {
             result.AppendError ("invalid target, set executable file using 'file' command");
@@ -1075,7 +1071,7 @@
             return false;
         }
 
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError ("need a valid process to step");
@@ -1234,11 +1230,12 @@
 {
 public:
 
-    CommandObjectThreadSelect () :
-        CommandObject ("thread select",
-                         "Select a thread as the currently active thread.",
-                         "thread select <thread-index>",
-                         eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+    CommandObjectThreadSelect (CommandInterpreter &interpreter) :
+        CommandObject (interpreter,
+                       "thread select",
+                       "Select a thread as the currently active thread.",
+                       "thread select <thread-index>",
+                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
     {
     }
 
@@ -1251,12 +1248,11 @@
     virtual bool
     Execute 
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
-        Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+        Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
         if (process == NULL)
         {
             result.AppendError ("no process");
@@ -1283,7 +1279,7 @@
         process->GetThreadList().SetSelectedThreadByID(new_thread->GetID());
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
         
-        DisplayThreadInfo (interpreter,
+        DisplayThreadInfo (m_interpreter,
                            result.GetOutputStream(),
                            new_thread,
                            false,
@@ -1304,8 +1300,9 @@
 public:
 
 
-    CommandObjectThreadList ():
-        CommandObject ("thread list",
+    CommandObjectThreadList (CommandInterpreter &interpreter):
+        CommandObject (interpreter,
+                       "thread list",
                        "Show a summary of all current threads in a process.",
                        "thread list",
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
@@ -1319,14 +1316,13 @@
     bool
     Execute
     (
-        CommandInterpreter &interpreter,
         Args& command,
         CommandReturnObject &result
     )
     {
         StreamString &strm = result.GetOutputStream();
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
         if (exe_ctx.process)
         {
             const StateType state = exe_ctx.process->GetState();
@@ -1350,7 +1346,7 @@
                         exe_ctx.thread = exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get();
                     if (exe_ctx.thread != NULL)
                     {
-                        DisplayThreadsInfo (interpreter, &exe_ctx, result, false, false);
+                        DisplayThreadsInfo (m_interpreter, &exe_ctx, result, false, false);
                     }
                     else
                     {
@@ -1379,50 +1375,60 @@
 //-------------------------------------------------------------------------
 
 CommandObjectMultiwordThread::CommandObjectMultiwordThread (CommandInterpreter &interpreter) :
-    CommandObjectMultiword ("thread",
+    CommandObjectMultiword (interpreter,
+                            "thread",
                             "A set of commands for operating on one or more threads within a running process.",
                             "thread <subcommand> [<subcommand-options>]")
 {
-    LoadSubCommand (interpreter, "backtrace",  CommandObjectSP (new CommandObjectThreadBacktrace ()));
-    LoadSubCommand (interpreter, "continue",   CommandObjectSP (new CommandObjectThreadContinue ()));
-    LoadSubCommand (interpreter, "list",       CommandObjectSP (new CommandObjectThreadList ()));
-    LoadSubCommand (interpreter, "select",     CommandObjectSP (new CommandObjectThreadSelect ()));
-    LoadSubCommand (interpreter, "until",      CommandObjectSP (new CommandObjectThreadUntil ()));
-    LoadSubCommand (interpreter, "step-in",    CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
+    LoadSubCommand ("backtrace",  CommandObjectSP (new CommandObjectThreadBacktrace (interpreter)));
+    LoadSubCommand ("continue",   CommandObjectSP (new CommandObjectThreadContinue (interpreter)));
+    LoadSubCommand ("list",       CommandObjectSP (new CommandObjectThreadList (interpreter)));
+    LoadSubCommand ("select",     CommandObjectSP (new CommandObjectThreadSelect (interpreter)));
+    LoadSubCommand ("until",      CommandObjectSP (new CommandObjectThreadUntil (interpreter)));
+    LoadSubCommand ("step-in",    CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
+                                                    interpreter,
                                                     "thread step-in",
-                                                     "Source level single step in specified thread (current thread, if none specified).",
-                                                     "thread step-in [<thread-id>]",
-                                                     eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
-                                                     eStepTypeInto,
-                                                     eStepScopeSource)));
+                                                    "Source level single step in specified thread (current thread, if none specified).",
+                                                    "thread step-in [<thread-id>]",
+                                                    eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
+                                                    eStepTypeInto,
+                                                    eStepScopeSource)));
     
-    LoadSubCommand (interpreter, "step-out",    CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-out",
-                                                                                      "Finish executing the current fucntion and return to its call site in specified thread (current thread, if none specified).",
-                                                                                      "thread step-out [<thread-id>]",
-                                                                                      eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
-                                                                                      eStepTypeOut,
-                                                                                      eStepScopeSource)));
-
-    LoadSubCommand (interpreter, "step-over",   CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-over",
-                                                                                      "Source level single step in specified thread (current thread, if none specified), stepping over calls.",
-                                                                                      "thread step-over [<thread-id>]",
-                                                                                      eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
-                                                                                      eStepTypeOver,
-                                                                                      eStepScopeSource)));
-
-    LoadSubCommand (interpreter, "step-inst",   CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-inst",
-                                                                                      "Single step one instruction in specified thread (current thread, if none specified).",
-                                                                                      "thread step-inst [<thread-id>]",
-                                                                                      eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
-                                                                                      eStepTypeTrace,
-                                                                                      eStepScopeInstruction)));
-
-    LoadSubCommand (interpreter, "step-inst-over", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-inst-over",
-                                                                                      "Single step one instruction in specified thread (current thread, if none specified), stepping over calls.",
-                                                                                      "thread step-inst-over [<thread-id>]",
-                                                                                      eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
-                                                                                      eStepTypeTraceOver,
-                                                                                      eStepScopeInstruction)));
+    LoadSubCommand ("step-out",   CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
+                                                    interpreter,
+                                                    "thread step-out",
+                                                    "Finish executing the current fucntion and return to its call site in specified thread (current thread, if none specified).",
+                                                    "thread step-out [<thread-id>]",
+                                                    eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
+                                                    eStepTypeOut,
+                                                    eStepScopeSource)));
+
+    LoadSubCommand ("step-over",   CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
+                                                    interpreter,
+                                                    "thread step-over",
+                                                    "Source level single step in specified thread (current thread, if none specified), stepping over calls.",
+                                                    "thread step-over [<thread-id>]",
+                                                    eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
+                                                    eStepTypeOver,
+                                                    eStepScopeSource)));
+
+    LoadSubCommand ("step-inst",   CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
+                                                    interpreter,
+                                                    "thread step-inst",
+                                                    "Single step one instruction in specified thread (current thread, if none specified).",
+                                                    "thread step-inst [<thread-id>]",
+                                                    eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
+                                                    eStepTypeTrace,
+                                                    eStepScopeInstruction)));
+
+    LoadSubCommand ("step-inst-over", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
+                                                    interpreter,
+                                                    "thread step-inst-over",
+                                                    "Single step one instruction in specified thread (current thread, if none specified), stepping over calls.",
+                                                    "thread step-inst-over [<thread-id>]",
+                                                    eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
+                                                    eStepTypeTraceOver,
+                                                    eStepScopeInstruction)));
 }
 
 CommandObjectMultiwordThread::~CommandObjectMultiwordThread ()

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Fri Sep 17 20:14:36 2010
@@ -595,38 +595,27 @@
 bool
 Debugger::DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Error err)
 {
-    bool valid = true;
+    bool valid = false;
 
     // Verify we have a value string.
-    if (value == NULL
-        || strlen (value) == 0)
+    if (value == NULL || value[0] == '\0')
     {
-        valid = false;
-        err.SetErrorString ("Missing value.  Can't set terminal width without a value.\n");
+        err.SetErrorString ("Missing value. Can't set terminal width without a value.\n");
     }
-
-    // Verify the string consists entirely of digits.
-    if (valid)
+    else
     {
-        int len = strlen (value);
-        for (int i = 0; i < len; ++i)
-            if (! isdigit (value[i]))
-            {
-                valid = false;
-                err.SetErrorStringWithFormat ("'%s' is not a valid representation of an unsigned integer.\n", value);
-            }
-    }
-
-    // Verify the term-width is 'reasonable' (e.g. 10 <= width <= 250).
-    if (valid)
-    {
-        int width = atoi (value);
-        if (width < 10
-            || width > 250)
+        char *end = NULL;
+        const uint32_t width = ::strtoul (value, &end, 0);
+        
+        if (end && end == '\0')
         {
-            valid = false;
-            err.SetErrorString ("Invalid term-width value; value must be between 10 and 250.\n");
+            if (width >= 10 || width <= 1024)
+                valid = true;
+            else
+                err.SetErrorString ("Invalid term-width value; value must be between 10 and 1024.\n");
         }
+        else
+            err.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string.\n", value);
     }
 
     return valid;
@@ -637,9 +626,14 @@
 //  class DebuggerInstanceSettings
 //--------------------------------------------------
 
-DebuggerInstanceSettings::DebuggerInstanceSettings (UserSettingsController &owner, bool live_instance,
-                                                    const char *name) :
+DebuggerInstanceSettings::DebuggerInstanceSettings 
+(
+    UserSettingsController &owner, 
+    bool live_instance,
+    const char *name
+) :
     InstanceSettings (owner, (name == NULL ? InstanceSettings::InvalidName().AsCString() : name), live_instance),
+    m_term_width (80),
     m_prompt (),
     m_script_lang ()
 {
@@ -725,7 +719,7 @@
     {
         if (ValidTermWidthValue (value, err))
         {
-            m_term_width = atoi (value);
+            m_term_width = ::strtoul (value, NULL, 0);
         }
     }
 }

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Sep 17 20:14:36 2010
@@ -149,29 +149,30 @@
     bool success;
     script_language = Args::StringToScriptLanguage (value.GetStringAtIndex(0), lldb::eScriptLanguageDefault, &success);
     
-    m_command_dict["apropos"]   = CommandObjectSP (new CommandObjectApropos ());
+    m_command_dict["apropos"]   = CommandObjectSP (new CommandObjectApropos (*this));
     m_command_dict["breakpoint"]= CommandObjectSP (new CommandObjectMultiwordBreakpoint (*this));
-    //m_command_dict["call"]      = CommandObjectSP (new CommandObjectCall ());
+    //m_command_dict["call"]      = CommandObjectSP (new CommandObjectCall (*this));
     m_command_dict["commands"]  = CommandObjectSP (new CommandObjectMultiwordCommands (*this));
-    m_command_dict["disassemble"] = CommandObjectSP (new CommandObjectDisassemble ());
-    m_command_dict["expression"]= CommandObjectSP (new CommandObjectExpression ());
-    m_command_dict["file"]      = CommandObjectSP (new CommandObjectFile ());
+    m_command_dict["disassemble"] = CommandObjectSP (new CommandObjectDisassemble (*this));
+    m_command_dict["expression"]= CommandObjectSP (new CommandObjectExpression (*this));
+    m_command_dict["file"]      = CommandObjectSP (new CommandObjectFile (*this));
     m_command_dict["frame"]     = CommandObjectSP (new CommandObjectMultiwordFrame (*this));
-    m_command_dict["help"]      = CommandObjectSP (new CommandObjectHelp ());
+    m_command_dict["help"]      = CommandObjectSP (new CommandObjectHelp (*this));
     m_command_dict["image"]     = CommandObjectSP (new CommandObjectImage (*this));
     m_command_dict["log"]       = CommandObjectSP (new CommandObjectLog (*this));
     m_command_dict["memory"]    = CommandObjectSP (new CommandObjectMemory (*this));
     m_command_dict["process"]   = CommandObjectSP (new CommandObjectMultiwordProcess (*this));
-    m_command_dict["quit"]      = CommandObjectSP (new CommandObjectQuit ());
+    m_command_dict["quit"]      = CommandObjectSP (new CommandObjectQuit (*this));
     m_command_dict["register"]  = CommandObjectSP (new CommandObjectRegister (*this));
-    m_command_dict["script"]    = CommandObjectSP (new CommandObjectScript (script_language));
+    m_command_dict["script"]    = CommandObjectSP (new CommandObjectScript (*this, script_language));
     m_command_dict["settings"]  = CommandObjectSP (new CommandObjectMultiwordSettings (*this));
     m_command_dict["source"]    = CommandObjectSP (new CommandObjectMultiwordSource (*this));
     m_command_dict["target"]    = CommandObjectSP (new CommandObjectMultiwordTarget (*this));
     m_command_dict["thread"]    = CommandObjectSP (new CommandObjectMultiwordThread (*this));
 
     std::auto_ptr<CommandObjectRegexCommand>
-    break_regex_cmd_ap(new CommandObjectRegexCommand ("regexp-break",
+    break_regex_cmd_ap(new CommandObjectRegexCommand (*this,
+                                                      "regexp-break",
                                                       "Set a breakpoint using a regular expression to specify the location.",
                                                       "regexp-break [<file>:<line>]\nregexp-break [<address>]\nregexp-break <...>", 2));
     if (break_regex_cmd_ap.get())
@@ -574,14 +575,14 @@
                         stripped_command += strlen(command_cstr);
                         while (isspace(*stripped_command))
                             ++stripped_command;
-                        command_obj->ExecuteRawCommandString (*this, stripped_command, result);
+                        command_obj->ExecuteRawCommandString (stripped_command, result);
                     }
                 }
                 else
                 {
                     // Remove the command from the args.
                     command_args.Shift();
-                    command_obj->ExecuteWithOptions (*this, command_args, result);
+                    command_obj->ExecuteWithOptions (command_args, result);
                 }
             }
             else
@@ -681,8 +682,7 @@
         {
             parsed_line.Shift();
             cursor_index--;
-            num_command_matches = command_object->HandleCompletion (*this,
-                                                                    parsed_line, 
+            num_command_matches = command_object->HandleCompletion (parsed_line, 
                                                                     cursor_index, 
                                                                     cursor_char_position,
                                                                     match_start_point, 
@@ -1010,7 +1010,7 @@
     if (pos != m_command_dict.end())
     {
         CommandObject *script_cmd_obj = pos->second.get();
-        return ((CommandObjectScript *) script_cmd_obj)->GetInterpreter (*this);
+        return ((CommandObjectScript *) script_cmd_obj)->GetInterpreter ();
     }
     return NULL;
 }
@@ -1041,15 +1041,8 @@
                                              const char *help_text,
                                              uint32_t max_word_len)
 {
-    lldb::SettableVariableType var_type;
-    const char *width_value = 
-      Debugger::GetSettingsController()->GetVariable ("term-width", var_type,
-                                                      m_debugger.GetInstanceName().AsCString()).GetStringAtIndex(0);
-    int max_columns = atoi (width_value);
-    // Sanity check max_columns, to cope with emacs shell mode with TERM=dumb
-    // (0 rows; 0 columns;).
-    if (max_columns <= 0) max_columns = 80;
-    
+    const uint32_t max_columns = m_debugger.GetTerminalWidth();
+
     int indent_size = max_word_len + strlen (separator) + 2;
 
     strm.IndentMore (indent_size);
@@ -1135,7 +1128,7 @@
           
           complete_command_name.Printf ("%s %s", prefix, command_name);
 
-          if (sub_cmd_obj->HelpTextContainsWord (search_word, *this))
+          if (sub_cmd_obj->HelpTextContainsWord (search_word))
           {
               commands_found.AppendString (complete_command_name.GetData());
               commands_help.AppendString (sub_cmd_obj->GetHelp());
@@ -1159,7 +1152,7 @@
         const char *command_name = pos->first.c_str();
         CommandObject *cmd_obj = pos->second.get();
 
-        if (cmd_obj->HelpTextContainsWord (search_word, *this))
+        if (cmd_obj->HelpTextContainsWord (search_word))
         {
             commands_found.AppendString (command_name);
             commands_help.AppendString (cmd_obj->GetHelp());

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Fri Sep 17 20:14:36 2010
@@ -38,7 +38,15 @@
 // CommandObject
 //-------------------------------------------------------------------------
 
-CommandObject::CommandObject (const char *name, const char *help, const char *syntax, uint32_t flags) :
+CommandObject::CommandObject 
+(
+    CommandInterpreter &interpreter, 
+    const char *name, 
+    const char *help, 
+    const char *syntax, 
+    uint32_t flags
+) :
+    m_interpreter (interpreter),
     m_cmd_name (name),
     m_cmd_help_short (),
     m_cmd_help_long (),
@@ -134,19 +142,17 @@
 bool
 CommandObject::ExecuteCommandString
 (
-    CommandInterpreter &interpreter,
     const char *command_line,
     CommandReturnObject &result
 )
 {
     Args command_args(command_line);
-    return ExecuteWithOptions (interpreter, command_args, result);
+    return ExecuteWithOptions (command_args, result);
 }
 
 bool
 CommandObject::ParseOptions
 (
-    CommandInterpreter &interpreter,
     Args& args,
     CommandReturnObject &result
 )
@@ -177,8 +183,7 @@
             else
             {
                 // No error string, output the usage information into result
-                options->GenerateOptionUsage (result.GetErrorStream(), this,
-                                              interpreter.GetDebugger().GetInstanceName().AsCString());
+                options->GenerateOptionUsage (m_interpreter, result.GetErrorStream(), this);
             }
             // Set the return status to failed (this was an error).
             result.SetStatus (eReturnStatusFailed);
@@ -188,21 +193,16 @@
     return true;
 }
 bool
-CommandObject::ExecuteWithOptions
-(
-    CommandInterpreter &interpreter,
-    Args& args,
-    CommandReturnObject &result
-)
+CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result)
 {
     for (size_t i = 0; i < args.GetArgumentCount();  ++i)
     {
         const char *tmp_str = args.GetArgumentAtIndex (i);
         if (tmp_str[0] == '`')  // back-quote
-            args.ReplaceArgumentAtIndex (i, interpreter.ProcessEmbeddedScriptCommands (tmp_str));
+            args.ReplaceArgumentAtIndex (i, m_interpreter.ProcessEmbeddedScriptCommands (tmp_str));
     }
 
-    Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+    Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
     if (process == NULL)
     {
         if (GetFlags().IsSet(CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused))
@@ -248,11 +248,11 @@
         }
     }
     
-    if (!ParseOptions (interpreter, args, result))
+    if (!ParseOptions (args, result))
         return false;
 
     // Call the command-specific version of 'Execute', passing it the already processed arguments.
-    return Execute (interpreter, args, result);
+    return Execute (args, result);
 }
 
 class CommandDictCommandPartialMatch
@@ -300,7 +300,6 @@
 int
 CommandObject::HandleCompletion
 (
-    CommandInterpreter &interpreter,
     Args &input,
     int &cursor_index,
     int &cursor_char_position,
@@ -341,7 +340,7 @@
             input.DeleteArgumentAtIndex(input.GetArgumentCount() - 1);
 
             bool handled_by_options;
-            handled_by_options = cur_options->HandleOptionCompletion (interpreter, 
+            handled_by_options = cur_options->HandleOptionCompletion (m_interpreter, 
                                                                       input,
                                                                       opt_element_vector,
                                                                       cursor_index,
@@ -355,8 +354,7 @@
         }
 
         // If we got here, the last word is not an option or an option argument.
-        return HandleArgumentCompletion (interpreter, 
-                                         input,
+        return HandleArgumentCompletion (input,
                                          cursor_index,
                                          cursor_char_position,
                                          opt_element_vector,
@@ -397,7 +395,7 @@
 }
 
 bool
-CommandObject::HelpTextContainsWord (const char *search_word, CommandInterpreter &interpreter)
+CommandObject::HelpTextContainsWord (const char *search_word)
 {
     const char *short_help;
     const char *long_help;
@@ -422,7 +420,7 @@
         && GetOptions() != NULL)
     {
         StreamString usage_help;
-        GetOptions()->GenerateOptionUsage (usage_help, this, interpreter.GetDebugger().GetInstanceName().AsCString());
+        GetOptions()->GenerateOptionUsage (m_interpreter, usage_help, this);
         if (usage_help.GetSize() > 0)
         {
             const char *usage_text = usage_help.GetData();

Modified: lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp Fri Sep 17 20:14:36 2010
@@ -24,12 +24,13 @@
 //----------------------------------------------------------------------
 CommandObjectRegexCommand::CommandObjectRegexCommand
 (
+    CommandInterpreter &interpreter,
     const char *name,
     const char *help,
     const char *syntax,
     uint32_t max_matches
 ) :
-    CommandObject (name, help, syntax),
+    CommandObject (interpreter, name, help, syntax),
     m_max_matches (max_matches),
     m_entries ()
 {
@@ -46,7 +47,6 @@
 bool
 CommandObjectRegexCommand::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
@@ -58,7 +58,6 @@
 bool
 CommandObjectRegexCommand::ExecuteRawCommandString
 (
-    CommandInterpreter &interpreter,
     const char *command,
     CommandReturnObject &result
 )
@@ -90,7 +89,7 @@
                 // Interpret the new command and return this as the result!
 //                if (m_options.verbose)
 //                    result.GetOutputStream().Printf("%s\n", new_command.c_str());
-                return interpreter.HandleCommand(new_command.c_str(), true, result);
+                return m_interpreter.HandleCommand(new_command.c_str(), true, result);
             }
         }
         result.SetStatus(eReturnStatusFailed);

Modified: lldb/trunk/source/Interpreter/CommandObjectScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectScript.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectScript.cpp Fri Sep 17 20:14:36 2010
@@ -27,8 +27,9 @@
 // CommandObjectScript
 //-------------------------------------------------------------------------
 
-CommandObjectScript::CommandObjectScript (ScriptLanguage script_lang) :
-    CommandObject ("script",
+CommandObjectScript::CommandObjectScript (CommandInterpreter &interpreter, ScriptLanguage script_lang) :
+    CommandObject (interpreter, 
+                   "script",
                    "Pass an expression to the script interpreter for evaluation and return the results. Drop into the interactive interpreter if no expression is given.",
                    "script [<script-expression-for-evaluation>]"),
     m_script_lang (script_lang),
@@ -43,12 +44,11 @@
 bool
 CommandObjectScript::ExecuteRawCommandString
 (
-    CommandInterpreter &interpreter,
     const char *command,
     CommandReturnObject &result
 )
 {
-    ScriptInterpreter *script_interpreter = GetInterpreter (interpreter);
+    ScriptInterpreter *script_interpreter = GetInterpreter ();
 
     if (script_interpreter == NULL)
     {
@@ -57,13 +57,13 @@
     }
 
     if (command == NULL || command[0] == '\0') {
-        script_interpreter->ExecuteInterpreterLoop (interpreter);
+        script_interpreter->ExecuteInterpreterLoop ();
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
         return result.Succeeded();
     }
 
     // We can do better when reporting the status of one-liner script execution.
-    if (script_interpreter->ExecuteOneLine (interpreter, command, &result))
+    if (script_interpreter->ExecuteOneLine (command, &result))
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
     else
         result.SetStatus(eReturnStatusFailed);
@@ -80,7 +80,6 @@
 bool
 CommandObjectScript::Execute
 (
-    CommandInterpreter &interpreter,
     Args& command,
     CommandReturnObject &result
 )
@@ -91,18 +90,18 @@
 
 
 ScriptInterpreter *
-CommandObjectScript::GetInterpreter (CommandInterpreter &interpreter)
+CommandObjectScript::GetInterpreter ()
 {
     if (m_interpreter_ap.get() == NULL)
     {
         switch (m_script_lang)
         {
         case eScriptLanguagePython:
-            m_interpreter_ap.reset (new ScriptInterpreterPython (interpreter));
+            m_interpreter_ap.reset (new ScriptInterpreterPython (m_interpreter));
             break;
 
         case eScriptLanguageNone:
-            m_interpreter_ap.reset (new ScriptInterpreterNone (interpreter));
+            m_interpreter_ap.reset (new ScriptInterpreterNone (m_interpreter));
             break;
         }
     }

Modified: lldb/trunk/source/Interpreter/CommandObjectScript.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.h?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectScript.h (original)
+++ lldb/trunk/source/Interpreter/CommandObjectScript.h Fri Sep 17 20:14:36 2010
@@ -26,7 +26,8 @@
 {
 public:
 
-    CommandObjectScript (lldb::ScriptLanguage script_lang);
+    CommandObjectScript (CommandInterpreter &interpreter,
+                         lldb::ScriptLanguage script_lang);
 
     virtual
     ~CommandObjectScript ();
@@ -34,17 +35,15 @@
     bool WantsRawCommandString();
 
     virtual bool
-    ExecuteRawCommandString (CommandInterpreter &interpreter,
-                             const char *command,
+    ExecuteRawCommandString (const char *command,
                              CommandReturnObject &result);
 
     virtual bool
-    Execute (CommandInterpreter &interpreter,
-             Args& command,
+    Execute (Args& command,
              CommandReturnObject &result);
 
     ScriptInterpreter *
-    GetInterpreter (CommandInterpreter &interpreter);
+    GetInterpreter ();
 
 private:
     lldb::ScriptLanguage m_script_lang;

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Fri Sep 17 20:14:36 2010
@@ -361,27 +361,21 @@
 void
 Options::GenerateOptionUsage
 (
+    CommandInterpreter &interpreter,
     Stream &strm,
-    CommandObject *cmd,
-    const char *debugger_instance_name,
-    const char *program_name)
+    CommandObject *cmd
+)
 {
-    lldb::SettableVariableType var_type;
-    const char *screen_width_str = 
-      Debugger::GetSettingsController()->GetVariable ("term-width", var_type,
-                                                      debugger_instance_name).GetStringAtIndex(0);
-    uint32_t screen_width = atoi (screen_width_str);
-    if (screen_width == 0)
-        screen_width = 80;
+    const uint32_t screen_width = interpreter.GetDebugger().GetTerminalWidth();
 
     const lldb::OptionDefinition *full_options_table = GetDefinitions();
     const uint32_t save_indent_level = strm.GetIndentLevel();
     const char *name;
 
     if (cmd)
-      name = cmd->GetCommandName();
+        name = cmd->GetCommandName();
     else
-      name = program_name;
+        name = "";
 
     strm.PutCString ("\nCommand Options Usage:\n");
 

Modified: lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreter.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreter.cpp Fri Sep 17 20:14:36 2010
@@ -22,7 +22,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ScriptInterpreter::ScriptInterpreter (ScriptLanguage script_lang) :
+ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, ScriptLanguage script_lang) :
+    m_interpreter (interpreter),
     m_script_lang (script_lang),
     m_interpreter_pty ()
 {
@@ -54,7 +55,6 @@
 void 
 ScriptInterpreter::CollectDataForBreakpointCommandCallback 
 (
-    CommandInterpreter &interpreter,
     BreakpointOptions *bp_options,
     CommandReturnObject &result
 )

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp Fri Sep 17 20:14:36 2010
@@ -17,7 +17,7 @@
 using namespace lldb_private;
 
 ScriptInterpreterNone::ScriptInterpreterNone (CommandInterpreter &interpreter) :
-    ScriptInterpreter (eScriptLanguageNone)
+    ScriptInterpreter (interpreter, eScriptLanguageNone)
 {
 }
 
@@ -26,16 +26,16 @@
 }
 
 bool
-ScriptInterpreterNone::ExecuteOneLine (CommandInterpreter &interpreter, const char *command, CommandReturnObject *)
+ScriptInterpreterNone::ExecuteOneLine (const char *command, CommandReturnObject *)
 {
-    interpreter.GetDebugger().GetErrorStream().PutCString ("error: there is no embedded script interpreter in this mode.\n");
+    m_interpreter.GetDebugger().GetErrorStream().PutCString ("error: there is no embedded script interpreter in this mode.\n");
     return false;
 }
 
 void
-ScriptInterpreterNone::ExecuteInterpreterLoop (CommandInterpreter &interpreter)
+ScriptInterpreterNone::ExecuteInterpreterLoop ()
 {
-    interpreter.GetDebugger().GetErrorStream().PutCString ("error: there is no embedded script interpreter in this mode.\n");
+    m_interpreter.GetDebugger().GetErrorStream().PutCString ("error: there is no embedded script interpreter in this mode.\n");
 }
 
 

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Fri Sep 17 20:14:36 2010
@@ -144,7 +144,7 @@
 }
 
 ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interpreter) :
-    ScriptInterpreter (eScriptLanguagePython),
+    ScriptInterpreter (interpreter, eScriptLanguagePython),
     m_compiled_module (NULL),
     m_termios_valid (false)
 {
@@ -254,9 +254,7 @@
 }
 
 bool
-ScriptInterpreterPython::ExecuteOneLine (CommandInterpreter &interpreter,
-                                         const char *command,
-                                         CommandReturnObject *result = 0)
+ScriptInterpreterPython::ExecuteOneLine (const char *command, CommandReturnObject *result)
 {
     if (command)
     {
@@ -357,11 +355,11 @@
 
 
 void
-ScriptInterpreterPython::ExecuteInterpreterLoop (CommandInterpreter &interpreter)
+ScriptInterpreterPython::ExecuteInterpreterLoop ()
 {
     Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
 
-    Debugger &debugger = interpreter.GetDebugger();
+    Debugger &debugger = m_interpreter.GetDebugger();
 
     // At the moment, the only time the debugger does not have an input file handle is when this is called
     // directly from Python, in which case it is both dangerous and unnecessary (not to mention confusing) to
@@ -384,7 +382,7 @@
         if (error.Success())
         {
             debugger.PushInputReader (reader_sp);
-            ExecuteOneLine (interpreter, "run_python_interpreter(ConsoleDict)");
+            ExecuteOneLine ("run_python_interpreter(ConsoleDict)", NULL);
             debugger.PopInputReader (reader_sp);
         }
     }
@@ -643,11 +641,10 @@
 }
 
 void
-ScriptInterpreterPython::CollectDataForBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                                                  BreakpointOptions *bp_options,
+ScriptInterpreterPython::CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
                                                                   CommandReturnObject &result)
 {
-    Debugger &debugger = interpreter.GetDebugger();
+    Debugger &debugger = m_interpreter.GetDebugger();
     InputReaderSP reader_sp (new InputReader (debugger));
 
     if (reader_sp)
@@ -677,8 +674,7 @@
 
 // Set a Python one-liner as the callback for the breakpoint.
 void
-ScriptInterpreterPython::SetBreakpointCommandCallback (CommandInterpreter &interpreter,
-                                                       BreakpointOptions *bp_options,
+ScriptInterpreterPython::SetBreakpointCommandCallback (BreakpointOptions *bp_options,
                                                        const char *oneliner)
 {
     std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=114252&r1=114251&r2=114252&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Fri Sep 17 20:14:36 2010
@@ -1105,13 +1105,8 @@
     if (isatty (STDIN_FILENO)
         && ::ioctl (STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
     {
-        char buffer[256];
-
         if (window_size.ws_col > 0)
-        {
-            ::snprintf (buffer, sizeof(buffer), "settings set term-width %d", window_size.ws_col);
-            m_debugger.HandleCommand ((const char *) buffer);
-        }
+            m_debugger.SetTerminalWidth (window_size.ws_col);
     }
 
     // Since input can be redirected by the debugger, we must insert our editline





More information about the lldb-commits mailing list