Modified the ArchSpec to take an optional "Platform *" when setting the triple.
This allows you to have a platform selected, then specify a triple using
"i386" and have the remaining triple items (vendor, os, and environment) set
automatically.

Many interpreter commands take the "--arch" option to specify an architecture
triple, so now the command options needed to be able to get to the current
platform, so the Options class now take a reference to the interpreter on
construction.

Modified the build LLVM building in the Xcode project to use the new
Xcode project level user definitions:

LLVM_BUILD_DIR - a path to the llvm build directory
LLVM_SOURCE_DIR - a path to the llvm sources for the llvm that will be used to build lldb
LLVM_CONFIGURATION - the configuration that lldb is built for (Release, 
Release+Asserts, Debug, Debug+Asserts).

I also changed the LLVM build to not check if "lldb/llvm" is a symlink and
then assume it is a real llvm build directory versus the unzipped llvm.zip
package, so now you can actually have a "lldb/llvm" directory in your lldb
sources.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129112 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 5c86d99..c54ff21 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -358,7 +358,7 @@
 {
     if (arch_name)
     {
-        ArchSpec arch (arch_name);
+        ArchSpec arch (arch_name, NULL);
         if (arch.IsValid())
         {
             lldb_private::Target::SetDefaultArchitecture (arch);
@@ -425,7 +425,7 @@
     {
         ArchSpec arch;
         FileSpec file_spec (filename, true);
-        arch.SetTriple (target_triple);
+        arch.SetTriple (target_triple, m_opaque_sp->GetPlatformList().GetSelectedPlatform().get());
         TargetSP target_sp;
         Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, true, target_sp));
         target.reset (target_sp);
@@ -455,7 +455,7 @@
         Error error;
 
         if (arch_cstr)
-            arch.SetTriple (arch_cstr);
+            arch.SetTriple (arch_cstr, m_opaque_sp->GetPlatformList().GetSelectedPlatform().get());
 
         error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
 
@@ -534,7 +534,7 @@
     if (m_opaque_sp && filename && filename[0])
     {
         // No need to lock, the target list is thread safe
-        ArchSpec arch (arch_name);
+        ArchSpec arch (arch_name, m_opaque_sp->GetPlatformList().GetSelectedPlatform().get());
         TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename, false), arch_name ? &arch : NULL));
         sb_target.reset(target_sp);
     }
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index ce90bbb..e46e869 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -140,7 +140,7 @@
 {
     if (m_opaque_sp && triple)
     {
-        lldb_private::ArchSpec arch (triple);
+        lldb_private::ArchSpec arch (triple, NULL);
         
         return m_opaque_sp->Emulate (arch, 
                                      NULL,
diff --git a/source/Commands/CommandObjectArgs.cpp b/source/Commands/CommandObjectArgs.cpp
index f75ac0b..26ffa19 100644
--- a/source/Commands/CommandObjectArgs.cpp
+++ b/source/Commands/CommandObjectArgs.cpp
@@ -36,8 +36,8 @@
 // calling functions.
 //
 
-CommandObjectArgs::CommandOptions::CommandOptions () :
-    Options()
+CommandObjectArgs::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
+    Options(m_interpreter)
 {
     // Keep only one place to reset the values to their defaults
     ResetOptionValues();
@@ -80,7 +80,8 @@
     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")
+                   "args"),
+    m_options (interpreter)
 {
 }
 
diff --git a/source/Commands/CommandObjectArgs.h b/source/Commands/CommandObjectArgs.h
index 544d343..b6a7f32 100644
--- a/source/Commands/CommandObjectArgs.h
+++ b/source/Commands/CommandObjectArgs.h
@@ -28,7 +28,7 @@
         {
         public:
             
-            CommandOptions ();
+            CommandOptions (CommandInterpreter &interpreter);
             
             virtual
             ~CommandOptions ();
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 8208ea8..c828701 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -47,8 +47,8 @@
 //-------------------------------------------------------------------------
 #pragma mark Set::CommandOptions
 
-CommandObjectBreakpointSet::CommandOptions::CommandOptions() :
-    Options (),
+CommandObjectBreakpointSet::CommandOptions::CommandOptions(CommandInterpreter &interpreter) :
+    Options (interpreter),
     m_filename (),
     m_line_num (0),
     m_column (0),
@@ -259,7 +259,8 @@
     CommandObject (interpreter,
                    "breakpoint set", 
                    "Sets a breakpoint or set of breakpoints in the executable.", 
-                   "breakpoint set <cmd-options>")
+                   "breakpoint set <cmd-options>"),
+    m_options (interpreter)
 {
 }
 
@@ -637,8 +638,8 @@
 //-------------------------------------------------------------------------
 #pragma mark List::CommandOptions
 
-CommandObjectBreakpointList::CommandOptions::CommandOptions() :
-    Options (),
+CommandObjectBreakpointList::CommandOptions::CommandOptions(CommandInterpreter &interpreter) :
+    Options (interpreter),
     m_level (lldb::eDescriptionLevelBrief)  // Breakpoint List defaults to brief descriptions
 {
 }
@@ -717,7 +718,8 @@
     CommandObject (interpreter, 
                    "breakpoint list",
                    "List some or all breakpoints at configurable levels of detail.",
-                   NULL)
+                   NULL),
+    m_options (interpreter)
 {
     CommandArgumentEntry arg;
     CommandArgumentData bp_id_arg;
@@ -1045,8 +1047,8 @@
 //-------------------------------------------------------------------------
 #pragma mark Clear::CommandOptions
 
-CommandObjectBreakpointClear::CommandOptions::CommandOptions() :
-    Options (),
+CommandObjectBreakpointClear::CommandOptions::CommandOptions(CommandInterpreter &interpreter) :
+    Options (interpreter),
     m_filename (),
     m_line_num (0)
 {
@@ -1114,7 +1116,8 @@
     CommandObject (interpreter,
                    "breakpoint clear", 
                    "Clears a breakpoint or set of breakpoints in the executable.", 
-                   "breakpoint clear <cmd-options>")
+                   "breakpoint clear <cmd-options>"),
+    m_options (interpreter)
 {
 }
 
@@ -1348,8 +1351,8 @@
 //-------------------------------------------------------------------------
 #pragma mark Modify::CommandOptions
 
-CommandObjectBreakpointModify::CommandOptions::CommandOptions() :
-    Options (),
+CommandObjectBreakpointModify::CommandOptions::CommandOptions(CommandInterpreter &interpreter) :
+    Options (interpreter),
     m_ignore_count (0),
     m_thread_id(LLDB_INVALID_THREAD_ID),
     m_thread_id_passed(false),
@@ -1504,7 +1507,8 @@
                    "Modify the options on a breakpoint or set of breakpoints in the executable.  "
                    "If no breakpoint is specified, acts on the last created breakpoint.  "
                    "With the exception of -e, -d and -i, passing an empty argument clears the modification.", 
-                   NULL)
+                   NULL),
+    m_options (interpreter)
 {
     CommandArgumentEntry arg;
     CommandArgumentData bp_id_arg;
diff --git a/source/Commands/CommandObjectBreakpoint.h b/source/Commands/CommandObjectBreakpoint.h
index fdfd1d9..c624dc5 100644
--- a/source/Commands/CommandObjectBreakpoint.h
+++ b/source/Commands/CommandObjectBreakpoint.h
@@ -76,7 +76,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
@@ -142,7 +142,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
@@ -243,7 +243,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
@@ -303,7 +303,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
diff --git a/source/Commands/CommandObjectBreakpointCommand.cpp b/source/Commands/CommandObjectBreakpointCommand.cpp
index c3d50ea..f481515 100644
--- a/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -31,8 +31,8 @@
 // CommandObjectBreakpointCommandAdd::CommandOptions
 //-------------------------------------------------------------------------
 
-CommandObjectBreakpointCommandAdd::CommandOptions::CommandOptions () :
-    Options (),
+CommandObjectBreakpointCommandAdd::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
+    Options (interpreter),
     m_use_commands (false),
     m_use_script_language (false),
     m_script_language (eScriptLanguageNone),
@@ -153,7 +153,8 @@
     CommandObject (interpreter,
                    "add",
                    "Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit.",
-                   NULL)
+                   NULL),
+    m_options (interpreter)
 {
     SetHelpLong (
 "\nGeneral information about entering breakpoint commands \n\
diff --git a/source/Commands/CommandObjectBreakpointCommand.h b/source/Commands/CommandObjectBreakpointCommand.h
index 5e3e1a1..5cfa848 100644
--- a/source/Commands/CommandObjectBreakpointCommand.h
+++ b/source/Commands/CommandObjectBreakpointCommand.h
@@ -95,7 +95,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index b3a974b..8f8dd96 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -34,7 +34,10 @@
     {
     public:
 
-        CommandOptions (){}
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options (interpreter)
+        {
+        }
 
         virtual
         ~CommandOptions (){}
@@ -106,7 +109,8 @@
         CommandObject (interpreter,
                        "commands source",
                        "Read in debugger commands from the file <filename> and execute them.",
-                       NULL)
+                       NULL),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData file_arg;
diff --git a/source/Commands/CommandObjectDisassemble.cpp b/source/Commands/CommandObjectDisassemble.cpp
index 6567a08..84630ff 100644
--- a/source/Commands/CommandObjectDisassemble.cpp
+++ b/source/Commands/CommandObjectDisassemble.cpp
@@ -32,8 +32,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-CommandObjectDisassemble::CommandOptions::CommandOptions () :
-    Options(),
+CommandObjectDisassemble::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
+    Options(m_interpreter),
     num_lines_context(0),
     num_instructions (0),
     func_name(),
@@ -128,7 +128,7 @@
         break;
 
     case 'a':
-        arch.SetTriple (option_arg);
+        arch.SetTriple (option_arg, m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform().get());
         break;
 
     default:
@@ -195,7 +195,8 @@
     CommandObject (interpreter,
                    "disassemble",
                    "Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
-                   "disassemble [<cmd-options>]")
+                   "disassemble [<cmd-options>]"),
+    m_options (interpreter)
 {
 }
 
@@ -248,10 +249,7 @@
     if (command.GetArgumentCount() != 0)
     {
         result.AppendErrorWithFormat ("\"disassemble\" arguments are specified as options.\n");
-        GetOptions()->GenerateOptionUsage (m_interpreter,
-                                           result.GetErrorStream(), 
-                                           this);
-
+        GetOptions()->GenerateOptionUsage (result.GetErrorStream(), this);
         result.SetStatus (eReturnStatusFailed);
         return false;
     }
diff --git a/source/Commands/CommandObjectDisassemble.h b/source/Commands/CommandObjectDisassemble.h
index 46b4bac..ac354a8 100644
--- a/source/Commands/CommandObjectDisassemble.h
+++ b/source/Commands/CommandObjectDisassemble.h
@@ -30,7 +30,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index 220801f..5e5f968 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -37,8 +37,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-CommandObjectExpression::CommandOptions::CommandOptions () :
-    Options()
+CommandObjectExpression::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
+    Options(m_interpreter)
 {
     // Keep only one place to reset the values to their defaults
     ResetOptionValues();
@@ -115,6 +115,7 @@
                    "expression",
                    "Evaluate a C/ObjC/C++ expression in the current program context, using variables currently in scope.",
                    NULL),
+    m_options (interpreter),
     m_expr_line_count (0),
     m_expr_lines ()
 {
diff --git a/source/Commands/CommandObjectExpression.h b/source/Commands/CommandObjectExpression.h
index 5ddb0db..fcf308a 100644
--- a/source/Commands/CommandObjectExpression.h
+++ b/source/Commands/CommandObjectExpression.h
@@ -29,7 +29,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
diff --git a/source/Commands/CommandObjectFile.cpp b/source/Commands/CommandObjectFile.cpp
index 6f1267e..e0c81bb 100644
--- a/source/Commands/CommandObjectFile.cpp
+++ b/source/Commands/CommandObjectFile.cpp
@@ -25,8 +25,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-CommandObjectFile::CommandOptions::CommandOptions() :
-    Options (),
+CommandObjectFile::CommandOptions::CommandOptions(CommandInterpreter &interpreter) :
+    Options (interpreter),
     m_arch ()  // Breakpoint info defaults to brief descriptions
 {
 }
@@ -58,7 +58,8 @@
     {
         case 'a':
             {
-                ArchSpec option_arch (option_arg);
+                PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+                ArchSpec option_arch (option_arg, platform_sp.get());
                 if (option_arch.IsValid())
                     m_arch = option_arch;
                 else
@@ -88,7 +89,8 @@
     CommandObject (interpreter,
                    "file",
                    "Set the file to be used as the main executable by the debugger.",
-                   NULL)
+                   NULL),
+    m_options (interpreter)
 {
     CommandArgumentEntry arg;
     CommandArgumentData file_arg;
diff --git a/source/Commands/CommandObjectFile.h b/source/Commands/CommandObjectFile.h
index bccb4bc..bbbacdb 100644
--- a/source/Commands/CommandObjectFile.h
+++ b/source/Commands/CommandObjectFile.h
@@ -44,7 +44,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 8c83b67..3b697fd 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -99,8 +99,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(m_interpreter)
         {
             ResetOptionValues ();
         }
@@ -155,7 +155,8 @@
                        "frame select",
                        "Select a frame by index from within the current thread and make it the current frame.",
                        NULL,
-                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData index_arg;
@@ -224,7 +225,7 @@
                 else
                 {
                     result.AppendError ("invalid arguments.\n");
-                    m_options.GenerateOptionUsage (m_interpreter, result.GetErrorStream(), this);
+                    m_options.GenerateOptionUsage (result.GetErrorStream(), this);
                 }
             }
                 
@@ -289,8 +290,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(m_interpreter)
         {
             ResetOptionValues ();
         }
@@ -407,7 +408,8 @@
                        "Children of aggregate variables can be specified such as "
                        "'var->child.x'.",
                        NULL,
-                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData var_name_arg;
diff --git a/source/Commands/CommandObjectHelp.cpp b/source/Commands/CommandObjectHelp.cpp
index 98fe2ad..bbf1552 100644
--- a/source/Commands/CommandObjectHelp.cpp
+++ b/source/Commands/CommandObjectHelp.cpp
@@ -140,7 +140,7 @@
                     else
                         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 (m_interpreter, output_strm, sub_cmd_obj);
+                    sub_cmd_obj->GetOptions()->GenerateOptionUsage (output_strm, sub_cmd_obj);
                     const char *long_help = sub_cmd_obj->GetHelpLong();
                     if ((long_help != NULL)
                         && (strlen (long_help) > 0))
diff --git a/source/Commands/CommandObjectImage.cpp b/source/Commands/CommandObjectImage.cpp
index d684bb2..a59aff0 100644
--- a/source/Commands/CommandObjectImage.cpp
+++ b/source/Commands/CommandObjectImage.cpp
@@ -603,7 +603,8 @@
         CommandObjectImageDumpModuleList (interpreter,
                                           "image dump symtab",
                                           "Dump the symbol table from one or more executable images.",
-                                           NULL)
+                                           NULL),
+        m_options (interpreter)
     {
     }
 
@@ -719,8 +720,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options(),
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(m_interpreter),
             m_sort_order (eSortOrderNone)
         {
         }
@@ -1140,8 +1141,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options(),
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(m_interpreter),
             m_format_array()
         {
         }
@@ -1188,7 +1189,8 @@
         CommandObject (interpreter,
                        "image list",
                        "List current executable and dependent shared library images.",
-                       "image list [<cmd-options>]")
+                       "image list [<cmd-options>]"),
+        m_options (interpreter)
     {
     }
 
@@ -1346,8 +1348,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(m_interpreter)
         {
             ResetOptionValues();
         }
@@ -1463,7 +1465,8 @@
         CommandObject (interpreter,
                        "image lookup",
                        "Look up information within executable and dependent shared library images.",
-                       NULL)
+                       NULL),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData file_arg;
@@ -1572,7 +1575,7 @@
             break;
 
         default:
-            m_options.GenerateOptionUsage (m_interpreter, result.GetErrorStream(), this);
+            m_options.GenerateOptionUsage (result.GetErrorStream(), this);
             syntax_error = true;
             break;
         }
diff --git a/source/Commands/CommandObjectLog.cpp b/source/Commands/CommandObjectLog.cpp
index 383e299..b10e8ec 100644
--- a/source/Commands/CommandObjectLog.cpp
+++ b/source/Commands/CommandObjectLog.cpp
@@ -62,7 +62,8 @@
         CommandObject (interpreter,
                        "log enable",
                        "Enable logging for a single log channel.",
-                        NULL)
+                        NULL),
+        m_options (interpreter)
     {
 
         CommandArgumentEntry arg1;
@@ -168,8 +169,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options (),
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options (interpreter),
             log_file (),
             log_options (0)
         {
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index f63848c..c731c61 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -36,8 +36,8 @@
     class CommandOptions : public Options
     {
     public:
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
             ResetOptionValues();
         }
@@ -198,7 +198,8 @@
                        "memory read",
                        "Read from the memory of the process being debugged.",
                        NULL,
-                       eFlagProcessMustBeLaunched)
+                       eFlagProcessMustBeLaunched),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg1;
         CommandArgumentEntry arg2;
@@ -434,8 +435,8 @@
     class CommandOptions : public Options
     {
     public:
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
             ResetOptionValues();
         }
@@ -521,7 +522,8 @@
                        "Write to the memory of the process being debugged.",
                        //"memory write [<cmd-options>] <addr> [value1 value2 ...]",
                        NULL,
-                       eFlagProcessMustBeLaunched)
+                       eFlagProcessMustBeLaunched),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg1;
         CommandArgumentEntry arg2;
diff --git a/source/Commands/CommandObjectPlatform.cpp b/source/Commands/CommandObjectPlatform.cpp
index 12515ce..a72b0db4 100644
--- a/source/Commands/CommandObjectPlatform.cpp
+++ b/source/Commands/CommandObjectPlatform.cpp
@@ -19,8 +19,10 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Platform.h"
+#include "lldb/Target/Process.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -36,7 +38,8 @@
                        "platform create",
                        "Create a platform instance by name and select it as the current platform.",
                        "platform create <platform-name>",
-                       0)
+                       0),
+        m_options (interpreter)
     {
     }
 
@@ -86,7 +89,8 @@
     {
     public:
 
-        CommandOptions () :
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options (interpreter),
             os_version_major (UINT32_MAX),
             os_version_minor (UINT32_MAX),
             os_version_update (UINT32_MAX)
@@ -418,11 +422,12 @@
 {
 public:
     CommandObjectPlatformProcessList (CommandInterpreter &interpreter) :
-    CommandObject (interpreter, 
-                   "platform process list",
-                   "List processes on a remote platform by name, pid, or many other matching attributes.",
-                   "platform process list",
-                   0)
+        CommandObject (interpreter, 
+                       "platform process list",
+                       "List processes on a remote platform by name, pid, or many other matching attributes.",
+                       "platform process list",
+                       0),
+        m_options (interpreter)
     {
     }
     
@@ -529,7 +534,8 @@
     {
     public:
         
-        CommandOptions () :
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options (interpreter),
             match_info ()
         {
         }
@@ -585,7 +591,7 @@
                     break;
 
                 case 'a':
-                    match_info.GetProcessInfo().GetArchitecture().SetTriple (option_arg);
+                    match_info.GetProcessInfo().GetArchitecture().SetTriple (option_arg, m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform().get());
                     break;
 
                 case 'n':
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index 8287481..116309d 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -40,8 +40,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
             // Keep default values of all options in one place: ResetOptionValues ()
             ResetOptionValues ();
@@ -121,7 +121,8 @@
         CommandObject (interpreter,
                        "process launch",
                        "Launch the executable in the debugger.",
-                       NULL)
+                       NULL),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData run_args_arg;
@@ -433,8 +434,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
             // Keep default values of all options in one place: ResetOptionValues ()
             ResetOptionValues ();
@@ -494,8 +495,7 @@
         }
 
         virtual bool
-        HandleOptionArgumentCompletion (CommandInterpreter &interpeter, 
-                                        Args &input,
+        HandleOptionArgumentCompletion (Args &input,
                                         int cursor_index,
                                         int char_pos,
                                         OptionElementVector &opt_element_vector,
@@ -521,7 +521,7 @@
                 const char *partial_name = NULL;
                 partial_name = input.GetArgumentAtIndex(opt_arg_pos);
 
-                PlatformSP platform_sp (interpeter.GetDebugger().GetPlatformList().GetSelectedPlatform ());
+                PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform ());
                 if (platform_sp)
                 {
                     ProcessInfoList process_infos;
@@ -563,7 +563,8 @@
         CommandObject (interpreter,
                        "process attach",
                        "Attach to a process.",
-                       "process attach <cmd-options>")
+                       "process attach <cmd-options>"),
+        m_options (interpreter)
     {
     }
 
@@ -983,8 +984,8 @@
     {
     public:
         
-        CommandOptions () :
-        Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
             // Keep default values of all options in one place: ResetOptionValues ()
             ResetOptionValues ();
@@ -1035,11 +1036,12 @@
     };
 
     CommandObjectProcessConnect (CommandInterpreter &interpreter) :
-    CommandObject (interpreter,
-                   "process connect",
-                   "Connect to a remote debug service.",
-                   "process connect <remote-url>",
-                   0)
+        CommandObject (interpreter,
+                       "process connect",
+                       "Connect to a remote debug service.",
+                       "process connect <remote-url>",
+                       0),
+        m_options (interpreter)
     {
     }
     
@@ -1568,8 +1570,8 @@
     {
     public:
         
-        CommandOptions () :
-            Options ()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options (interpreter)
         {
             ResetOptionValues ();
         }
@@ -1632,7 +1634,8 @@
         CommandObject (interpreter,
                        "process handle",
                        "Show or update what the process and debugger should do with various signals received from the OS.",
-                       NULL)
+                       NULL),
+        m_options (interpreter)
     {
         SetHelpLong ("If no signals are specified, update them all.  If no update option is specified, list the current values.\n");
         CommandArgumentEntry arg;
diff --git a/source/Commands/CommandObjectRegister.cpp b/source/Commands/CommandObjectRegister.cpp
index 55a4782..d50d7d7 100644
--- a/source/Commands/CommandObjectRegister.cpp
+++ b/source/Commands/CommandObjectRegister.cpp
@@ -19,6 +19,7 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/RegisterContext.h"
 
@@ -37,7 +38,8 @@
                        "Dump the contents of one or more register values from the current frame.  If no register is specified, dumps them all.",
                        //"register read [<reg-name1> [<reg-name2> [...]]]",
                        NULL,
-                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+                       eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData register_arg;
@@ -154,8 +156,8 @@
     class CommandOptions : public Options
     {
     public:
-        CommandOptions () :
-        Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
             ResetOptionValues();
         }
diff --git a/source/Commands/CommandObjectSettings.cpp b/source/Commands/CommandObjectSettings.cpp
index 82a4929..b5cf326 100644
--- a/source/Commands/CommandObjectSettings.cpp
+++ b/source/Commands/CommandObjectSettings.cpp
@@ -66,7 +66,7 @@
                    "settings set",
                    "Set or change the value of a single debugger setting variable.",
                    NULL),
-    m_options ()
+    m_options (interpreter)
 {
     CommandArgumentEntry arg1;
     CommandArgumentEntry arg2;
@@ -237,8 +237,8 @@
 // CommandObjectSettingsSet::CommandOptions
 //-------------------------------------------------------------------------
 
-CommandObjectSettingsSet::CommandOptions::CommandOptions () :
-    Options (),
+CommandObjectSettingsSet::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
+    Options (interpreter),
     m_override (true),
     m_reset (false)
 {
diff --git a/source/Commands/CommandObjectSettings.h b/source/Commands/CommandObjectSettings.h
index 7d78c08..170b7f2 100644
--- a/source/Commands/CommandObjectSettings.h
+++ b/source/Commands/CommandObjectSettings.h
@@ -59,7 +59,7 @@
     {
     public:
 
-        CommandOptions ();
+        CommandOptions (CommandInterpreter &interpreter);
 
         virtual
         ~CommandOptions ();
diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index 7435b85..9fbf602 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -37,8 +37,8 @@
     class CommandOptions : public Options
     {
     public:
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
         }
 
@@ -98,7 +98,8 @@
         CommandObject (interpreter,
                        "source info",
                        "Display information about the source lines from the current executable's debug info.",
-                       "source info [<cmd-options>]")
+                       "source info [<cmd-options>]"),
+        m_options (interpreter)
     {
     }
 
@@ -148,8 +149,8 @@
     class CommandOptions : public Options
     {
     public:
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
         }
 
@@ -227,7 +228,8 @@
         CommandObject (interpreter,
                        "source list",
                        "Display source code (as specified) based on the current executable's debug info.",
-                        NULL)
+                        NULL),
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData file_arg;
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 1780f2b..7686620 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -489,8 +489,8 @@
     class CommandOptions : public Options
     {
     public:
-        CommandOptions () :
-            Options(),
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter),
             m_line_start(0),
             m_line_end (UINT_MAX),
             m_func_name_type_mask (eFunctionNameTypeAuto),
@@ -634,7 +634,8 @@
         CommandObject (interpreter,
                        "target stop-hook add ",
                        "Add a hook to be executed when the target stops.",
-                       "target stop-hook add")
+                       "target stop-hook add"),
+        m_options (interpreter)
     {
     }
 
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index d5da880..abb6f5f 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -249,8 +249,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options(interpreter)
         {
             // Keep default values of all options in one place: ResetOptionValues ()
             ResetOptionValues ();
@@ -325,7 +325,7 @@
                        "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.",
                        NULL,
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
-        m_options()
+        m_options(interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData thread_idx_arg;
@@ -487,8 +487,8 @@
     {
     public:
 
-        CommandOptions () :
-            Options()
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options (interpreter)
         {
             // Keep default values of all options in one place: ResetOptionValues ()
             ResetOptionValues ();
@@ -575,7 +575,7 @@
         CommandObject (interpreter, name, help, syntax, flags),
         m_step_type (step_type),
         m_step_scope (step_scope),
-        m_options ()
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData thread_id_arg;
@@ -976,8 +976,8 @@
         uint32_t m_thread_idx;
         uint32_t m_frame_idx;
 
-        CommandOptions () :
-            Options(),
+        CommandOptions (CommandInterpreter &interpreter) :
+            Options (interpreter),
             m_thread_idx(LLDB_INVALID_THREAD_ID),
             m_frame_idx(LLDB_INVALID_FRAME_ID)
         {
@@ -1069,7 +1069,7 @@
                        "Run the current or specified thread until it reaches a given line number or leaves the current function.",
                        NULL,
                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
-        m_options ()
+        m_options (interpreter)
     {
         CommandArgumentEntry arg;
         CommandArgumentData line_num_arg;
diff --git a/source/Core/ArchSpec.cpp b/source/Core/ArchSpec.cpp
index 210d32a..e573b99 100644
--- a/source/Core/ArchSpec.cpp
+++ b/source/Core/ArchSpec.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/MachO.h"
 #include "lldb/Host/Endian.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Target/Platform.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -273,13 +274,13 @@
 {
 }
 
-ArchSpec::ArchSpec (const char *triple_cstr) :
+ArchSpec::ArchSpec (const char *triple_cstr, Platform *platform) :
     m_triple (),
     m_core (kCore_invalid),
     m_byte_order (eByteOrderInvalid)
 {
     if (triple_cstr)
-        SetTriple(triple_cstr);
+        SetTriple(triple_cstr, platform);
 }
 
 ArchSpec::ArchSpec(const llvm::Triple &triple) :
@@ -417,18 +418,10 @@
     if (core_def)
     {
         m_core = core_def->core;
-        m_byte_order = core_def->default_byte_order;
-
-        if (m_triple.getVendor() == llvm::Triple::UnknownVendor &&
-            m_triple.getOS() == llvm::Triple::UnknownOS &&
-            m_triple.getEnvironment() == llvm::Triple::UnknownEnvironment)
-        {
-            llvm::Triple host_triple(llvm::sys::getHostTriple());
-
-            m_triple.setVendor(host_triple.getVendor());
-            m_triple.setOS(host_triple.getOS());
-            m_triple.setEnvironment(host_triple.getEnvironment());
-        }
+        // Set the byte order to the default byte order for an architecture.
+        // This can be modified if needed for cases when cores handle both
+        // big and little endian
+        m_byte_order = core_def->default_byte_order; 
     }
     else
     {
@@ -440,7 +433,7 @@
 }
 
 bool
-ArchSpec::SetTriple (const char *triple_cstr)
+ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
 {
     if (triple_cstr || triple_cstr[0])
     {
@@ -459,7 +452,46 @@
         {
             std::string normalized_triple_sstr (llvm::Triple::normalize(triple_stref));
             triple_stref = normalized_triple_sstr;
-            SetTriple (llvm::Triple (triple_stref));
+            llvm::Triple normalized_triple (triple_stref);
+            
+            const bool os_specified = normalized_triple.getOSName().size() > 0;
+            const bool vendor_specified = normalized_triple.getVendorName().size() > 0;
+            const bool env_specified = normalized_triple.getEnvironmentName().size() > 0;
+            
+            // If we got an arch only, then default the vendor, os, environment 
+            // to match the platform if one is supplied
+            if (!(os_specified || vendor_specified || env_specified))
+            {
+                if (platform)
+                {
+                    // If we were given a platform, use the platform's system
+                    // architecture. If this is not available (might not be
+                    // connected) use the first supported architecture.
+                    ArchSpec platform_arch (platform->GetSystemArchitecture());
+                    if (!platform_arch.IsValid())
+                    {
+                        if (!platform->GetSupportedArchitectureAtIndex (0, platform_arch))
+                            platform_arch.Clear();
+                    }
+
+                    if (platform_arch.IsValid())
+                    {
+                        normalized_triple.setVendor(platform_arch.GetTriple().getVendor());
+                        normalized_triple.setOS(platform_arch.GetTriple().getOS());
+                        normalized_triple.setEnvironment(platform_arch.GetTriple().getEnvironment());
+                    }
+                }
+                else
+                {
+                    // No platform specified, fall back to the host system for
+                    // the default vendor, os, and environment.
+                    llvm::Triple host_triple(llvm::sys::getHostTriple());
+                    normalized_triple.setVendor(host_triple.getVendor());
+                    normalized_triple.setOS(host_triple.getOS());
+                    normalized_triple.setEnvironment(host_triple.getEnvironment());
+                }
+            }
+            SetTriple (normalized_triple);
         }
     }
     else
diff --git a/source/Core/EmulateInstruction.cpp b/source/Core/EmulateInstruction.cpp
index 8c3456e..7130360 100644
--- a/source/Core/EmulateInstruction.cpp
+++ b/source/Core/EmulateInstruction.cpp
@@ -315,7 +315,7 @@
                                        size_t length)
 {
     PrintContext ("Read from memory", context);
-    fprintf (stdout, "    Read from Memory (address = %p, length = %d)\n",(void *) addr, (uint) length);
+    fprintf (stdout, "    Read from Memory (address = %p, length = %d)\n",(void *) addr, (uint32_t) length);
     
     *((uint64_t *) dst) = 0xdeadbeef;
     return length;
@@ -329,7 +329,7 @@
                                         size_t length)
 {
     PrintContext ("Write to memory", context);
-    fprintf (stdout, "    Write to Memory (address = %p, length = %d)\n",  (void *) addr, (uint) length);
+    fprintf (stdout, "    Write to Memory (address = %p, length = %d)\n",  (void *) addr, (uint32_t) length);
     return length;
 }
 
diff --git a/source/Interpreter/CommandObject.cpp b/source/Interpreter/CommandObject.cpp
index e4f4689..f93ed6e 100644
--- a/source/Interpreter/CommandObject.cpp
+++ b/source/Interpreter/CommandObject.cpp
@@ -198,7 +198,7 @@
             else
             {
                 // No error string, output the usage information into result
-                options->GenerateOptionUsage (m_interpreter, result.GetErrorStream(), this);
+                options->GenerateOptionUsage (result.GetErrorStream(), this);
             }
             // Set the return status to failed (this was an error).
             result.SetStatus (eReturnStatusFailed);
@@ -356,8 +356,7 @@
             input.DeleteArgumentAtIndex(input.GetArgumentCount() - 1);
 
             bool handled_by_options;
-            handled_by_options = cur_options->HandleOptionCompletion (m_interpreter, 
-                                                                      input,
+            handled_by_options = cur_options->HandleOptionCompletion (input,
                                                                       opt_element_vector,
                                                                       cursor_index,
                                                                       cursor_char_position,
@@ -407,7 +406,7 @@
         && GetOptions() != NULL)
     {
         StreamString usage_help;
-        GetOptions()->GenerateOptionUsage (m_interpreter, usage_help, this);
+        GetOptions()->GenerateOptionUsage (usage_help, this);
         if (usage_help.GetSize() > 0)
         {
             const char *usage_text = usage_help.GetData();
diff --git a/source/Interpreter/Options.cpp b/source/Interpreter/Options.cpp
index 3bc553d..3c14cc0 100644
--- a/source/Interpreter/Options.cpp
+++ b/source/Interpreter/Options.cpp
@@ -29,7 +29,8 @@
 //-------------------------------------------------------------------------
 // Options
 //-------------------------------------------------------------------------
-Options::Options () :
+Options::Options (CommandInterpreter &interpreter) :
+    m_interpreter (interpreter),
     m_getopt_table ()
 {
     BuildValidOptionSets();
@@ -362,12 +363,11 @@
 void
 Options::GenerateOptionUsage
 (
-    CommandInterpreter &interpreter,
     Stream &strm,
     CommandObject *cmd
 )
 {
-    const uint32_t screen_width = interpreter.GetDebugger().GetTerminalWidth();
+    const uint32_t screen_width = m_interpreter.GetDebugger().GetTerminalWidth();
 
     const OptionDefinition *full_options_table = GetDefinitions();
     const uint32_t save_indent_level = strm.GetIndentLevel();
@@ -656,7 +656,6 @@
 bool
 Options::HandleOptionCompletion
 (
-    CommandInterpreter &interpreter,
     Args &input,
     OptionElementVector &opt_element_vector,
     int cursor_index,
@@ -778,8 +777,7 @@
 
             if (opt_defs_index != -1)
             {
-                HandleOptionArgumentCompletion (interpreter, 
-                                                input,
+                HandleOptionArgumentCompletion (input,
                                                 cursor_index,
                                                 strlen (input.GetArgumentAtIndex(cursor_index)),
                                                 opt_element_vector,
@@ -809,7 +807,6 @@
 bool
 Options::HandleOptionArgumentCompletion
 (
-    CommandInterpreter &interpreter,
     Args &input,
     int cursor_index,
     int char_pos,
@@ -868,7 +865,7 @@
                 if (module_name)
                 {
                     FileSpec module_spec(module_name, false);
-                    lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
+                    lldb::TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
                     // Search filters require a target...
                     if (target_sp != NULL)
                         filter_ap.reset (new SearchFilterByModule (target_sp, module_spec));
@@ -878,7 +875,7 @@
         }
     }
 
-    return CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+    return CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
                                                                 completion_mask,
                                                                 input.GetArgumentAtIndex (opt_arg_pos),
                                                                 match_start_point,
diff --git a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index 2855786..4f71a1b 100644
--- a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -150,27 +150,26 @@
         }
     }
 
-    int numTokens = EDNumTokens(m_inst);
+    int numTokens = -1;
+    
+    if (!raw)
+        numTokens = EDNumTokens(m_inst);
 
     int currentOpIndex = -1;
 
-    std::auto_ptr<RegisterReaderArg> rra;
-    
-    if (!raw)
+    bool printTokenized = false;
+
+    if (numTokens != -1 && !raw)
     {
         addr_t base_addr = LLDB_INVALID_ADDRESS;
+        
+        RegisterReaderArg rra(base_addr + EDInstByteSize(m_inst), m_disassembler);
+        
         if (exe_ctx && exe_ctx->target && !exe_ctx->target->GetSectionLoadList().IsEmpty())
             base_addr = GetAddress().GetLoadAddress (exe_ctx->target);
         if (base_addr == LLDB_INVALID_ADDRESS)
             base_addr = GetAddress().GetFileAddress ();
-        
-        rra.reset(new RegisterReaderArg(base_addr + EDInstByteSize(m_inst), m_disassembler));
-    }
-
-    bool printTokenized = false;
-
-    if (numTokens != -1)
-    {
+                    
         printTokenized = true;
 
         // Handle the opcode column.
@@ -246,7 +245,7 @@
                                 {
                                     uint64_t operand_value;
 
-                                    if (!EDEvaluateOperand(&operand_value, operand, IPRegisterReader, rra.get()))
+                                    if (!EDEvaluateOperand(&operand_value, operand, IPRegisterReader, &rra))
                                     {
                                         if (EDInstIsBranch(m_inst))
                                         {
@@ -327,7 +326,7 @@
         if (EDGetInstString(&str, m_inst))
             return;
         else
-            s->PutCString(str);
+            s->Write(str, strlen(str) - 1);
     }
 }
 
diff --git a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
index 786a2ce..83c5825 100644
--- a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
+++ b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
@@ -207,7 +207,7 @@
     {
         arch = Target::GetDefaultArchitecture ();
         if (!arch.IsValid())
-            arch.SetTriple (LLDB_ARCH_DEFAULT);
+            arch.SetTriple (LLDB_ARCH_DEFAULT, NULL);
     }
     else
         arch = m_module->GetArchitecture();
diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 3a46f0d..63cb4ac 100644
--- a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -142,6 +142,7 @@
 {
     const uint8_t *trap_opcode = NULL;
     uint32_t trap_opcode_size = 0;
+    bool bp_is_thumb = false;
         
     llvm::Triple::ArchType machine = target.GetArchitecture().GetMachine();
     switch (machine)
@@ -154,22 +155,26 @@
             trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
         }
         break;
-        
+
+    case llvm::Triple::thumb:
+        bp_is_thumb = true; // Fall through...
     case llvm::Triple::arm:
         {
             static const uint8_t g_arm_breakpoint_opcode[] = { 0xFE, 0xDE, 0xFF, 0xE7 };
             static const uint8_t g_thumb_breakpooint_opcode[] = { 0xFE, 0xDE };
 
-            lldb::BreakpointLocationSP bp_loc_sp (bp_site->GetOwnerAtIndex (0));
-            if (bp_loc_sp)
+            // Auto detect arm/thumb if it wasn't explicitly specified
+            if (!bp_is_thumb)
             {
-                const AddressClass addr_class = bp_loc_sp->GetAddress().GetAddressClass ();
-                if (addr_class == eAddressClassCodeAlternateISA)
-                {
-                    trap_opcode = g_thumb_breakpooint_opcode;
-                    trap_opcode_size = sizeof(g_thumb_breakpooint_opcode);
-                    break;
-                }
+                lldb::BreakpointLocationSP bp_loc_sp (bp_site->GetOwnerAtIndex (0));
+                if (bp_loc_sp)
+                    bp_is_thumb = bp_loc_sp->GetAddress().GetAddressClass () == eAddressClassCodeAlternateISA;
+            }
+            if (bp_is_thumb)
+            {
+                trap_opcode = g_thumb_breakpooint_opcode;
+                trap_opcode_size = sizeof(g_thumb_breakpooint_opcode);
+                break;
             }
             trap_opcode = g_arm_breakpoint_opcode;
             trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
@@ -186,7 +191,7 @@
         break;
         
     default:
-        assert(!"Unhandled architecture in ProcessMacOSX::GetSoftwareBreakpointTrapOpcode()");
+        assert(!"Unhandled architecture in PlatformDarwin::GetSoftwareBreakpointTrapOpcode()");
         break;
     }
     
diff --git a/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index 70685f7..2ae4a90 100644
--- a/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -473,14 +473,14 @@
     default:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv7-apple-darwin");  return true;
-        case 1: arch.SetTriple ("armv7f-apple-darwin"); return true;
-        case 2: arch.SetTriple ("armv7k-apple-darwin"); return true;
-        case 3: arch.SetTriple ("armv7s-apple-darwin"); return true;
-        case 4: arch.SetTriple ("armv6-apple-darwin");  return true;
-        case 5: arch.SetTriple ("armv5-apple-darwin");  return true;
-        case 6: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 7: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv7-apple-darwin", NULL);  return true;
+        case 1: arch.SetTriple ("armv7f-apple-darwin", NULL); return true;
+        case 2: arch.SetTriple ("armv7k-apple-darwin", NULL); return true;
+        case 3: arch.SetTriple ("armv7s-apple-darwin", NULL); return true;
+        case 4: arch.SetTriple ("armv6-apple-darwin", NULL);  return true;
+        case 5: arch.SetTriple ("armv5-apple-darwin", NULL);  return true;
+        case 6: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 7: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
@@ -488,12 +488,12 @@
     case ArchSpec::eCore_arm_armv7f:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv7f-apple-darwin"); return true;
-        case 1: arch.SetTriple ("armv7-apple-darwin");  return true;
-        case 2: arch.SetTriple ("armv6-apple-darwin");  return true;
-        case 3: arch.SetTriple ("armv5-apple-darwin");  return true;
-        case 4: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 5: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv7f-apple-darwin", NULL); return true;
+        case 1: arch.SetTriple ("armv7-apple-darwin", NULL);  return true;
+        case 2: arch.SetTriple ("armv6-apple-darwin", NULL);  return true;
+        case 3: arch.SetTriple ("armv5-apple-darwin", NULL);  return true;
+        case 4: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 5: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
@@ -501,12 +501,12 @@
     case ArchSpec::eCore_arm_armv7k:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv7k-apple-darwin"); return true;
-        case 1: arch.SetTriple ("armv7-apple-darwin");  return true;
-        case 2: arch.SetTriple ("armv6-apple-darwin");  return true;
-        case 3: arch.SetTriple ("armv5-apple-darwin");  return true;
-        case 4: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 5: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv7k-apple-darwin", NULL); return true;
+        case 1: arch.SetTriple ("armv7-apple-darwin", NULL);  return true;
+        case 2: arch.SetTriple ("armv6-apple-darwin", NULL);  return true;
+        case 3: arch.SetTriple ("armv5-apple-darwin", NULL);  return true;
+        case 4: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 5: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
@@ -514,12 +514,12 @@
     case ArchSpec::eCore_arm_armv7s:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv7s-apple-darwin"); return true;
-        case 1: arch.SetTriple ("armv7-apple-darwin");  return true;
-        case 2: arch.SetTriple ("armv6-apple-darwin");  return true;
-        case 3: arch.SetTriple ("armv5-apple-darwin");  return true;
-        case 4: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 5: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv7s-apple-darwin", NULL); return true;
+        case 1: arch.SetTriple ("armv7-apple-darwin", NULL);  return true;
+        case 2: arch.SetTriple ("armv6-apple-darwin", NULL);  return true;
+        case 3: arch.SetTriple ("armv5-apple-darwin", NULL);  return true;
+        case 4: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 5: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
@@ -527,11 +527,11 @@
     case ArchSpec::eCore_arm_armv7:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv7-apple-darwin");  return true;
-        case 1: arch.SetTriple ("armv6-apple-darwin");  return true;
-        case 2: arch.SetTriple ("armv5-apple-darwin");  return true;
-        case 3: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 4: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv7-apple-darwin", NULL);  return true;
+        case 1: arch.SetTriple ("armv6-apple-darwin", NULL);  return true;
+        case 2: arch.SetTriple ("armv5-apple-darwin", NULL);  return true;
+        case 3: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 4: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
@@ -539,10 +539,10 @@
     case ArchSpec::eCore_arm_armv6:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv6-apple-darwin");  return true;
-        case 1: arch.SetTriple ("armv5-apple-darwin");  return true;
-        case 2: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 3: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv6-apple-darwin", NULL);  return true;
+        case 1: arch.SetTriple ("armv5-apple-darwin", NULL);  return true;
+        case 2: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 3: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
@@ -550,9 +550,9 @@
     case ArchSpec::eCore_arm_armv5:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv5-apple-darwin");  return true;
-        case 1: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 2: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv5-apple-darwin", NULL);  return true;
+        case 1: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 2: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
@@ -560,8 +560,8 @@
     case ArchSpec::eCore_arm_armv4:
         switch (idx)
         {
-        case 0: arch.SetTriple ("armv4-apple-darwin");  return true;
-        case 1: arch.SetTriple ("arm-apple-darwin");    return true;
+        case 0: arch.SetTriple ("armv4-apple-darwin", NULL);  return true;
+        case 1: arch.SetTriple ("arm-apple-darwin", NULL);    return true;
         default: break;
         }
         break;
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 7ad3d44..2cebb10 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -919,7 +919,7 @@
                             triple += "unknown";
                         else
                             triple += os_name;
-                        m_host_arch.SetTriple (triple.c_str());
+                        m_host_arch.SetTriple (triple.c_str(), NULL);
                         if (pointer_byte_size)
                         {
                             assert (pointer_byte_size == m_host_arch.GetAddressByteSize());
@@ -933,7 +933,7 @@
                 }
                 else
                 {
-                    m_host_arch.SetTriple (triple.c_str());
+                    m_host_arch.SetTriple (triple.c_str(), NULL);
                     if (pointer_byte_size)
                     {
                         assert (pointer_byte_size == m_host_arch.GetAddressByteSize());
@@ -1159,7 +1159,7 @@
                 extractor.GetStringRef().swap(value);
                 extractor.SetFilePos(0);
                 extractor.GetHexByteString (value);
-                process_info.GetArchitecture ().SetTriple (value.c_str());
+                process_info.GetArchitecture ().SetTriple (value.c_str(), NULL);
             }
             else if (name.compare("name") == 0)
             {
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index d6edbdd..c243138 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -357,7 +357,7 @@
             }
             else if (key.compare("triple") == 0)
             {
-                match_info.GetProcessInfo().GetArchitecture().SetTriple(value.c_str());
+                match_info.GetProcessInfo().GetArchitecture().SetTriple (value.c_str(), NULL);
             }
             else
             {
diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp
index 63ec2e4..d0624c2 100644
--- a/source/Symbol/SymbolContext.cpp
+++ b/source/Symbol/SymbolContext.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Symbol/SymbolContext.h"
 
 #include "lldb/Core/Module.h"
+#include "lldb/Interpreter/Args.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index 1a9bc8b..940ff2b 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -20,6 +20,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/State.h"
+#include "lldb/Expression/ClangUserExpression.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Target/ABI.h"
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 882ff6a..05403f8 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Expression/ClangUserExpression.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
@@ -1330,7 +1331,7 @@
 {
     if (var_name == GetSettingNameForDefaultArch())
     {
-        m_default_architecture.SetTriple (value);
+        m_default_architecture.SetTriple (value, NULL);
         if (!m_default_architecture.IsValid())
             err.SetErrorStringWithFormat ("'%s' is not a valid architecture or triple.", value);
     }