[Lldb-commits] [lldb] r125602 - in /lldb/trunk: include/lldb/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Host/ include/lldb/Symbol/ include/lldb/Target/ lldb.xcodeproj/xcshareddata/xcschemes/ source/API/ source/Commands/ source/Core/ source/Expression/ source/Host/common/ source/Plugins/ABI/MacOSX-i386/ source/Plugins/ABI/SysV-x86_64/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/Instruction/ARM/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/ObjectFile/ELF/ source/Plugins...

Greg Clayton gclayton at apple.com
Tue Feb 15 13:59:32 PST 2011


Author: gclayton
Date: Tue Feb 15 15:59:32 2011
New Revision: 125602

URL: http://llvm.org/viewvc/llvm-project?rev=125602&view=rev
Log:
Made lldb_private::ArchSpec contain much more than just an architecture. It
now, in addition to cpu type/subtype and architecture flavor, contains:
- byte order (big endian, little endian)
- address size in bytes
- llvm::Triple for true target triple support and for more powerful plug-in
  selection.



Modified:
    lldb/trunk/include/lldb/Core/ArchSpec.h
    lldb/trunk/include/lldb/Core/EmulateInstruction.h
    lldb/trunk/include/lldb/Expression/ClangExpressionParser.h
    lldb/trunk/include/lldb/Expression/ClangFunction.h
    lldb/trunk/include/lldb/Host/Host.h
    lldb/trunk/include/lldb/Symbol/ClangASTContext.h
    lldb/trunk/include/lldb/Symbol/ObjectFile.h
    lldb/trunk/include/lldb/Target/ABI.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/include/lldb/lldb-private-interfaces.h
    lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/Commands/CommandObjectImage.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Core/AddressRange.cpp
    lldb/trunk/source/Core/ArchSpec.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Core/EmulateInstruction.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/Value.cpp
    lldb/trunk/source/Core/ValueObjectVariable.cpp
    lldb/trunk/source/Expression/ClangExpressionParser.cpp
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Expression/ClangUserExpression.cpp
    lldb/trunk/source/Expression/ClangUtilityFunction.cpp
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
    lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/Type.cpp
    lldb/trunk/source/Symbol/UnwindTable.cpp
    lldb/trunk/source/Target/ABI.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/StackFrame.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
    lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
    lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
    lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Tue Feb 15 15:59:32 2011
@@ -13,6 +13,7 @@
 #if defined(__cplusplus)
 
 #include "lldb/lldb-private.h"
+#include "llvm/ADT/Triple.h"
 
 namespace lldb_private {
 
@@ -40,6 +41,9 @@
         eCPU_ppc64,
         eCPU_sparc
     };
+    
+    static void
+    Initialize();
 
     //------------------------------------------------------------------
     /// Default constructor.
@@ -140,6 +144,11 @@
     uint32_t
     GetAddressByteSize () const;
 
+    void
+    SetAddressByteSize (uint32_t byte_size)
+    {
+        m_addr_byte_size = byte_size;
+    }
 
     CPU
     GetGenericCPUType () const;
@@ -262,11 +271,42 @@
     /// @param[in] subtype The new CPU subtype
     //------------------------------------------------------------------
     void
-    SetMachOArch (uint32_t cpu, uint32_t sub)
+    SetMachOArch (uint32_t cpu, uint32_t sub);
+
+    //------------------------------------------------------------------
+    /// Returns the byte order for the architecture specification.
+    ///
+    /// @return The endian enumeration for the current endianness of
+    ///     the architecture specification
+    //------------------------------------------------------------------
+    lldb::ByteOrder
+    GetByteOrder () const
     {
-        m_type = lldb::eArchTypeMachO;
-        m_cpu = cpu;
-        m_sub = sub;
+        return m_byte_order;
+    }
+
+    void
+    SetByteOrder (lldb::ByteOrder b)
+    {
+        m_byte_order = b;
+    }
+
+    llvm::Triple &
+    GetTriple ()
+    {
+        return m_triple;
+    }
+    
+    const llvm::Triple &
+    GetTriple () const
+    {
+        return m_triple;
+    }
+    
+    void
+    SetTriple (const llvm::Triple &triple)
+    {
+        m_triple = triple;
     }
 
     void
@@ -301,6 +341,17 @@
     //       m_type =>  eArchTypeMachO      eArchTypeELF
     uint32_t m_cpu; //  cpu type            ELF header e_machine
     uint32_t m_sub; //  cpu subtype         nothing
+    llvm::Triple m_triple;
+    lldb::ByteOrder m_byte_order;
+    uint32_t m_addr_byte_size;
+    
+private:
+    
+    void
+    MachOArchUpdated (size_t macho_idx = SIZE_T_MAX);
+    
+    void
+    ELFArchUpdated (size_t idx = SIZE_T_MAX);
 };
 
 

Modified: lldb/trunk/include/lldb/Core/EmulateInstruction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/EmulateInstruction.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/EmulateInstruction.h (original)
+++ lldb/trunk/include/lldb/Core/EmulateInstruction.h Tue Feb 15 15:59:32 2011
@@ -81,7 +81,7 @@
 public:
 
     static EmulateInstruction*
-    FindPlugin (const ConstString &triple, const char *plugin_name);
+    FindPlugin (const ArchSpec &arch, const char *plugin_name);
 
     enum ContextType
     {
@@ -403,7 +403,7 @@
     }
     
     virtual bool
-    SetTargetTriple (const ConstString &triple) = 0;
+    SetTargetTriple (const ArchSpec &arch) = 0;
     
     virtual bool 
     ReadInstruction () = 0;

Modified: lldb/trunk/include/lldb/Expression/ClangExpressionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionParser.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionParser.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionParser.h Tue Feb 15 15:59:32 2011
@@ -11,6 +11,7 @@
 #define liblldb_ClangExpressionParser_h_
 
 #include "lldb/lldb-include.h"
+#include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/ClangForward.h"
 #include "lldb/Core/Error.h"
 
@@ -40,19 +41,15 @@
     ///
     /// Initializes class variabes.
     ///
-    /// @param[in] target_triple
-    ///     The LLVM-friendly target triple for use in initializing the
-    ///     compiler.
-    ///
-    /// @param[in process
-    ///     If non-NULL, the process to customize the expression for
-    ///     (e.g., by tuning Objective-C runtime support).  May be NULL.
+    /// @param[in] exe_scope,
+    ///     If non-NULL, an execution context scope that can help to 
+    ///     correctly create an expression with a valid process for 
+    ///     optional tuning Objective-C runtime support. Can be NULL.
     ///
     /// @param[in] expr
     ///     The expression to be parsed.
     //------------------------------------------------------------------
-    ClangExpressionParser (const char *target_triple,
-                           Process *process,
+    ClangExpressionParser (ExecutionContextScope *exe_scope,
                            ClangExpression &expr);
     
     //------------------------------------------------------------------
@@ -181,7 +178,6 @@
     
     ClangExpression                            &m_expr;                 ///< The expression to be parsed
     
-    std::string                                 m_target_triple;        ///< The target triple used to initialize LLVM
     std::auto_ptr<clang::FileManager>           m_file_manager;         ///< The Clang file manager object used by the compiler
     std::auto_ptr<clang::CompilerInstance>      m_compiler;             ///< The Clang compiler used to parse expressions into IR
     std::auto_ptr<clang::Builtin::Context>      m_builtin_context;      ///< Context for Clang built-ins

Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Tue Feb 15 15:59:32 2011
@@ -18,6 +18,7 @@
 // Project includes
 #include "lldb/Core/ClangForward.h"
 #include "lldb/Core/Address.h"
+#include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObjectList.h"
 #include "lldb/Expression/ClangExpression.h"
@@ -69,9 +70,9 @@
 	//------------------------------------------------------------------
 	/// Constructor
     ///
-    /// @param[in] target_triple
-    ///     The LLVM-style target triple for the target in which the
-    ///     function is to be executed.
+    /// @param[in] exe_scope
+    ///     An execution context scope that gets us a target and/or 
+    ///     process (possibly neither.).
     ///
     /// @param[in] function_ptr
     ///     The default function to be called.  Can be overridden using
@@ -84,17 +85,17 @@
     ///     The default values to use when calling this function.  Can
     ///     be overridden using WriteFunctionArguments().
 	//------------------------------------------------------------------  
-	ClangFunction(const char *target_triple, 
-                  Function &function_ptr, 
-                  ClangASTContext *ast_context, 
-                  const ValueList &arg_value_list);
+	ClangFunction (ExecutionContextScope *exe_scope,
+                   Function &function_ptr, 
+                   ClangASTContext *ast_context, 
+                   const ValueList &arg_value_list);
     
     //------------------------------------------------------------------
 	/// Constructor
     ///
-    /// @param[in] target_triple
-    ///     The LLVM-style target triple for the target in which the
-    ///     function is to be executed.
+    /// @param[in] exe_scope
+    ///     An execution context scope that gets us a target and/or 
+    ///     process (possibly neither.).
     ///
     /// @param[in] ast_context
     ///     The AST context to evaluate argument types in.
@@ -110,11 +111,11 @@
     ///     The default values to use when calling this function.  Can
     ///     be overridden using WriteFunctionArguments().
 	//------------------------------------------------------------------
-	ClangFunction(const char *target_triple, 
-                  ClangASTContext *ast_context, 
-                  void *return_qualtype, 
-                  const Address& function_address, 
-                  const ValueList &arg_value_list);
+	ClangFunction (ExecutionContextScope *exe_scope,
+                   ClangASTContext *ast_context, 
+                   void *return_qualtype, 
+                   const Address& function_address, 
+                   const ValueList &arg_value_list);
     
     //------------------------------------------------------------------
 	/// Destructor
@@ -613,7 +614,7 @@
     Address                         m_function_addr;                ///< If we don't have the FunctionSP, we at least need the address & return type.
     void                           *m_function_return_qual_type;    ///< The opaque clang qual type for the function return type.
     ClangASTContext                *m_clang_ast_context;            ///< This is the clang_ast_context that we're getting types from the and value, and the function return the function pointer is NULL.
-    std::string                     m_target_triple;                ///< The target triple to compile the wrapper function for.
+    ArchSpec                        m_arch;                         ///< The target triple to compile the wrapper function for.
 
     std::string                     m_wrapper_function_name;        ///< The name of the wrapper function.
     std::string                     m_wrapper_function_text;        ///< The contents of the wrapper function.

Modified: lldb/trunk/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Tue Feb 15 15:59:32 2011
@@ -97,14 +97,21 @@
     GetByteOrder ();
 
     //------------------------------------------------------------------
-    /// Gets the host kernel architecture.
+    /// Gets the host architecture.
     ///
     /// @return
-    ///     A const architecture object that represents the host kernel
+    ///     A const architecture object that represents the host
     ///     architecture.
     //------------------------------------------------------------------
+    enum SystemDefaultArchitecture
+    {
+        eSystemDefaultArchitecture,     // The overall default architecture that applications will run on this host
+        eSystemDefaultArchitecture32,   // If this host supports 32 bit programs, return the default 32 bit arch
+        eSystemDefaultArchitecture64    // If this host supports 64 bit programs, return the default 64 bit arch
+    };
+
     static const ArchSpec &
-    GetArchitecture ();
+    GetArchitecture (SystemDefaultArchitecture arch_kind = eSystemDefaultArchitecture);
 
     //------------------------------------------------------------------
     /// Gets the host vendor string.

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Feb 15 15:59:32 2011
@@ -104,6 +104,9 @@
     void
     SetTargetTriple (const char *target_triple);
 
+    void
+    SetArchitecture (const ArchSpec &arch);
+
     bool
     HasExternalSource ();
 

Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Tue Feb 15 15:59:32 2011
@@ -238,7 +238,7 @@
     ///     false otherwise.
     //------------------------------------------------------------------
     virtual bool
-    GetTargetTriple(ConstString &target_triple) = 0;
+    GetArchitecture (ArchSpec &arch) = 0;
 
     //------------------------------------------------------------------
     /// Gets the section list for the currently selected architecture

Modified: lldb/trunk/include/lldb/Target/ABI.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ABI.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ABI.h (original)
+++ lldb/trunk/include/lldb/Target/ABI.h Tue Feb 15 15:59:32 2011
@@ -47,7 +47,7 @@
                     Value &value) const = 0;
     
     static ABI* 
-    FindPlugin (const ConstString &triple);
+    FindPlugin (const ArchSpec &arch);
 protected:
     //------------------------------------------------------------------
     // Classes that inherit from ABI can see and modify these

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Feb 15 15:59:32 2011
@@ -417,6 +417,7 @@
     void
     UpdateInstanceName ();
 
+    
     //------------------------------------------------------------------
     /// Construct with a shared pointer to a target, and the Process listener.
     //------------------------------------------------------------------
@@ -474,6 +475,12 @@
                           int signo,              // Zero for no signal
                           int status);            // Exit value of process if signal is zero
 
+    lldb::ByteOrder
+    GetByteOrder () const;
+    
+    uint32_t
+    GetAddressByteSize () const;
+
     //------------------------------------------------------------------
     /// Check if a plug-in instance can debug the file in \a module.
     ///
@@ -649,15 +656,6 @@
     virtual ArchSpec
     GetArchSpecForExistingProcess (const char *process_name);
 
-    uint32_t
-    GetAddressByteSize();
-
-    void
-    SetAddressByteSize (uint32_t addr_byte_size)
-    {
-        m_addr_byte_size = addr_byte_size;
-    }
-
     //------------------------------------------------------------------
     /// Get the image information address for the current process.
     ///
@@ -821,8 +819,10 @@
     Signal (int signal);
 
     virtual UnixSignals &
-    GetUnixSignals ();
-
+    GetUnixSignals ()
+    {
+        return m_unix_signals;
+    }
 
     //==================================================================
     // Plug-in Process Control Overrides
@@ -1179,7 +1179,10 @@
     ///     module.
     //------------------------------------------------------------------
     Target &
-    GetTarget ();
+    GetTarget ()
+    {
+        return m_target;
+    }
 
     //------------------------------------------------------------------
     /// Get the const target object pointer for this module.
@@ -1189,7 +1192,11 @@
     ///     module.
     //------------------------------------------------------------------
     const Target &
-    GetTarget () const;
+    GetTarget () const
+    {
+        return m_target;
+    }
+
 
     //------------------------------------------------------------------
     /// Get accessor for the current process state.
@@ -1652,10 +1659,16 @@
     UpdateThreadListIfNeeded () = 0;
 
     ThreadList &
-    GetThreadList ();
+    GetThreadList ()
+    {
+        return m_thread_list;
+    }
 
     const ThreadList &
-    GetThreadList () const;
+    GetThreadList () const
+    {
+        return m_thread_list;
+    }
 
     uint32_t
     GetNextThreadIndexID ();
@@ -1739,30 +1752,6 @@
     ShouldBroadcastEvent (Event *event_ptr);
 
 public:
-    //------------------------------------------------------------------
-    /// Gets the byte order for this process.
-    ///
-    /// @return
-    ///     A valid ByteOrder enumeration, or eByteOrderInvalid.
-    //------------------------------------------------------------------
-    lldb::ByteOrder
-    GetByteOrder () const
-    {
-        return m_byte_order;
-    }
-    
-    void
-    SetByteOrder (lldb::ByteOrder byte_order)
-    {
-        m_byte_order = byte_order;
-    }
-
-    const ConstString &
-    GetTargetTriple ()
-    {
-        return m_target_triple;
-    }
-
     const ABI *
     GetABI ();
 
@@ -1807,16 +1796,28 @@
     // lldb::ExecutionContextScope pure virtual functions
     //------------------------------------------------------------------
     virtual Target *
-    CalculateTarget ();
+    CalculateTarget ()
+    {
+        return &m_target;
+    }
 
     virtual Process *
-    CalculateProcess ();
+    CalculateProcess ()
+    {
+        return this;
+    }
 
     virtual Thread *
-    CalculateThread ();
+    CalculateThread ()
+    {
+        return NULL;
+    }
 
     virtual StackFrame *
-    CalculateStackFrame ();
+    CalculateStackFrame ()
+    {
+        return NULL;
+    }
 
     virtual void
     CalculateExecutionContext (ExecutionContext &exe_ctx);
@@ -1941,9 +1942,6 @@
                                                         ///< to insert in the target.
     std::auto_ptr<DynamicCheckerFunctions>  m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
     UnixSignals                 m_unix_signals;         /// This is the current signal set for this process.
-    ConstString                 m_target_triple;
-    lldb::ByteOrder             m_byte_order;           /// The byte order of the process. Should be set in DidLaunch/DidAttach.
-    uint32_t                    m_addr_byte_size;       /// The size in bytes of an address/pointer for the inferior process. Should be set in DidLaunch/DidAttach.
     lldb::ABISP                 m_abi_sp;
     lldb::InputReaderSP         m_process_input_reader;
     lldb_private::Communication m_stdio_communication;

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue Feb 15 15:59:32 2011
@@ -365,10 +365,28 @@
     ///     A list of Module objects in a module list.
     //------------------------------------------------------------------
     ModuleList&
-    GetImages ();
+    GetImages ()
+    {
+        return m_images;
+    }
+
+    const ModuleList&
+    GetImages () const
+    {
+        return m_images;
+    }
 
-    ArchSpec
-    GetArchitecture () const;
+    ArchSpec &
+    GetArchitecture ()
+    {
+        return m_arch_spec;
+    }
+    
+    const ArchSpec &
+    GetArchitecture () const
+    {
+        return m_arch_spec;
+    }
     
     //------------------------------------------------------------------
     /// Set the architecture for this target.
@@ -397,9 +415,6 @@
         return m_debugger;
     }
 
-    bool
-    GetTargetTriple (ConstString &target_triple);
-
     size_t
     ReadMemoryFromFileCache (const Address& addr, 
                              void *dst, 
@@ -505,7 +520,6 @@
     // we can correctly tear down everything that we need to, so the only
     // class that knows about the process lifespan is this target class.
     lldb::ProcessSP m_process_sp;
-    ConstString     m_triple;       ///< The target triple ("x86_64-apple-darwin10")
     lldb::SearchFilterSP  m_search_filter_sp;
     PathMappingList m_image_search_paths;
     std::auto_ptr<ClangASTContext> m_scratch_ast_context_ap;

Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Tue Feb 15 15:59:32 2011
@@ -16,13 +16,13 @@
 
 namespace lldb_private
 {
-    typedef ABI* (*ABICreateInstance) (const ConstString &triple);
+    typedef ABI* (*ABICreateInstance) (const ArchSpec &arch);
     typedef Disassembler* (*DisassemblerCreateInstance) (const ArchSpec &arch);
     typedef DynamicLoader* (*DynamicLoaderCreateInstance) (Process* process);
     typedef ObjectContainer* (*ObjectContainerCreateInstance) (Module* module, lldb::DataBufferSP& dataSP, const FileSpec *file, lldb::addr_t offset, lldb::addr_t length);
     typedef ObjectFile* (*ObjectFileCreateInstance) (Module* module, lldb::DataBufferSP& dataSP, const FileSpec* file, lldb::addr_t offset, lldb::addr_t length);
     typedef LogChannel* (*LogChannelCreateInstance) ();
-    typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ConstString &triple);
+    typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch);
     typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language);
     typedef Process* (*ProcessCreateInstance) (Target &target, Listener &listener);
     typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file);

Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Tue Feb 15 15:59:32 2011
@@ -31,6 +31,10 @@
       <CommandLineArguments>
          <CommandLineArgument
             argument = "/Volumes/work/gclayton/Documents/src/attach/a.out"
+            isEnabled = "NO">
+         </CommandLineArgument>
+         <CommandLineArgument
+            argument = "-a i386 /Volumes/work/gclayton/Documents/src/lldb/test/macosx/universal/testit"
             isEnabled = "YES">
          </CommandLineArgument>
       </CommandLineArguments>
@@ -89,6 +93,10 @@
             argument = "/Volumes/work/gclayton/Documents/src/attach/a.out"
             isEnabled = "YES">
          </CommandLineArgument>
+         <CommandLineArgument
+            argument = "-a i386 /Volumes/work/gclayton/Documents/src/lldb/test/macosx/universal/testit"
+            isEnabled = "NO">
+         </CommandLineArgument>
       </CommandLineArguments>
       <EnvironmentVariables>
          <EnvironmentVariable
@@ -144,6 +152,10 @@
       <CommandLineArguments>
          <CommandLineArgument
             argument = "/Volumes/work/gclayton/Documents/src/attach/a.out"
+            isEnabled = "NO">
+         </CommandLineArgument>
+         <CommandLineArgument
+            argument = "-a i386 /Volumes/work/gclayton/Documents/src/lldb/test/macosx/universal/testit"
             isEnabled = "YES">
          </CommandLineArgument>
       </CommandLineArguments>

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Tue Feb 15 15:59:32 2011
@@ -371,7 +371,7 @@
 {
     uint32_t size = 0;
     if (m_opaque_sp)
-        size =  m_opaque_sp->GetAddressByteSize();
+        size =  m_opaque_sp->GetTarget().GetArchitecture().GetAddressByteSize();
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)

Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.cpp Tue Feb 15 15:59:32 2011
@@ -342,7 +342,7 @@
                     int addr_size = sizeof (addr_t);
                     Process *process = interpreter.GetDebugger().GetExecutionContext().process;
                     if (process)
-                        addr_size = process->GetAddressByteSize();
+                        addr_size = process->GetTarget().GetArchitecture().GetAddressByteSize();
                     if (vm_addr != LLDB_INVALID_ADDRESS)
                         strm.Address (vm_addr, addr_size);
                     else

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Feb 15 15:59:32 2011
@@ -260,7 +260,7 @@
         if (item_byte_size == 0)
         {
             if (m_options.m_format == eFormatPointer)
-                item_byte_size = process->GetAddressByteSize();
+                item_byte_size = process->GetTarget().GetArchitecture().GetAddressByteSize();
             else
                 item_byte_size = 1;
         }
@@ -334,7 +334,9 @@
             result.AppendWarningWithFormat("Not all bytes (%u/%u) were able to be read from 0x%llx.\n", bytes_read, total_byte_size, addr);
 
         result.SetStatus(eReturnStatusSuccessFinishResult);
-        DataExtractor data(data_sp, process->GetByteOrder(), process->GetAddressByteSize());
+        DataExtractor data (data_sp, 
+                            process->GetTarget().GetArchitecture().GetByteOrder(), 
+                            process->GetTarget().GetArchitecture().GetAddressByteSize());
 
         StreamFile outfile_stream;
         Stream *output_stream = NULL;
@@ -616,8 +618,8 @@
         }
 
         StreamString buffer (Stream::eBinary,
-                             process->GetAddressByteSize(),
-                             process->GetByteOrder());
+                             process->GetTarget().GetArchitecture().GetAddressByteSize(),
+                             process->GetTarget().GetArchitecture().GetByteOrder());
 
         size_t item_byte_size = m_options.m_byte_size;
 

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Feb 15 15:59:32 2011
@@ -328,6 +328,10 @@
                         if (synchronous_execution)
                         {
                             state = process->WaitForProcessToStop (NULL);
+                            if (!StateIsStoppedState(state));
+                            {
+                                result.AppendErrorWithFormat ("Process isn't stopped: %s", StateAsCString(state));
+                            }                    
                             result.SetDidChangeProcessState (true);
                             result.SetStatus (eReturnStatusSuccessFinishResult);
                         }
@@ -336,9 +340,24 @@
                             result.SetStatus (eReturnStatusSuccessContinuingNoResult);
                         }
                     }
+                    else
+                    {
+                        result.AppendErrorWithFormat ("Process resume at entry point failed: %s", error.AsCString());
+                        result.SetStatus (eReturnStatusFailed);
+                    }                    
                 }
+                else
+                {
+                    result.AppendErrorWithFormat ("Initial process state wasn't stopped: %s", StateAsCString(state));
+                    result.SetStatus (eReturnStatusFailed);
+                }                    
             }
         }
+        else
+        {
+            result.AppendErrorWithFormat ("Process launch failed: %s", error.AsCString());
+            result.SetStatus (eReturnStatusFailed);
+        }
 
         return result.Succeeded();
     }

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Tue Feb 15 15:59:32 2011
@@ -42,11 +42,11 @@
     if (exe_scope == NULL)
         return false;
 
-    Process *process = exe_scope->CalculateProcess();
-    if (process)
+    Target *target = exe_scope->CalculateTarget();
+    if (target)
     {
-        byte_order = process->GetByteOrder();
-        addr_size = process->GetAddressByteSize();
+        byte_order = target->GetArchitecture().GetByteOrder();
+        addr_size = target->GetArchitecture().GetAddressByteSize();
     }
 
     if (byte_order == eByteOrderInvalid || addr_size == 0)
@@ -54,7 +54,7 @@
         Module *module = address.GetModule();
         if (module)
         {
-            byte_order = module->GetArchitecture().GetDefaultEndian();
+            byte_order = module->GetArchitecture().GetByteOrder();
             addr_size = module->GetArchitecture().GetAddressByteSize();
         }
     }
@@ -313,7 +313,7 @@
     if (addr_size == UINT32_MAX)
     {
         if (process)
-            addr_size = process->GetAddressByteSize ();
+            addr_size = target->GetArchitecture().GetAddressByteSize ();
         else
             addr_size = sizeof(addr_t);
     }
@@ -387,8 +387,8 @@
 
             uint32_t pointer_size = 4;
             Module *module = GetModule();
-            if (process)
-                pointer_size = process->GetAddressByteSize();
+            if (target)
+                pointer_size = target->GetArchitecture().GetAddressByteSize();
             else if (module)
                 pointer_size = module->GetArchitecture().GetAddressByteSize();
 

Modified: lldb/trunk/source/Core/AddressRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressRange.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/AddressRange.cpp (original)
+++ lldb/trunk/source/Core/AddressRange.cpp Tue Feb 15 15:59:32 2011
@@ -143,8 +143,8 @@
 {
     addr_t vmaddr = LLDB_INVALID_ADDRESS;
     int addr_size = sizeof (addr_t);
-    if (target && target->GetProcessSP())
-        addr_size = target->GetProcessSP()->GetAddressByteSize ();
+    if (target)
+        addr_size = target->GetArchitecture().GetAddressByteSize ();
 
     bool show_module = false;
     switch (style)

Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Tue Feb 15 15:59:32 2011
@@ -15,6 +15,8 @@
 
 #include "llvm/Support/ELF.h"
 #include "llvm/Support/MachO.h"
+#include "lldb/Host/Endian.h"
+#include "lldb/Host/Host.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -28,6 +30,8 @@
 //----------------------------------------------------------------------
 struct ArchDefinition
 {
+    ByteOrder byte_order;
+    uint32_t addr_byte_size;
     uint32_t cpu;
     uint32_t sub;
     const char *name;
@@ -52,54 +56,36 @@
 //----------------------------------------------------------------------
 static ArchDefinition g_mach_arch_defs[] =
 {
-    { CPU_ANY,                          CPU_ANY , "all"         },
-    { llvm::MachO::CPUTypeARM,          CPU_ANY , "arm"         },
-    { llvm::MachO::CPUTypeARM,          0       , "arm"         },
-    { llvm::MachO::CPUTypeARM,          5       , "armv4"       },
-    { llvm::MachO::CPUTypeARM,          6       , "armv6"       },
-    { llvm::MachO::CPUTypeARM,          7       , "armv5"       },
-    { llvm::MachO::CPUTypeARM,          8       , "xscale"      },
-    { llvm::MachO::CPUTypeARM,          9       , "armv7"       },
-    { llvm::MachO::CPUTypePowerPC,      CPU_ANY , "ppc"         },
-    { llvm::MachO::CPUTypePowerPC,      0       , "ppc"         },
-    { llvm::MachO::CPUTypePowerPC,      1       , "ppc601"      },
-    { llvm::MachO::CPUTypePowerPC,      2       , "ppc602"      },
-    { llvm::MachO::CPUTypePowerPC,      3       , "ppc603"      },
-    { llvm::MachO::CPUTypePowerPC,      4       , "ppc603e"     },
-    { llvm::MachO::CPUTypePowerPC,      5       , "ppc603ev"    },
-    { llvm::MachO::CPUTypePowerPC,      6       , "ppc604"      },
-    { llvm::MachO::CPUTypePowerPC,      7       , "ppc604e"     },
-    { llvm::MachO::CPUTypePowerPC,      8       , "ppc620"      },
-    { llvm::MachO::CPUTypePowerPC,      9       , "ppc750"      },
-    { llvm::MachO::CPUTypePowerPC,      10      , "ppc7400"     },
-    { llvm::MachO::CPUTypePowerPC,      11      , "ppc7450"     },
-    { llvm::MachO::CPUTypePowerPC,      100     , "ppc970"      },
-    { llvm::MachO::CPUTypePowerPC64,    0       , "ppc64"       },
-    { llvm::MachO::CPUTypePowerPC64,    100     , "ppc970-64"   },
-    { llvm::MachO::CPUTypeI386,         3       , "i386"        },
-    { llvm::MachO::CPUTypeI386,         4       , "i486"        },
-    { llvm::MachO::CPUTypeI386,         0x84    , "i486sx"      },
-    { llvm::MachO::CPUTypeI386,         CPU_ANY , "i386"        },
-    { llvm::MachO::CPUTypeX86_64,       3       , "x86_64"      },
-    { llvm::MachO::CPUTypeX86_64,       CPU_ANY , "x86_64"      },
-
-    // TODO: when we get a platform that knows more about the host OS we should
-    // let it call some accessor funcitons to set the default system arch for
-    // the default, 32 and 64 bit cases instead of hard coding it in this
-    // table.
-
-#if defined (__i386__) || defined(__x86_64__)
-    { llvm::MachO::CPUTypeX86_64,      3    , LLDB_ARCH_DEFAULT         },
-    { llvm::MachO::CPUTypeI386,        3    , LLDB_ARCH_DEFAULT_32BIT   },
-    { llvm::MachO::CPUTypeX86_64,      3    , LLDB_ARCH_DEFAULT_64BIT   },
-#elif defined (__arm__)
-    { llvm::MachO::CPUTypeARM,         6    , LLDB_ARCH_DEFAULT         },
-    { llvm::MachO::CPUTypeARM,         6    , LLDB_ARCH_DEFAULT_32BIT   },
-#elif defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__)
-    { llvm::MachO::CPUTypePowerPC,     10   , LLDB_ARCH_DEFAULT         },
-    { llvm::MachO::CPUTypePowerPC,     10   , LLDB_ARCH_DEFAULT_32BIT   },
-    { llvm::MachO::CPUTypePowerPC64,   100  , LLDB_ARCH_DEFAULT_64BIT   },
-#endif
+    { eByteOrderInvalid, 0, CPU_ANY,                          CPU_ANY , "all"         },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeARM,          CPU_ANY , "arm"         },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeARM,          0       , "arm"         },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeARM,          5       , "armv4"       },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeARM,          6       , "armv6"       },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeARM,          7       , "armv5"       },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeARM,          8       , "xscale"      },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeARM,          9       , "armv7"       },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      CPU_ANY , "ppc"         },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      0       , "ppc"         },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      1       , "ppc601"      },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      2       , "ppc602"      },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      3       , "ppc603"      },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      4       , "ppc603e"     },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      5       , "ppc603ev"    },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      6       , "ppc604"      },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      7       , "ppc604e"     },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      8       , "ppc620"      },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      9       , "ppc750"      },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      10      , "ppc7400"     },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      11      , "ppc7450"     },
+    { eByteOrderBig,     4, llvm::MachO::CPUTypePowerPC,      100     , "ppc970"      },
+    { eByteOrderBig,     8, llvm::MachO::CPUTypePowerPC64,    0       , "ppc64"       },
+    { eByteOrderBig,     8, llvm::MachO::CPUTypePowerPC64,    100     , "ppc970-64"   },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeI386,         3       , "i386"        },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeI386,         4       , "i486"        },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeI386,         0x84    , "i486sx"      },
+    { eByteOrderLittle,  4, llvm::MachO::CPUTypeI386,         CPU_ANY , "i386"        },
+    { eByteOrderLittle,  8, llvm::MachO::CPUTypeX86_64,       3       , "x86_64"      },
+    { eByteOrderLittle,  8, llvm::MachO::CPUTypeX86_64,       CPU_ANY , "x86_64"      },
 };
 
 //----------------------------------------------------------------------
@@ -118,33 +104,20 @@
 //----------------------------------------------------------------------
 static ArchDefinition g_elf_arch_defs[] =
 {
-    { llvm::ELF::EM_M32    , 0, "m32"      }, // AT&T WE 32100
-    { llvm::ELF::EM_SPARC  , 0, "sparc"    }, // AT&T WE 32100
-    { llvm::ELF::EM_386    , 0, "i386"     }, // Intel 80386
-    { llvm::ELF::EM_68K    , 0, "68k"      }, // Motorola 68000
-    { llvm::ELF::EM_88K    , 0, "88k"      }, // Motorola 88000
-    { llvm::ELF::EM_486    , 0, "i486"     }, // Intel 486 (deprecated)
-    { llvm::ELF::EM_860    , 0, "860"      }, // Intel 80860
-    { llvm::ELF::EM_MIPS   , 0, "rs3000"   }, // MIPS RS3000
-    { llvm::ELF::EM_PPC    , 0, "ppc"      }, // PowerPC
-    { 21                   , 0, "ppc64"    }, // PowerPC64
-    { llvm::ELF::EM_ARM    , 0, "arm"      }, // ARM
-    { llvm::ELF::EM_ALPHA  , 0, "alpha"    }, // DEC Alpha
-    { llvm::ELF::EM_SPARCV9, 0, "sparc9"   }, // SPARC V9
-    { llvm::ELF::EM_X86_64 , 0, "x86_64"   }, // AMD64
-
-#if defined (__i386__) || defined(__x86_64__)
-    { llvm::ELF::EM_X86_64 , 0, LLDB_ARCH_DEFAULT         },
-    { llvm::ELF::EM_386    , 0, LLDB_ARCH_DEFAULT_32BIT   },
-    { llvm::ELF::EM_X86_64 , 0, LLDB_ARCH_DEFAULT_64BIT   },
-#elif defined (__arm__)
-    { llvm::ELF::EM_ARM    , 0, LLDB_ARCH_DEFAULT         },
-    { llvm::ELF::EM_ARM    , 0, LLDB_ARCH_DEFAULT_32BIT   },
-#elif defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__)
-    { llvm::ELF::EM_PPC    , 0, LLDB_ARCH_DEFAULT         },
-    { llvm::ELF::EM_PPC    , 0, LLDB_ARCH_DEFAULT_32BIT   },
-    { llvm::ELF::EM_PPC64  , 0, LLDB_ARCH_DEFAULT_64BIT   },
-#endif
+    { eByteOrderInvalid,    0, llvm::ELF::EM_M32    , 0, "m32"      }, // AT&T WE 32100
+    { eByteOrderBig,        4, llvm::ELF::EM_SPARC  , 0, "sparc"    }, // Sparc
+    { eByteOrderLittle,     4, llvm::ELF::EM_386    , 0, "i386"     }, // Intel 80386
+    { eByteOrderBig,        4, llvm::ELF::EM_68K    , 0, "68k"      }, // Motorola 68000
+    { eByteOrderBig,        4, llvm::ELF::EM_88K    , 0, "88k"      }, // Motorola 88000
+    { eByteOrderLittle,     4, llvm::ELF::EM_486    , 0, "i486"     }, // Intel 486 (deprecated)
+    { eByteOrderLittle,     4, llvm::ELF::EM_860    , 0, "860"      }, // Intel 80860
+    { eByteOrderBig,        4, llvm::ELF::EM_MIPS   , 0, "rs3000"   }, // MIPS RS3000
+    { eByteOrderBig,        4, llvm::ELF::EM_PPC    , 0, "ppc"      }, // PowerPC
+    { eByteOrderBig,        8, 21                   , 0, "ppc64"    }, // PowerPC64
+    { eByteOrderLittle,     4, llvm::ELF::EM_ARM    , 0, "arm"      }, // ARM
+    { eByteOrderLittle,     4, llvm::ELF::EM_ALPHA  , 0, "alpha"    }, // DEC Alpha
+    { eByteOrderLittle,     4, llvm::ELF::EM_SPARCV9, 0, "sparc9"   }, // SPARC V9
+    { eByteOrderLittle,     8, llvm::ELF::EM_X86_64 , 0, "x86_64"   }, // AMD64
 };
 
 //----------------------------------------------------------------------
@@ -158,7 +131,10 @@
 ArchSpec::ArchSpec() :
     m_type (eArchTypeMachO),        // Use the most complete arch definition which will always be translatable to any other ArchitectureType values
     m_cpu (LLDB_INVALID_CPUTYPE),
-    m_sub (0)
+    m_sub (0),
+    m_triple (),
+    m_byte_order (lldb::endian::InlHostByteOrder()),
+    m_addr_byte_size (0)
 {
 }
 
@@ -169,31 +145,38 @@
 ArchSpec::ArchSpec (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t sub) :
     m_type (arch_type),
     m_cpu (cpu),
-    m_sub (sub)
+    m_sub (sub),
+    m_triple (),
+    m_byte_order (lldb::endian::InlHostByteOrder()),
+    m_addr_byte_size (0)
 {
+    if (m_type == eArchTypeMachO)
+        MachOArchUpdated ();
 }
 
 //----------------------------------------------------------------------
 // Constructor that initializes the object with supplied
 // architecture name. There are also predefined values in
 // Defines.h:
-//  liblldb_ARCH_DEFAULT
+//  LLDB_ARCH_DEFAULT
 //      The arch the current system defaults to when a program is
 //      launched without any extra attributes or settings.
 //
-//  liblldb_ARCH_DEFAULT_32BIT
+//  LLDB_ARCH_DEFAULT_32BIT
 //      The 32 bit arch the current system defaults to (if any)
 //
-//  liblldb_ARCH_DEFAULT_32BIT
+//  LLDB_ARCH_DEFAULT_32BIT
 //      The 64 bit arch the current system defaults to (if any)
 //----------------------------------------------------------------------
 ArchSpec::ArchSpec (const char *arch_name) :
     m_type (eArchTypeMachO),        // Use the most complete arch definition which will always be translatable to any other ArchitectureType values
     m_cpu (LLDB_INVALID_CPUTYPE),
-    m_sub (0)
+    m_sub (0),
+    m_triple (),
+    m_byte_order (lldb::endian::InlHostByteOrder()),
+    m_addr_byte_size (0)
 {
-    if (arch_name)
-        SetArch (arch_name);
+    SetArch (arch_name);
 }
 
 //----------------------------------------------------------------------
@@ -214,6 +197,9 @@
         m_type = rhs.m_type;
         m_cpu = rhs.m_cpu;
         m_sub = rhs.m_sub;
+        m_triple = rhs.m_triple;
+        m_byte_order = rhs.m_byte_order;
+        m_addr_byte_size = rhs.m_addr_byte_size;
     }
     return *this;
 }
@@ -294,6 +280,9 @@
     m_type = eArchTypeInvalid;
     m_cpu = LLDB_INVALID_CPUTYPE;
     m_sub = 0;
+    m_triple = llvm::Triple();
+    m_byte_order = lldb::endian::InlHostByteOrder();
+    m_addr_byte_size = 0;
 }
 
 
@@ -1605,6 +1594,9 @@
 uint32_t
 ArchSpec::GetAddressByteSize() const
 {
+    if (m_addr_byte_size > 0)
+        return m_addr_byte_size;
+
     switch (m_type)
     {
     case kNumArchTypes:
@@ -1639,7 +1631,6 @@
         }
         break;
     }
-
     return 0;
 }
 
@@ -1667,6 +1658,105 @@
     }
     return SetArch (target_triple);
 }
+void
+ArchSpec::SetMachOArch (uint32_t cpu, uint32_t sub)
+{
+    m_type = lldb::eArchTypeMachO;
+    m_cpu = cpu;
+    m_sub = sub;
+    MachOArchUpdated ();
+}
+
+void
+ArchSpec::MachOArchUpdated (size_t idx)
+{
+    // m_type, m_cpu, and m_sub have been updated, fixup everything else
+    if (idx >= k_num_mach_arch_defs)
+    {
+        for (size_t i=0; i<k_num_mach_arch_defs; i++)
+        {
+            if (m_cpu == g_mach_arch_defs[i].cpu)
+            {
+                if (m_sub == CPU_ANY || m_sub == LLDB_INVALID_CPUTYPE)
+                {
+                    if (m_sub == g_mach_arch_defs[i].sub)
+                    {
+                        idx = i;
+                        break;
+                    }
+                }
+                else if ((m_sub & 0x00ffffff) == g_mach_arch_defs[i].sub)
+                {
+                    idx = i;
+                    break;
+                }
+            }
+        }
+    }
+    
+    if (idx < k_num_mach_arch_defs)
+    {
+        m_byte_order = g_mach_arch_defs[idx].byte_order;
+        m_addr_byte_size = g_mach_arch_defs[idx].addr_byte_size;
+        char triple_cstr[1024];
+        int triple_cstr_len = ::snprintf (triple_cstr, 
+                                          sizeof(triple_cstr),
+                                          "%s-apple-darwin", 
+                                          g_mach_arch_defs[idx].name);
+        std::string triple_sstr (llvm::Triple::normalize (llvm::StringRef (triple_cstr, triple_cstr_len)));
+        llvm::StringRef triple_sref (triple_sstr.c_str(), triple_sstr.size());
+        llvm::Triple triple (triple_sref);
+        m_triple = triple;
+    }
+    else
+    {
+        assert (!"Unknown mach-o architecture");
+        m_byte_order = lldb::endian::InlHostByteOrder();
+        // We weren't able to find our CPU type in out known list of mach architectures...
+        if (GetCPUType() & llvm::MachO::CPUArchABI64)
+            m_addr_byte_size = 8;
+        else
+            m_addr_byte_size = 4;
+        m_triple = llvm::Triple();
+    }
+}
+
+void
+ArchSpec::ELFArchUpdated (size_t idx)
+{
+    if (idx >= k_num_elf_arch_defs)
+    {
+        for (size_t i=0; i<k_num_elf_arch_defs; i++)
+        {
+            if (g_elf_arch_defs[i].cpu == m_cpu)
+            {
+                idx = i;
+                break;
+            }
+        }
+    }
+    if (idx < k_num_elf_arch_defs)
+    {
+        m_byte_order = g_elf_arch_defs[idx].byte_order;
+        m_addr_byte_size = g_elf_arch_defs[idx].addr_byte_size;
+        char triple_cstr[1024];
+        int triple_cstr_len = ::snprintf (triple_cstr, 
+                                          sizeof(triple_cstr),
+                                          "%s-unknown-unknown", 
+                                          g_elf_arch_defs[idx].name);
+        std::string triple_sstr (llvm::Triple::normalize (llvm::StringRef (triple_cstr, triple_cstr_len)));
+        llvm::StringRef triple_sref (triple_sstr.c_str(), triple_sstr.size());
+        llvm::Triple triple (triple_sref);
+        m_triple = triple;
+    }
+    else
+    {
+        assert (!"Unknown ELF architecture");
+        m_byte_order = lldb::endian::InlHostByteOrder();
+        m_addr_byte_size = sizeof(void *);
+        m_triple = llvm::Triple();
+    }
+}
 
 //----------------------------------------------------------------------
 // Change the CPU type and subtype given an architecture name.
@@ -1676,8 +1766,22 @@
 {
     if (arch_name && arch_name[0] != '\0')
     {
-        size_t i;
+        // All system default architecture string values start with LLDB_ARCH_DEFAULT
+        if (::strncmp (arch_name, LLDB_ARCH_DEFAULT, strlen(LLDB_ARCH_DEFAULT)) == 0)
+        {
+            // Special case for the current host default architectures...
+
+            if (::strcmp (arch_name, LLDB_ARCH_DEFAULT_32BIT) == 0)
+                *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+            else if (::strcmp (arch_name, LLDB_ARCH_DEFAULT_64BIT) == 0)
+                *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
+            else
+                *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+
+            return IsValid();
+        }
 
+        size_t i;
         switch (m_type)
         {
         case eArchTypeInvalid:
@@ -1689,6 +1793,7 @@
                     m_type = eArchTypeMachO;
                     m_cpu = g_mach_arch_defs[i].cpu;
                     m_sub = g_mach_arch_defs[i].sub;
+                    MachOArchUpdated (i);
                     return true;
                 }
             }
@@ -1701,6 +1806,7 @@
                 {
                     m_cpu = g_elf_arch_defs[i].cpu;
                     m_sub = g_elf_arch_defs[i].sub;
+                    ELFArchUpdated (i);
                     return true;
                 }
             }
@@ -1731,6 +1837,7 @@
         
         if (m_type != eArchTypeInvalid)
         {
+            m_type = eArchTypeMachO;
             char *end = NULL;
             m_cpu = ::strtoul (str, &end, 0);
             if (str != end)
@@ -1744,6 +1851,7 @@
                         m_sub = strtoul(str, &end, 0);
                         if (*end == '\0')
                         {
+                            MachOArchUpdated ();
                             // We consumed the entire string and got a cpu type and subtype
                             return true;
                         }
@@ -1760,6 +1868,9 @@
                     if (m_cpu == g_mach_arch_defs[i].cpu)
                     {
                         m_sub = g_mach_arch_defs[i].sub;
+                        m_byte_order = g_mach_arch_defs[i].byte_order;
+                        m_addr_byte_size = g_mach_arch_defs[i].addr_byte_size;
+                        MachOArchUpdated (i);
                         return true;
                     }
                 }
@@ -1767,8 +1878,8 @@
                 // Default the cpu subtype to zero when we don't have a matching
                 // cpu type in our architecture defs structure (g_mach_arch_defs).
                 m_sub = 0;
+                MachOArchUpdated ();
                 return true;
-
             }
         }
     }
@@ -1781,17 +1892,17 @@
 {
     switch (GetGenericCPUType ())
     {
-    case eCPU_ppc:
-    case eCPU_ppc64:
-        return eByteOrderBig;
-
-    case eCPU_arm:
-    case eCPU_i386:
-    case eCPU_x86_64:
-        return eByteOrderLittle;
-
-    default:
-        break;
+        case eCPU_ppc:
+        case eCPU_ppc64:
+            return eByteOrderBig;
+            
+        case eCPU_arm:
+        case eCPU_i386:
+        case eCPU_x86_64:
+            return eByteOrderLittle;
+            
+        default:
+            break;
     }
     return eByteOrderInvalid;
 }

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Feb 15 15:59:32 2011
@@ -1208,9 +1208,7 @@
 
                                     if (vaddr != LLDB_INVALID_ADDRESS)
                                     {
-                                        int addr_width = 0;
-                                        if (exe_ctx && exe_ctx->process)
-                                            addr_width = exe_ctx->process->GetAddressByteSize() * 2;
+                                        int addr_width = target->GetArchitecture().GetAddressByteSize() * 2;
                                         if (addr_width == 0)
                                             addr_width = 16;
                                         s.Printf("0x%*.*llx", addr_width, addr_width, vaddr);

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Tue Feb 15 15:59:32 2011
@@ -436,16 +436,8 @@
             heap_buffer->SetByteSize (bytes_read);
 
         data.SetData(data_sp);
-        if (exe_ctx->process)
-        {
-            data.SetByteOrder(exe_ctx->process->GetByteOrder());
-            data.SetAddressByteSize(exe_ctx->process->GetAddressByteSize());
-        }
-        else
-        {
-            data.SetByteOrder(target->GetArchitecture().GetDefaultEndian());
-            data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
-        }
+        data.SetByteOrder(target->GetArchitecture().GetByteOrder());
+        data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
         return DecodeInstructions (range.GetBaseAddress(), data, 0, UINT32_MAX);
     }
 

Modified: lldb/trunk/source/Core/EmulateInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/EmulateInstruction.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/EmulateInstruction.cpp (original)
+++ lldb/trunk/source/Core/EmulateInstruction.cpp Tue Feb 15 15:59:32 2011
@@ -17,7 +17,7 @@
 using namespace lldb_private;
 
 EmulateInstruction*
-EmulateInstruction::FindPlugin (const ConstString &triple, const char *plugin_name)
+EmulateInstruction::FindPlugin (const ArchSpec &arch, const char *plugin_name)
 {
     EmulateInstructionCreateInstance create_callback = NULL;
     if (plugin_name)
@@ -25,7 +25,7 @@
         create_callback  = PluginManager::GetEmulateInstructionCreateCallbackForPluginName (plugin_name);
         if (create_callback)
         {
-            std::auto_ptr<EmulateInstruction> instance_ap(create_callback(triple));
+            std::auto_ptr<EmulateInstruction> instance_ap(create_callback(arch));
             if (instance_ap.get())
                 return instance_ap.release();
         }
@@ -34,7 +34,7 @@
     {
         for (uint32_t idx = 0; (create_callback = PluginManager::GetEmulateInstructionCreateCallbackAtIndex(idx)) != NULL; ++idx)
         {
-            std::auto_ptr<EmulateInstruction> instance_ap(create_callback(triple));
+            std::auto_ptr<EmulateInstruction> instance_ap(create_callback(arch));
             if (instance_ap.get())
                 return instance_ap.release();
         }

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue Feb 15 15:59:32 2011
@@ -102,11 +102,11 @@
     if (m_did_init_ast == false)
     {
         ObjectFile * objfile = GetObjectFile();
-        ConstString target_triple;
-        if (objfile && objfile->GetTargetTriple(target_triple))
+        ArchSpec object_arch;
+        if (objfile && objfile->GetArchitecture(object_arch))
         {
             m_did_init_ast = true;
-            m_ast.SetTargetTriple (target_triple.AsCString());
+            m_ast.SetArchitecture (object_arch);
         }
     }
     return m_ast;

Modified: lldb/trunk/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Tue Feb 15 15:59:32 2011
@@ -25,6 +25,7 @@
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -542,8 +543,8 @@
         {
             address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
             address_type = eAddressTypeLoad;
-            data.SetByteOrder(exe_ctx->process->GetByteOrder());
-            data.SetAddressByteSize(exe_ctx->process->GetAddressByteSize());
+            data.SetByteOrder(exe_ctx->process->GetTarget().GetArchitecture().GetByteOrder());
+            data.SetAddressByteSize(exe_ctx->process->GetTarget().GetArchitecture().GetAddressByteSize());
         }
         break;
 
@@ -570,8 +571,8 @@
                             if (address != LLDB_INVALID_ADDRESS)
                             {
                                 address_type = eAddressTypeLoad;
-                                data.SetByteOrder(exe_ctx->process->GetByteOrder());
-                                data.SetAddressByteSize(exe_ctx->process->GetAddressByteSize());
+                                data.SetByteOrder(exe_ctx->target->GetArchitecture().GetByteOrder());
+                                data.SetAddressByteSize(exe_ctx->target->GetArchitecture().GetAddressByteSize());
                             }
                             else
                             {

Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Tue Feb 15 15:59:32 2011
@@ -104,10 +104,10 @@
     lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
     ExecutionContext exe_ctx (exe_scope);
     
-    if (exe_ctx.process)
+    if (exe_ctx.target)
     {
-        m_data.SetByteOrder(exe_ctx.process->GetByteOrder());
-        m_data.SetAddressByteSize(exe_ctx.process->GetAddressByteSize());
+        m_data.SetByteOrder(exe_ctx.target->GetArchitecture().GetByteOrder());
+        m_data.SetAddressByteSize(exe_ctx.target->GetArchitecture().GetAddressByteSize());
     }
 
     if (expr.IsLocationList())

Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Tue Feb 15 15:59:32 2011
@@ -178,11 +178,9 @@
 // Implementation of ClangExpressionParser
 //===----------------------------------------------------------------------===//
 
-ClangExpressionParser::ClangExpressionParser(const char *target_triple,
-                                             Process *process,
-                                             ClangExpression &expr) :
-    m_expr(expr),
-    m_target_triple (),
+ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
+                                              ClangExpression &expr) :
+    m_expr (expr),
     m_compiler (),
     m_code_generator (NULL),
     m_execution_engine (),
@@ -195,12 +193,7 @@
             llvm::InitializeAllAsmPrinters();
         }
     } InitializeLLVM;
-    
-    if (target_triple && target_triple[0])
-        m_target_triple = target_triple;
-    else
-        m_target_triple = llvm::sys::getHostTriple();
-    
+        
     // 1. Create a new compiler instance.
     m_compiler.reset(new CompilerInstance());    
     m_compiler->setLLVMContext(new LLVMContext());
@@ -215,6 +208,10 @@
     m_compiler->getLangOpts().ObjC1 = true;
     m_compiler->getLangOpts().ObjC2 = true;
     
+    Process *process = NULL;
+    if (exe_scope)
+        process = exe_scope->CalculateProcess();
+
     if (process)
     {
         if (process->GetObjCLanguageRuntime())
@@ -239,7 +236,19 @@
     m_compiler->getDiagnosticOpts().Warnings.push_back("no-unused-value");
     
     // Set the target triple.
-    m_compiler->getTargetOpts().Triple = m_target_triple;
+    Target *target = NULL;
+    if (exe_scope)
+        target = exe_scope->CalculateTarget();
+
+    // TODO: figure out what to really do when we don't have a valid target.
+    // Sometimes this will be ok to just use the host target triple (when we
+    // evaluate say "2+3", but other expressions like breakpoint conditions
+    // and other things that _are_ target specific really shouldn't just be 
+    // using the host triple. This needs to be fixed in a better way.
+    if (target && target->GetArchitecture().IsValid())
+        m_compiler->getTargetOpts().Triple = target->GetArchitecture().GetTriple().str();
+    else
+        m_compiler->getTargetOpts().Triple = llvm::sys::getHostTriple();
     
     // 3. Set up various important bits of infrastructure.
     m_compiler->createDiagnostics(0, 0);

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Tue Feb 15 15:59:32 2011
@@ -17,6 +17,7 @@
 #include "clang/CodeGen/ModuleBuilder.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/Module.h"
 
@@ -36,6 +37,7 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StopInfo.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlan.h"
 #include "lldb/Target/ThreadPlanCallFunction.h"
@@ -48,13 +50,13 @@
 //----------------------------------------------------------------------
 ClangFunction::ClangFunction 
 (
-    const char *target_triple, 
+    ExecutionContextScope *exe_scope,
     ClangASTContext *ast_context, 
     void *return_qualtype, 
     const Address& functionAddress, 
     const ValueList &arg_value_list
 ) :
-    m_target_triple (target_triple),
+    m_arch (),
     m_function_ptr (NULL),
     m_function_addr (functionAddress),
     m_function_return_qual_type(return_qualtype),
@@ -66,16 +68,22 @@
     m_compiled (false),
     m_JITted (false)
 {
+    if (exe_scope)
+    {
+        Target *target = exe_scope->CalculateTarget();
+        if (target)
+            m_arch = target->GetArchitecture();
+    }
 }
 
 ClangFunction::ClangFunction
 (
-    const char *target_triple, 
+    ExecutionContextScope *exe_scope,
     Function &function, 
     ClangASTContext *ast_context, 
     const ValueList &arg_value_list
 ) :
-    m_target_triple (target_triple),
+    m_arch (),
     m_function_ptr (&function),
     m_function_addr (),
     m_function_return_qual_type (),
@@ -87,6 +95,13 @@
     m_compiled (false),
     m_JITted (false)
 {
+    if (exe_scope)
+    {
+        Target *target = exe_scope->CalculateTarget();
+        if (target)
+            m_arch = target->GetArchitecture();
+    }
+
     m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress();
     m_function_return_qual_type = m_function_ptr->GetReturnType().GetClangType();
 }
@@ -212,7 +227,7 @@
         
     // Okay, now compile this expression
     
-    m_parser.reset(new ClangExpressionParser(m_target_triple.c_str(), NULL, *this));
+    m_parser.reset(new ClangExpressionParser(NULL, *this));
     
     num_errors = m_parser->Parse (errors);
     

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Tue Feb 15 15:59:32 2011
@@ -234,19 +234,6 @@
         return false;
     }
     
-    ConstString target_triple;
-    
-    target->GetTargetTriple (target_triple);
-    
-    if (!target_triple)
-        target_triple = Host::GetTargetTriple ();
-    
-    if (!target_triple)
-    {
-        error_stream.PutCString ("error: invalid target triple\n");
-        return false;
-    }
-        
     //////////////////////////
     // Parse the expression
     //
@@ -257,7 +244,7 @@
     
     m_expr_decl_map->WillParse(exe_ctx);
     
-    ClangExpressionParser parser(target_triple.GetCString(), exe_ctx.process, *this);
+    ClangExpressionParser parser(exe_ctx.process, *this);
     
     unsigned num_errors = parser.Parse (error_stream);
     

Modified: lldb/trunk/source/Expression/ClangUtilityFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUtilityFunction.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUtilityFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangUtilityFunction.cpp Tue Feb 15 15:59:32 2011
@@ -81,20 +81,7 @@
         error_stream.PutCString ("error: invalid target\n");
         return false;
     }
-    
-    ConstString target_triple;
-    
-    target->GetTargetTriple (target_triple);
-    
-    if (!target_triple)
-        target_triple = Host::GetTargetTriple ();
-    
-    if (!target_triple)
-    {
-        error_stream.PutCString ("error: invalid target triple\n");
-        return false;
-    }
-    
+        
     //////////////////////////
     // Parse the expression
     //
@@ -105,7 +92,7 @@
     
     m_expr_decl_map->WillParse(exe_ctx);
         
-    ClangExpressionParser parser(target_triple.GetCString(), exe_ctx.process, *this);
+    ClangExpressionParser parser(exe_ctx.GetBestExecutionContextScope(), *this);
     
     unsigned num_errors = parser.Parse (error_stream);
     

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Tue Feb 15 15:59:32 2011
@@ -222,38 +222,122 @@
 }
 
 const ArchSpec &
-Host::GetArchitecture ()
+Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
 {
-    static ArchSpec g_host_arch;
-    if (!g_host_arch.IsValid())
-    {
+    static bool g_supports_32 = false;
+    static bool g_supports_64 = false;
+    static ArchSpec g_host_arch_32;
+    static ArchSpec g_host_arch_64;
+
 #if defined (__APPLE__)
+
+    // Apple is different in that it can support both 32 and 64 bit executables
+    // in the same operating system running concurrently. Here we detect the
+    // correct host architectures for both 32 and 64 bit including if 64 bit
+    // executables are supported on the system.
+
+    if (g_supports_32 == false && g_supports_64 == false)
+    {
+        // All apple systems support 32 bit execution.
+        g_supports_32 = true;
         uint32_t cputype, cpusubtype;
-        uint32_t is_64_bit_capable;
+        uint32_t is_64_bit_capable = false;
         size_t len = sizeof(cputype);
+        ArchSpec host_arch;
+        // These will tell us about the kernel architecture, which even on a 64
+        // bit machine can be 32 bit...
         if  (::sysctlbyname("hw.cputype", &cputype, &len, NULL, 0) == 0)
         {
-            len = sizeof(cpusubtype);
-            if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &len, NULL, 0) == 0)
-                g_host_arch.SetMachOArch (cputype, cpusubtype);
-            
+            len = sizeof (cpusubtype);
+            if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &len, NULL, 0) != 0)
+                cpusubtype = CPU_TYPE_ANY;
+                
             len = sizeof (is_64_bit_capable);
             if  (::sysctlbyname("hw.cpu64bit_capable", &is_64_bit_capable, &len, NULL, 0) == 0)
             {
                 if (is_64_bit_capable)
+                    g_supports_64 = true;
+            }
+            
+            if (is_64_bit_capable)
+            {
+                if (cputype & CPU_ARCH_ABI64)
                 {
-                    if (cputype == CPU_TYPE_I386 && cpusubtype == CPU_SUBTYPE_486)
+                    // We have a 64 bit kernel on a 64 bit system
+                    g_host_arch_32.SetMachOArch (CPU_TYPE_I386, CPU_SUBTYPE_386);
+                    g_host_arch_64.SetMachOArch (cputype, cpusubtype);
+                }
+                else
+                {
+                    // We have a 32 bit kernel on a 64 bit system
+                    g_host_arch_32.SetMachOArch (cputype, cpusubtype);
+#if defined (__i386__) || defined (__x86_64__)
+                    if (cpusubtype == CPU_SUBTYPE_486)
                         cpusubtype = CPU_SUBTYPE_I386_ALL;
-
+#endif
                     cputype |= CPU_ARCH_ABI64;
+                    g_host_arch_64.SetMachOArch (cputype, cpusubtype);
                 }
             }
+            else
+            {
+                g_host_arch_32.SetMachOArch (cputype, cpusubtype);
+                g_host_arch_64.Clear();
+            }
         }
-#elif defined (__linux__)
-        g_host_arch.SetElfArch(7u, 144u);
+    }
+    
+#else // #if defined (__APPLE__)
+    
+    if (g_supports_32 == false && g_supports_64 == false)
+    {
+#if defined (__x86_64__)
+
+        g_host_arch_64.SetArch ("x86_64");
+        g_supports_32 = false;
+        g_supports_64 = true;
+
+#elif defined (__i386__)
+
+        g_host_arch.SetArch ("i386");
+        g_supports_32 = true;
+        g_supports_64 = false;
+
+#elif defined (__arm__)        
+
+        g_host_arch.SetArch ("arm");
+        g_supports_32 = true;
+        g_supports_64 = false;
+
+#elif defined (__ppc64__)
+
+        g_host_arch.SetArch ("ppc64");
+        g_supports_32 = false;
+        g_supports_64 = true;
+
+#elif defined (__powerpc__) || defined (__ppc__)
+        g_host_arch.SetArch ("ppc");
+        g_supports_32 = true;
+        g_supports_64 = false;
+
+#else
+
+#error undefined architecture, define your architecture here
+
 #endif
     }
-    return g_host_arch;
+    
+#endif // #else for #if defined (__APPLE__)
+    
+    if (arch_kind == eSystemDefaultArchitecture32)
+        return g_host_arch_32;
+    else if (arch_kind == eSystemDefaultArchitecture64)
+        return g_host_arch_64;
+
+    if (g_supports_64)
+        return g_host_arch_64;
+        
+    return g_host_arch_32;
 }
 
 const ConstString &

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Tue Feb 15 15:59:32 2011
@@ -41,15 +41,12 @@
 // Static Functions
 //------------------------------------------------------------------
 lldb_private::ABI *
-ABIMacOSX_i386::CreateInstance (const ConstString &triple)
+ABIMacOSX_i386::CreateInstance (const ArchSpec &arch)
 {
-    llvm::StringRef tripleStr(triple.GetCString());
-    llvm::Triple llvmTriple(tripleStr);
-    
-    if (llvmTriple.getArch() != llvm::Triple::x86)
-        return NULL;
-    
-    return new ABIMacOSX_i386;
+    if (arch.GetTriple().getArch() == llvm::Triple::x86)
+        return new ABIMacOSX_i386;
+
+    return NULL;
 }
 
 bool

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h Tue Feb 15 15:59:32 2011
@@ -63,7 +63,7 @@
         Terminate();
         
         static lldb_private::ABI *
-        CreateInstance (const ConstString &triple);
+        CreateInstance (const ArchSpec &arch);
         
         //------------------------------------------------------------------
         // PluginInterface protocol

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Tue Feb 15 15:59:32 2011
@@ -42,15 +42,11 @@
 // Static Functions
 //------------------------------------------------------------------
 lldb_private::ABI *
-ABISysV_x86_64::CreateInstance (const ConstString &triple)
+ABISysV_x86_64::CreateInstance (const ArchSpec &arch)
 {
-    llvm::StringRef tripleStr(triple.GetCString());
-    llvm::Triple llvmTriple(tripleStr);
-
-    if (llvmTriple.getArch() != llvm::Triple::x86_64)
-        return NULL;
-
-    return new ABISysV_x86_64;
+    if (arch.GetTriple().getArch() == llvm::Triple::x86_64)
+        return new ABISysV_x86_64;
+    return NULL;
 }
 
 bool
@@ -227,7 +223,9 @@
         uint8_t arg_data[sizeof(arg_contents)];
         Error error;
         thread.GetProcess().ReadMemory(current_stack_argument, arg_data, sizeof(arg_contents), error);
-        DataExtractor arg_data_extractor(arg_data, sizeof(arg_contents), thread.GetProcess().GetByteOrder(), thread.GetProcess().GetAddressByteSize());
+        DataExtractor arg_data_extractor (arg_data, sizeof(arg_contents), 
+                                          thread.GetProcess().GetTarget().GetArchitecture().GetByteOrder(), 
+                                          thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize());
         uint32_t offset = 0;
         arg_contents = arg_data_extractor.GetMaxU64(&offset, bit_width / 8);
         if (!offset)

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h Tue Feb 15 15:59:32 2011
@@ -62,7 +62,7 @@
     Terminate();
 
     static lldb_private::ABI *
-    CreateInstance (const ConstString &triple);
+    CreateInstance (const ArchSpec &arch);
 
     //------------------------------------------------------------------
     // PluginInterface protocol

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue Feb 15 15:59:32 2011
@@ -424,7 +424,7 @@
     m_dyld_all_image_infos.Clear();
     if (m_dyld_all_image_infos_addr != LLDB_INVALID_ADDRESS)
     {
-        ByteOrder byte_order = m_process->GetByteOrder();
+        ByteOrder byte_order = m_process->GetTarget().GetArchitecture().GetByteOrder();
         uint32_t addr_size = 4;
         if (m_dyld_all_image_infos_addr > UINT32_MAX)
             addr_size = 8;

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Tue Feb 15 15:59:32 2011
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 
 #include "EmulateInstructionARM.h"
+#include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/ConstString.h"
 
 #include "Plugins/Process/Utility/ARMDefines.h"
@@ -3620,38 +3621,22 @@
 }
 
 bool
-EmulateInstructionARM::SetTargetTriple (const ConstString &triple)
+EmulateInstructionARM::SetArchitecture (const ArchSpec &arch)
 {
     m_arm_isa = 0;
-    const char *triple_cstr = triple.GetCString();
-    if (triple_cstr)
+    const char *arch_cstr = arch.AsCString ();
+    if (arch_cstr)
     {
-        const char *dash = ::strchr (triple_cstr, '-');
-        if (dash)
-        {
-            std::string arch (triple_cstr, dash);
-            const char *arch_cstr = arch.c_str();
-            if (strcasecmp(arch_cstr, "armv4t") == 0)
-                m_arm_isa = ARMv4T;
-            else if (strcasecmp(arch_cstr, "armv4") == 0)
-                m_arm_isa = ARMv4;
-            else if (strcasecmp(arch_cstr, "armv5tej") == 0)
-                m_arm_isa = ARMv5TEJ;
-            else if (strcasecmp(arch_cstr, "armv5te") == 0)
-                m_arm_isa = ARMv5TE;
-            else if (strcasecmp(arch_cstr, "armv5t") == 0)
-                m_arm_isa = ARMv5T;
-            else if (strcasecmp(arch_cstr, "armv6k") == 0)
-                m_arm_isa = ARMv6K;
-            else if (strcasecmp(arch_cstr, "armv6") == 0)
-                m_arm_isa = ARMv6;
-            else if (strcasecmp(arch_cstr, "armv6t2") == 0)
-                m_arm_isa = ARMv6T2;
-            else if (strcasecmp(arch_cstr, "armv7") == 0)
-                m_arm_isa = ARMv7;
-            else if (strcasecmp(arch_cstr, "armv8") == 0)
-                m_arm_isa = ARMv8;
-        }
+        if      (0 == ::strcasecmp(arch_cstr, "armv4t"))    m_arm_isa = ARMv4T;
+        else if (0 == ::strcasecmp(arch_cstr, "armv4"))     m_arm_isa = ARMv4;
+        else if (0 == ::strcasecmp(arch_cstr, "armv5tej"))  m_arm_isa = ARMv5TEJ;
+        else if (0 == ::strcasecmp(arch_cstr, "armv5te"))   m_arm_isa = ARMv5TE;
+        else if (0 == ::strcasecmp(arch_cstr, "armv5t"))    m_arm_isa = ARMv5T;
+        else if (0 == ::strcasecmp(arch_cstr, "armv6k"))    m_arm_isa = ARMv6K;
+        else if (0 == ::strcasecmp(arch_cstr, "armv6"))     m_arm_isa = ARMv6;
+        else if (0 == ::strcasecmp(arch_cstr, "armv6t2"))   m_arm_isa = ARMv6T2;
+        else if (0 == ::strcasecmp(arch_cstr, "armv7"))     m_arm_isa = ARMv7;
+        else if (0 == ::strcasecmp(arch_cstr, "armv8"))     m_arm_isa = ARMv8;
     }
     return m_arm_isa != 0;
 }

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h Tue Feb 15 15:59:32 2011
@@ -131,7 +131,7 @@
     
     
     virtual bool
-    SetTargetTriple (const ConstString &triple);
+    SetArchitecture (const ArchSpec &arch);
 
     virtual bool 
     ReadInstruction ();

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Tue Feb 15 15:59:32 2011
@@ -104,7 +104,6 @@
     arg_value_list.PushValue(value);
     
     // This is the return value:
-    const char *target_triple = exe_ctx.process->GetTargetTriple().GetCString();
     ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext();
     
     void *return_qualtype = ast_context->GetCStringType(true);
@@ -112,7 +111,12 @@
     ret.SetContext(Value::eContextTypeClangType, return_qualtype);
     
     // Now we're ready to call the function:
-    ClangFunction func(target_triple, ast_context, return_qualtype, *function_address, arg_value_list);
+    ClangFunction func (exe_ctx.GetBestExecutionContextScope(),
+                        ast_context, 
+                        return_qualtype, 
+                        *function_address, 
+                        arg_value_list);
+
     StreamString error_stream;
     
     lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Tue Feb 15 15:59:32 2011
@@ -819,11 +819,11 @@
                 // Next make the runner function for our implementation utility function.
                 if (!m_impl_function.get())
                 {
-                     m_impl_function.reset(new ClangFunction(process->GetTargetTriple().GetCString(), 
-                                                             clang_ast_context, 
-                                                             clang_void_ptr_type, 
-                                                             impl_code_address, 
-                                                             dispatch_values));
+                     m_impl_function.reset(new ClangFunction (&thread,
+                                                              clang_ast_context, 
+                                                              clang_void_ptr_type, 
+                                                              impl_code_address, 
+                                                              dispatch_values));
                     
                     errors.Clear();        
                     unsigned num_errors = m_impl_function->CompileFunction(errors);

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Tue Feb 15 15:59:32 2011
@@ -1043,40 +1043,28 @@
 }
 
 bool
-ObjectFileELF::GetTargetTriple(ConstString &target_triple)
+ObjectFileELF::GetArchitecture (ArchSpec &arch)
 {
-    static ConstString g_target_triple;
-
-    if (g_target_triple)
-    {
-        target_triple = g_target_triple;
-        return true;
-    }
-
-    std::string triple;
     switch (m_header.e_machine)
     {
     default:
         assert(false && "Unexpected machine type.");
         break;
-    case EM_SPARC:  triple.assign("sparc-"); break;
-    case EM_386:    triple.assign("i386-"); break;
-    case EM_68K:    triple.assign("68k-"); break;
-    case EM_88K:    triple.assign("88k-"); break;
-    case EM_860:    triple.assign("i860-"); break;
-    case EM_MIPS:   triple.assign("mips-"); break;
-    case EM_PPC:    triple.assign("powerpc-"); break;
-    case EM_PPC64:  triple.assign("powerpc64-"); break;
-    case EM_ARM:    triple.assign("arm-"); break;
-    case EM_X86_64: triple.assign("x86_64-"); break;
+    case EM_SPARC:  arch.GetTriple().setArchName("sparc"); break;
+    case EM_386:    arch.GetTriple().setArchName("i386"); break;
+    case EM_68K:    arch.GetTriple().setArchName("68k"); break;
+    case EM_88K:    arch.GetTriple().setArchName("88k"); break;
+    case EM_860:    arch.GetTriple().setArchName("i860"); break;
+    case EM_MIPS:   arch.GetTriple().setArchName("mips"); break;
+    case EM_PPC:    arch.GetTriple().setArchName("powerpc"); break;
+    case EM_PPC64:  arch.GetTriple().setArchName("powerpc64"); break;
+    case EM_ARM:    arch.GetTriple().setArchName("arm"); break;
+    case EM_X86_64: arch.GetTriple().setArchName("x86_64"); break;
     }
     // TODO: determine if there is a vendor in the ELF? Default to "linux" for now
-    triple += "linux-";
+    arch.GetTriple().setOSName ("linux");
     // TODO: determine if there is an OS in the ELF? Default to "gnu" for now
-    triple += "gnu";
-    g_target_triple.SetCString(triple.c_str());
-    target_triple = g_target_triple;
-
+    arch.GetTriple().setVendorName("gnu");
     return true;
 }
 

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Tue Feb 15 15:59:32 2011
@@ -105,7 +105,7 @@
     Dump(lldb_private::Stream *s);
 
     virtual bool
-    GetTargetTriple(lldb_private::ConstString &target_triple);
+    GetArchitecture (lldb_private::ArchSpec &arch);
 
     virtual bool
     GetUUID(lldb_private::UUID* uuid);

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Feb 15 15:59:32 2011
@@ -1436,15 +1436,11 @@
 }
 
 bool
-ObjectFileMachO::GetTargetTriple (ConstString &target_triple)
+ObjectFileMachO::GetArchitecture (ArchSpec &arch)
 {
     lldb_private::Mutex::Locker locker(m_mutex);
-    std::string triple(GetModule()->GetArchitecture().AsCString());
-    triple += "-apple-darwin";
-    target_triple.SetCString(triple.c_str());
-    if (target_triple)
-        return true;
-    return false;
+    arch.SetMachOArch(m_header.cputype, m_header.cpusubtype);
+    return true;
 }
 
 

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Tue Feb 15 15:59:32 2011
@@ -83,7 +83,7 @@
     Dump (lldb_private::Stream *s);
 
     virtual bool
-    GetTargetTriple (lldb_private::ConstString &target_triple);
+    GetArchitecture (lldb_private::ArchSpec &arch);
 
     virtual bool
     GetUUID (lldb_private::UUID* uuid);

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Tue Feb 15 15:59:32 2011
@@ -443,39 +443,10 @@
         Module * exe_module = GetTarget().GetExecutableModule ().get();
         assert (exe_module);
 
-        m_arch_spec = exe_module->GetArchitecture();
-        assert (m_arch_spec.IsValid());
-
-        ObjectFile *exe_objfile = exe_module->GetObjectFile();
-        assert (exe_objfile);
-
-        m_byte_order = exe_objfile->GetByteOrder();
-        assert (m_byte_order != eByteOrderInvalid);
         // Install a signal handler so we can catch when our child process
         // dies and set the exit status correctly.
 
         m_monitor_thread = Host::StartMonitoringChildProcess (Process::SetProcessExitStatus, NULL, GetID(), false);
-
-        if (m_arch_spec == ArchSpec("arm"))
-        {
-            // On ARM we want the actual target triple of the OS to get the
-            // most capable ARM slice for the process. Since this plug-in is
-            // only used for doing native debugging this will work.
-            m_target_triple = Host::GetTargetTriple();
-        }
-        else
-        {
-            // We want the arch of the process, and the vendor and OS from the
-            // host OS.
-            StreamString triple;
-
-            triple.Printf("%s-%s-%s", 
-                          m_arch_spec.AsCString(), 
-                          Host::GetVendorString().AsCString("apple"), 
-                          Host::GetOSString().AsCString("darwin"));
-
-            m_target_triple.SetCString(triple.GetString().c_str());
-        }
     }
 }
 
@@ -883,12 +854,6 @@
     return error;
 }
 
-ByteOrder
-ProcessMacOSX::GetByteOrder () const
-{
-    return m_byte_order;
-}
-
 //------------------------------------------------------------------
 // Process Queries
 //------------------------------------------------------------------

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h Tue Feb 15 15:59:32 2011
@@ -222,9 +222,6 @@
     virtual lldb_private::Error
     DisableWatchpoint (lldb_private::WatchpointLocation *wp_loc);
 
-    virtual lldb::ByteOrder
-    GetByteOrder () const;
-
     virtual lldb_private::DynamicLoader *
     GetDynamicLoader ();
 

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Tue Feb 15 15:59:32 2011
@@ -107,7 +107,9 @@
 
         uint8_t memory_buffer[8];
         addr_t dispatch_queue_offsets_addr = LLDB_INVALID_ADDRESS;
-        DataExtractor data(memory_buffer, sizeof(memory_buffer), m_process.GetByteOrder(), m_process.GetAddressByteSize());
+        DataExtractor data (memory_buffer, sizeof(memory_buffer), 
+                            m_process.GetTarget().GetArchitecture().GetByteOrder(), 
+                            m_process.GetTarget().GetArchitecture().GetAddressByteSize());
         static ConstString g_dispatch_queue_offsets_symbol_name ("dispatch_queue_offsets");
         const Symbol *dispatch_queue_offsets_symbol = NULL;
         ModuleSP module_sp(m_process.GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libSystem.B.dylib", false)));
@@ -477,6 +479,8 @@
     case eStateStepping:
         Resume();
         break;
+    default:
+        break;
     }
     m_context->ThreadWillResume();
 }

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue Feb 15 15:59:32 2011
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 // Other libraries and framework includes
+#include "llvm/ADT/Triple.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Core/ConnectionFileDescriptor.h"
 #include "lldb/Core/Log.h"

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Feb 15 15:59:32 2011
@@ -638,7 +638,7 @@
 
         BuildDynamicRegisterInfo (false);
 
-        m_byte_order = m_gdb_comm.GetByteOrder();
+        m_target.GetArchitecture().SetByteOrder (m_gdb_comm.GetByteOrder());
 
         StreamString strm;
 
@@ -656,33 +656,16 @@
         // defacto architecture in this case.
 
         if (gdb_remote_arch == ArchSpec ("arm") && 
-            vendor != NULL && 
-            strcmp(vendor, "apple") == 0)
+            vendor && ::strcmp(vendor, "apple") == 0)
         {
             GetTarget().SetArchitecture (gdb_remote_arch);
             target_arch = gdb_remote_arch;
         }
         
-        if (!target_arch.IsValid())
-            target_arch = gdb_remote_arch;
-
-        if (target_arch.IsValid())
-        {
-            if (vendor == NULL)
-                vendor = Host::GetVendorString().AsCString("apple");
-            
-            if (os_type == NULL)
-                os_type = Host::GetOSString().AsCString("darwin");
-
-            strm.Printf ("%s-%s-%s", target_arch.AsCString(), vendor, os_type);
-
-            std::transform (strm.GetString().begin(), 
-                            strm.GetString().end(), 
-                            strm.GetString().begin(), 
-                            ::tolower);
-
-            m_target_triple.SetCString(strm.GetString().c_str());
-        }
+        if (vendor)
+            m_target.GetArchitecture().GetTriple().setVendorName(vendor);
+        if (os_type)
+            m_target.GetArchitecture().GetTriple().setOSName(os_type);
     }
 }
 
@@ -2557,7 +2540,10 @@
         }
 
         uint8_t memory_buffer[8];
-        DataExtractor data(memory_buffer, sizeof(memory_buffer), GetByteOrder(), GetAddressByteSize());
+        DataExtractor data (memory_buffer, 
+                            sizeof(memory_buffer), 
+                            m_target.GetArchitecture().GetByteOrder(), 
+                            m_target.GetArchitecture().GetAddressByteSize());
 
         // Excerpt from src/queue_private.h
         struct dispatch_queue_offsets_s

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Feb 15 15:59:32 2011
@@ -54,6 +54,7 @@
 #include <assert.h>
 #endif
 
+#include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/dwarf.h"
 #include "lldb/Core/Flags.h"
 #include "lldb/Core/Log.h"
@@ -395,6 +396,13 @@
     m_target_triple.assign(target_triple);
 }
 
+void
+ClangASTContext::SetArchitecture (const ArchSpec &arch)
+{
+    Clear();
+    m_target_triple.assign(arch.GetTriple().str());
+}
+
 bool
 ClangASTContext::HasExternalSource ()
 {

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Tue Feb 15 15:59:32 2011
@@ -25,6 +25,7 @@
 
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -355,7 +356,8 @@
     if (address != LLDB_INVALID_ADDRESS)
     {
         DataExtractor data;
-        data.SetByteOrder (exe_ctx->process->GetByteOrder());
+        if (exe_ctx->target)
+            data.SetByteOrder (exe_ctx->target->GetArchitecture().GetByteOrder());
         if (ReadFromMemory (exe_ctx, address, address_type, data))
         {
             DumpValue(exe_ctx, s, data, 0, show_types, show_summary, verbose);

Modified: lldb/trunk/source/Symbol/UnwindTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindTable.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindTable.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindTable.cpp Tue Feb 15 15:59:32 2011
@@ -58,12 +58,11 @@
     }
     
     ArchSpec arch;
-    ConstString str;
-    m_object_file.GetTargetTriple (str);
-    arch.SetArchFromTargetTriple (str.GetCString());
-    m_assembly_profiler = UnwindAssemblyProfiler::FindPlugin (arch);
-
-    m_initialized = true;
+    if (m_object_file.GetArchitecture (arch))
+    {
+        m_assembly_profiler = UnwindAssemblyProfiler::FindPlugin (arch);
+        m_initialized = true;
+    }
 }
 
 UnwindTable::~UnwindTable ()

Modified: lldb/trunk/source/Target/ABI.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ABI.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Target/ABI.cpp (original)
+++ lldb/trunk/source/Target/ABI.cpp Tue Feb 15 15:59:32 2011
@@ -14,7 +14,7 @@
 using namespace lldb_private;
 
 ABI*
-ABI::FindPlugin (const ConstString &triple)
+ABI::FindPlugin (const ArchSpec &arch)
 {
     std::auto_ptr<ABI> abi_ap;
     ABICreateInstance create_callback;
@@ -23,7 +23,7 @@
          (create_callback = PluginManager::GetABICreateCallbackAtIndex(idx)) != NULL;
          ++idx)
     {
-        abi_ap.reset (create_callback(triple));
+        abi_ap.reset (create_callback(arch));
 
         if (abi_ap.get())
             return abi_ap.release();

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Feb 15 15:59:32 2011
@@ -229,9 +229,6 @@
     m_breakpoint_site_list (),
     m_dynamic_checkers_ap (),
     m_unix_signals (),
-    m_target_triple (),
-    m_byte_order (lldb::endian::InlHostByteOrder()),
-    m_addr_byte_size (0),
     m_abi_sp (),
     m_process_input_reader (),
     m_stdio_communication ("process.stdio"),
@@ -857,15 +854,8 @@
 const ABI *
 Process::GetABI()
 {
-    ConstString& triple = m_target_triple;
-
-    if (triple.IsEmpty())
-        return NULL;
-
     if (m_abi_sp.get() == NULL)
-    {
-        m_abi_sp.reset(ABI::FindPlugin(triple));
-    }
+        m_abi_sp.reset(ABI::FindPlugin(m_target.GetArchitecture()));
 
     return m_abi_sp.get();
 }
@@ -1317,7 +1307,10 @@
     else
     {
         uint8_t tmp[sizeof(uint64_t)];
-        DataExtractor data (tmp, integer_byte_size, GetByteOrder(), GetAddressByteSize());
+        DataExtractor data (tmp, 
+                            integer_byte_size, 
+                            m_target.GetArchitecture().GetByteOrder(), 
+                            m_target.GetArchitecture().GetAddressByteSize());
         if (ReadMemory (vm_addr, tmp, integer_byte_size, error) == integer_byte_size)
         {
             uint32_t offset = 0;
@@ -1509,7 +1502,6 @@
 )
 {
     Error error;
-    m_target_triple.Clear();
     m_abi_sp.reset();
     m_process_input_reader.reset();
 
@@ -1666,7 +1658,6 @@
 Process::Attach (lldb::pid_t attach_pid)
 {
 
-    m_target_triple.Clear();
     m_abi_sp.reset();
     m_process_input_reader.reset();
 
@@ -1710,7 +1701,6 @@
 Error
 Process::Attach (const char *process_name, bool wait_for_launch)
 {
-    m_target_triple.Clear();
     m_abi_sp.reset();
     m_process_input_reader.reset();
     
@@ -1756,7 +1746,6 @@
 Error
 Process::ConnectRemote (const char *remote_url)
 {
-    m_target_triple.Clear();
     m_abi_sp.reset();
     m_process_input_reader.reset();
     
@@ -1975,32 +1964,19 @@
     return error;
 }
 
-UnixSignals &
-Process::GetUnixSignals ()
+lldb::ByteOrder
+Process::GetByteOrder () const
 {
-    return m_unix_signals;
-}
-
-Target &
-Process::GetTarget ()
-{
-    return m_target;
-}
-
-const Target &
-Process::GetTarget () const
-{
-    return m_target;
+    return m_target.GetArchitecture().GetByteOrder();
 }
 
 uint32_t
-Process::GetAddressByteSize()
+Process::GetAddressByteSize () const
 {
-    if (m_addr_byte_size == 0)
-        return m_target.GetArchitecture().GetAddressByteSize();
-    return m_addr_byte_size;
+    return m_target.GetArchitecture().GetAddressByteSize();
 }
 
+
 bool
 Process::ShouldBroadcastEvent (Event *event_ptr)
 {
@@ -2111,22 +2087,6 @@
     return return_value;
 }
 
-//------------------------------------------------------------------
-// Thread Queries
-//------------------------------------------------------------------
-
-ThreadList &
-Process::GetThreadList ()
-{
-    return m_thread_list;
-}
-
-const ThreadList &
-Process::GetThreadList () const
-{
-    return m_thread_list;
-}
-
 
 bool
 Process::StartPrivateStateThread ()
@@ -2517,30 +2477,6 @@
     return false;
 }
 
-Target *
-Process::CalculateTarget ()
-{
-    return &m_target;
-}
-
-Process *
-Process::CalculateProcess ()
-{
-    return this;
-}
-
-Thread *
-Process::CalculateThread ()
-{
-    return NULL;
-}
-
-StackFrame *
-Process::CalculateStackFrame ()
-{
-    return NULL;
-}
-
 void
 Process::CalculateExecutionContext (ExecutionContext &exe_ctx)
 {

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Tue Feb 15 15:59:32 2011
@@ -910,7 +910,7 @@
 
     if (show_frame_index)
         strm->Printf("frame #%u: ", m_frame_index);
-    strm->Printf("0x%0*llx ", m_thread.GetProcess().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess().GetTarget()));
+    strm->Printf("0x%0*llx ", m_thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess().GetTarget()));
     GetSymbolContext(eSymbolContextEverything);
     const bool show_module = true;
     const bool show_inline = true;

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Feb 15 15:59:32 2011
@@ -45,7 +45,6 @@
     m_breakpoint_list (false),
     m_internal_breakpoint_list (true),
     m_process_sp(),
-    m_triple(),
     m_search_filter_sp(),
     m_image_search_paths (ImageSearchPathsChanged, this),
     m_scratch_ast_context_ap (NULL),
@@ -447,10 +446,9 @@
         }
         
         // Now see if we know the target triple, and if so, create our scratch AST context:
-        ConstString target_triple;
-        if (GetTargetTriple(target_triple))
+        if (m_arch_spec.IsValid())
         {
-            m_scratch_ast_context_ap.reset (new ClangASTContext(target_triple.GetCString()));
+            m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch_spec.GetTriple().str().c_str()));
         }
     }
 
@@ -458,18 +456,6 @@
 }
 
 
-ModuleList&
-Target::GetImages ()
-{
-    return m_images;
-}
-
-ArchSpec
-Target::GetArchitecture () const
-{
-    return m_arch_spec;
-}
-
 bool
 Target::SetArchitecture (const ArchSpec &arch_spec)
 {
@@ -492,7 +478,6 @@
         ModuleSP executable_sp = GetExecutableModule ();
         m_images.Clear();
         m_scratch_ast_context_ap.reset();
-        m_triple.Clear();
         // Need to do something about unsetting breakpoints.
         
         if (executable_sp)
@@ -524,31 +509,6 @@
     }
 }
 
-bool
-Target::GetTargetTriple(ConstString &triple)
-{
-    triple.Clear();
-
-    if (m_triple)
-    {
-        triple = m_triple;
-    }
-    else
-    {
-        Module *exe_module = GetExecutableModule().get();
-        if (exe_module)
-        {
-            ObjectFile *objfile = exe_module->GetObjectFile();
-            if (objfile)
-            {
-                objfile->GetTargetTriple(m_triple);
-                triple = m_triple;
-            }
-        }
-    }
-    return !triple.IsEmpty();
-}
-
 void
 Target::ModuleAdded (ModuleSP &module_sp)
 {

Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Tue Feb 15 15:59:32 2011
@@ -21,6 +21,7 @@
 #include "lldb/Symbol/Function.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlanStepOut.h"
 #include "lldb/Target/ThreadPlanStepThrough.h"
@@ -75,7 +76,8 @@
     if (log)
     {
         StreamString s;
-        s.Address (m_thread.GetRegisterContext()->GetPC(), m_thread.GetProcess().GetAddressByteSize());
+        s.Address (m_thread.GetRegisterContext()->GetPC(), 
+                   m_thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize());
         log->Printf("ThreadPlanStepInRange reached %s.", s.GetData());
     }
 

Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Tue Feb 15 15:59:32 2011
@@ -123,10 +123,10 @@
                     StreamString s;
                     s.PutCString ("Stepped in to: ");
                     addr_t stop_addr = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
-                    s.Address (stop_addr, m_thread.GetProcess().GetAddressByteSize());
+                    s.Address (stop_addr, m_thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize());
                     s.PutCString (" stepping out to: ");
                     addr_t return_addr = return_frame->GetRegisterContext()->GetPC();
-                    s.Address (return_addr, m_thread.GetProcess().GetAddressByteSize());
+                    s.Address (return_addr, m_thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize());
                     log->Printf("%s.", s.GetData());
                 }
                 m_thread.QueueThreadPlanForStepOut(false, NULL, true, m_stop_other_threads, eVoteNo, eVoteNoOpinion, 0);

Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Tue Feb 15 15:59:32 2011
@@ -19,6 +19,7 @@
 #include "lldb/Core/Stream.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlanStepOut.h"
 #include "lldb/Target/ThreadPlanStepThrough.h"
@@ -69,7 +70,8 @@
     if (log)
     {
         StreamString s;
-        s.Address (m_thread.GetRegisterContext()->GetPC(), m_thread.GetProcess().GetAddressByteSize());
+        s.Address (m_thread.GetRegisterContext()->GetPC(), 
+                   m_thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize());
         log->Printf("ThreadPlanStepOverRange reached %s.", s.GetData());
     }
     

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=125602&r1=125601&r2=125602&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Tue Feb 15 15:59:32 2011
@@ -3270,7 +3270,10 @@
     strm << "endian:pdp;";
 #endif
 
-    strm << "ptrsize:" << std::dec << sizeof(void *) << ';';
+    if (promoted_to_64)
+        strm << "ptrsize:8;";
+    else
+        strm << "ptrsize:" << std::dec << sizeof(void *) << ';';
     return SendPacket (strm.str());
 }
 





More information about the lldb-commits mailing list