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").



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114252 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 1410d5b..8708d44 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -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 ()