forked from OSchip/llvm-project
Abtracted all mach-o and ELF out of ArchSpec. This patch is a modified form
of Stephen Wilson's idea (thanks for the input Stephen!). What I ended up doing was: - Got rid of ArchSpec::CPU (which was a generic CPU enumeration that mimics the contents of llvm::Triple::ArchType). We now rely upon the llvm::Triple to give us the machine type from llvm::Triple::ArchType. - There is a new ArchSpec::Core definition which further qualifies the CPU core we are dealing with into a single enumeration. If you need support for a new Core and want to debug it in LLDB, it must be added to this list. In the future we can allow for dynamic core registration, but for now it is hard coded. - The ArchSpec can now be initialized with a llvm::Triple or with a C string that represents the triple (it can just be an arch still like "i386"). - The ArchSpec can still initialize itself with a architecture type -- mach-o with cpu type and subtype, or ELF with e_machine + e_flags -- and this will then get translated into the internal llvm::Triple::ArchSpec + ArchSpec::Core. The mach-o cpu type and subtype can be accessed using the getter functions: uint32_t ArchSpec::GetMachOCPUType () const; uint32_t ArchSpec::GetMachOCPUSubType () const; But these functions are just converting out internal llvm::Triple::ArchSpec + ArchSpec::Core back into mach-o. Same goes for ELF. All code has been updated to deal with the changes. This should abstract us until later when the llvm::TargetSpec stuff gets finalized and we can then adopt it. llvm-svn: 126278
This commit is contained in:
parent
37de3235e5
commit
64195a2c8b
|
@ -13,37 +13,86 @@
|
|||
#if defined(__cplusplus)
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
struct CoreDefinition;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h"
|
||||
/// @brief An architecture specification class.
|
||||
///
|
||||
/// A class designed to be created from a cpu type and subtype, or a
|
||||
/// string representation. Keeping all of the conversions of strings
|
||||
/// to architecture enumeration values confined to this class allows
|
||||
/// new architecture support to be added easily.
|
||||
/// A class designed to be created from a cpu type and subtype, a
|
||||
/// string representation, or an llvm::Triple. Keeping all of the
|
||||
/// conversions of strings to architecture enumeration values confined
|
||||
/// to this class allows new architecture support to be added easily.
|
||||
//----------------------------------------------------------------------
|
||||
class ArchSpec
|
||||
{
|
||||
public:
|
||||
// Generic CPU types that each m_type needs to know how to convert
|
||||
// their m_cpu and m_sub to.
|
||||
enum CPU
|
||||
enum Core
|
||||
{
|
||||
eCPU_Unknown,
|
||||
eCPU_arm,
|
||||
eCPU_i386,
|
||||
eCPU_x86_64,
|
||||
eCPU_ppc,
|
||||
eCPU_ppc64,
|
||||
eCPU_sparc
|
||||
eCore_alpha_generic,
|
||||
|
||||
eCore_arm_generic,
|
||||
eCore_arm_armv4,
|
||||
eCore_arm_armv4t,
|
||||
eCore_arm_armv5,
|
||||
eCore_arm_armv5t,
|
||||
eCore_arm_armv6,
|
||||
eCore_arm_armv7,
|
||||
eCore_arm_xscale,
|
||||
|
||||
eCore_ppc_generic,
|
||||
eCore_ppc_ppc601,
|
||||
eCore_ppc_ppc602,
|
||||
eCore_ppc_ppc603,
|
||||
eCore_ppc_ppc603e,
|
||||
eCore_ppc_ppc603ev,
|
||||
eCore_ppc_ppc604,
|
||||
eCore_ppc_ppc604e,
|
||||
eCore_ppc_ppc620,
|
||||
eCore_ppc_ppc750,
|
||||
eCore_ppc_ppc7400,
|
||||
eCore_ppc_ppc7450,
|
||||
eCore_ppc_ppc970,
|
||||
|
||||
eCore_ppc64_generic,
|
||||
eCore_ppc64_ppc970_64,
|
||||
|
||||
eCore_sparc_generic,
|
||||
|
||||
eCore_sparc9_generic,
|
||||
|
||||
eCore_x86_32_i386,
|
||||
eCore_x86_32_i486,
|
||||
eCore_x86_32_i486sx,
|
||||
|
||||
eCore_x86_64_x86_64,
|
||||
kNumCores,
|
||||
|
||||
kCore_invalid,
|
||||
// The following constants are used for wildcard matching only
|
||||
kCore_any,
|
||||
|
||||
kCore_arm_any,
|
||||
kCore_arm_first = eCore_arm_generic,
|
||||
kCore_arm_last = eCore_arm_xscale,
|
||||
|
||||
kCore_ppc_any,
|
||||
kCore_ppc_first = eCore_ppc_generic,
|
||||
kCore_ppc_last = eCore_ppc_ppc970,
|
||||
|
||||
kCore_ppc64_any,
|
||||
kCore_ppc64_first = eCore_ppc64_generic,
|
||||
kCore_ppc64_last = eCore_ppc64_ppc970_64,
|
||||
|
||||
kCore_x86_32_any,
|
||||
kCore_x86_32_first = eCore_x86_32_i386,
|
||||
kCore_x86_32_last = eCore_x86_32_i486sx
|
||||
};
|
||||
|
||||
static void
|
||||
Initialize();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor.
|
||||
|
@ -54,30 +103,22 @@ public:
|
|||
ArchSpec ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Constructor with cpu type and subtype.
|
||||
/// Constructor over triple.
|
||||
///
|
||||
/// Constructor that initializes the object with supplied cpu and
|
||||
/// subtypes.
|
||||
/// Constructs an ArchSpec with properties consistent with the given
|
||||
/// Triple.
|
||||
//------------------------------------------------------------------
|
||||
ArchSpec (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t sub);
|
||||
|
||||
ArchSpec (const llvm::Triple &triple);
|
||||
ArchSpec (const char *triple_cstr);
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with architecture name.
|
||||
/// Constructor over architecture name.
|
||||
///
|
||||
/// Constructor that initializes the object with supplied
|
||||
/// architecture name. There are also predefined values in
|
||||
/// Defines.h:
|
||||
/// @li \c LLDB_ARCH_DEFAULT
|
||||
/// The arch the current system defaults to when a program is
|
||||
/// launched without any extra attributes or settings.
|
||||
///
|
||||
/// @li \c LLDB_ARCH_DEFAULT_32BIT
|
||||
/// The 32 bit arch the current system defaults to (if any)
|
||||
///
|
||||
/// @li \c LLDB_ARCH_DEFAULT_32BIT
|
||||
/// The 64 bit arch the current system defaults to (if any)
|
||||
/// Constructs an ArchSpec with properties consistent with the given
|
||||
/// object type and architecture name.
|
||||
//------------------------------------------------------------------
|
||||
ArchSpec (const char *arch_name);
|
||||
ArchSpec (lldb::ArchitectureType arch_type,
|
||||
uint32_t cpu_type,
|
||||
uint32_t cpu_subtype);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
|
@ -92,40 +133,19 @@ public:
|
|||
///
|
||||
/// @param[in] rhs another ArchSpec object to copy.
|
||||
///
|
||||
/// @return a const reference to this object
|
||||
/// @return A const reference to this object.
|
||||
//------------------------------------------------------------------
|
||||
const ArchSpec&
|
||||
operator= (const ArchSpec& rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get a string representation of the contained architecture.
|
||||
/// Returns a static string representing the current architecture.
|
||||
///
|
||||
/// Gets a C string representation of the current architecture.
|
||||
/// If the returned string is a valid architecture name, the string
|
||||
/// came from a constant string values that do not need to be freed.
|
||||
/// If the returned string uses the "N.M" format, the string comes
|
||||
/// from a static buffer that should be copied.
|
||||
///
|
||||
/// @return a NULL terminated C string that does not need to be
|
||||
/// freed.
|
||||
/// @return A static string correcponding to the current
|
||||
/// architecture.
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
AsCString () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a string representation of the supplied architecture.
|
||||
///
|
||||
/// Class function to get a C string representation given a CPU type
|
||||
/// and subtype.
|
||||
///
|
||||
/// @param[in] cpu The cpu type of the architecture.
|
||||
/// @param[in] subtype The cpu subtype of the architecture.
|
||||
///
|
||||
/// @return a NULL terminated C string that does not need to be
|
||||
/// freed.
|
||||
//------------------------------------------------------------------
|
||||
static const char *
|
||||
AsCString (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t subtype);
|
||||
GetArchitectureName () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Clears the object state.
|
||||
|
@ -144,107 +164,33 @@ public:
|
|||
uint32_t
|
||||
GetAddressByteSize () const;
|
||||
|
||||
void
|
||||
SetAddressByteSize (uint32_t byte_size)
|
||||
{
|
||||
m_addr_byte_size = byte_size;
|
||||
}
|
||||
|
||||
CPU
|
||||
GetGenericCPUType () const;
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a machine family for the current architecture.
|
||||
///
|
||||
/// @return An LLVM arch type.
|
||||
//------------------------------------------------------------------
|
||||
llvm::Triple::ArchType
|
||||
GetMachine () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// CPU subtype get accessor.
|
||||
/// Tests if this ArchSpec is valid.
|
||||
///
|
||||
/// @return The current value of the CPU subtype.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetCPUSubtype () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// CPU type get accessor.
|
||||
///
|
||||
/// @return The current value of the CPU type.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetCPUType () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Feature flags get accessor.
|
||||
///
|
||||
/// @return The current value of the CPU feature flags.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetFeatureFlags () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get register names of the current architecture.
|
||||
///
|
||||
/// Get register names of the current architecture given
|
||||
/// a register number, and a flavor for that register number.
|
||||
/// There are many different register numbering schemes used
|
||||
/// on a host:
|
||||
/// @li \c eRegisterKindGCC - gcc compiler register numbering
|
||||
/// @li \c eRegisterKindDWARF - DWARF register numbering
|
||||
///
|
||||
/// @param[in] reg_num The register number to decode.
|
||||
/// @param[in] flavor The flavor of the \a reg_num.
|
||||
///
|
||||
/// @return the name of the register as a NULL terminated C string,
|
||||
/// or /c NULL if the \a reg_num is invalid for \a flavor.
|
||||
/// String values that are returned do not need to be freed.
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
GetRegisterName (uint32_t reg_num, uint32_t flavor) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get register names for a specified architecture.
|
||||
///
|
||||
/// Get register names of the specified architecture given
|
||||
/// a register number, and a flavor for that register number.
|
||||
/// There are many different register numbering schemes used
|
||||
/// on a host:
|
||||
///
|
||||
/// @li compiler register numbers (@see eRegisterKindGCC)
|
||||
/// @li DWARF register numbers (@see eRegisterKindDWARF)
|
||||
///
|
||||
/// @param[in] cpu The cpu type of the architecture specific
|
||||
/// register
|
||||
/// @param[in] subtype The cpu subtype of the architecture specific
|
||||
/// register
|
||||
/// @param[in] reg_num The register number to decode.
|
||||
/// @param[in] flavor The flavor of the \a reg_num.
|
||||
///
|
||||
/// @return the name of the register as a NULL terminated C string,
|
||||
/// or /c NULL if the \a reg_num is invalid for \a flavor.
|
||||
/// String values that are returned do not need to be freed.
|
||||
//------------------------------------------------------------------
|
||||
static const char *
|
||||
GetRegisterName (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t subtype, uint32_t reg_num, uint32_t flavor);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Test if the contained architecture is valid.
|
||||
///
|
||||
/// @return true if the current architecture is valid, false
|
||||
/// @return True if the current architecture is valid, false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsValid () const;
|
||||
IsValid () const
|
||||
{
|
||||
return m_core >= eCore_alpha_generic && m_core < kNumCores;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the memory cost of this object.
|
||||
/// Sets this ArchSpec according to the given architecture name.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that this object occupies in memory.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemorySize() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Change the CPU type and subtype given an architecture name.
|
||||
/// The architecture name can be one of the generic system default
|
||||
/// values:
|
||||
///
|
||||
/// The architecture name supplied can also by one of the generic
|
||||
/// system default values:
|
||||
/// @li \c LLDB_ARCH_DEFAULT - The arch the current system defaults
|
||||
/// to when a program is launched without any extra
|
||||
/// attributes or settings.
|
||||
|
@ -253,25 +199,43 @@ public:
|
|||
/// @li \c LLDB_ARCH_DEFAULT_64BIT - The default host architecture
|
||||
/// for 64 bit (if any).
|
||||
///
|
||||
/// Alternatively, if the object type of this ArchSpec has been
|
||||
/// configured, a concrete architecture can be specified to set
|
||||
/// the CPU type ("x86_64" for example).
|
||||
///
|
||||
/// Finally, an encoded object and archetecture format is accepted.
|
||||
/// The format contains an object type (like "macho" or "elf"),
|
||||
/// followed by a platform dependent encoding of CPU type and
|
||||
/// subtype. For example:
|
||||
///
|
||||
/// "macho" : Specifies an object type of MachO.
|
||||
/// "macho-16-6" : MachO specific encoding for ARMv6.
|
||||
/// "elf-43 : ELF specific encoding for Sparc V9.
|
||||
///
|
||||
/// @param[in] arch_name The name of an architecture.
|
||||
///
|
||||
/// @return true if \a arch_name was successfully transformed into
|
||||
/// a valid cpu type and subtype.
|
||||
/// @return True if @p arch_name was successfully translated, false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
SetArch (const char *arch_name);
|
||||
|
||||
bool
|
||||
SetArchFromTargetTriple (const char *arch_name);
|
||||
// bool
|
||||
// SetArchitecture (const llvm::StringRef& arch_name);
|
||||
//
|
||||
// bool
|
||||
// SetArchitecture (const char *arch_name);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Change the CPU type and subtype given new values of the cpu
|
||||
/// type and subtype.
|
||||
/// Change the architecture object type and CPU type.
|
||||
///
|
||||
/// @param[in] cpu The new CPU type
|
||||
/// @param[in] subtype The new CPU subtype
|
||||
/// @param[in] arch_type The object type of this ArchSpec.
|
||||
///
|
||||
/// @param[in] cpu The required CPU type.
|
||||
///
|
||||
/// @return True if the object and CPU type were sucessfully set.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetMachOArch (uint32_t cpu, uint32_t sub);
|
||||
bool
|
||||
SetArchitecture (lldb::ArchitectureType arch_type,
|
||||
uint32_t cpu,
|
||||
uint32_t sub);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the byte order for the architecture specification.
|
||||
|
@ -280,78 +244,88 @@ public:
|
|||
/// the architecture specification
|
||||
//------------------------------------------------------------------
|
||||
lldb::ByteOrder
|
||||
GetByteOrder () const
|
||||
{
|
||||
return m_byte_order;
|
||||
}
|
||||
GetByteOrder () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets this ArchSpec's byte order.
|
||||
///
|
||||
/// In the common case there is no need to call this method as the
|
||||
/// byte order can almost always be determined by the architecture.
|
||||
/// However, many CPU's are bi-endian (ARM, Alpha, PowerPC, etc)
|
||||
/// and the default/assumed byte order may be incorrect.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetByteOrder (lldb::ByteOrder b)
|
||||
SetByteOrder (lldb::ByteOrder byteorder);
|
||||
|
||||
Core
|
||||
GetCore () const
|
||||
{
|
||||
m_byte_order = b;
|
||||
return m_core;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetMachOCPUType () const;
|
||||
|
||||
uint32_t
|
||||
GetMachOCPUSubType () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Architecture tripple accessor.
|
||||
///
|
||||
/// @return A triple describing this ArchSpec.
|
||||
//------------------------------------------------------------------
|
||||
llvm::Triple &
|
||||
GetTriple ()
|
||||
{
|
||||
return m_triple;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Architecture tripple accessor.
|
||||
///
|
||||
/// @return A triple describing this ArchSpec.
|
||||
//------------------------------------------------------------------
|
||||
const llvm::Triple &
|
||||
GetTriple () const
|
||||
{
|
||||
return m_triple;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Architecture tripple setter.
|
||||
///
|
||||
/// Configures this ArchSpec according to the given triple. At a
|
||||
/// minimum, the given triple must describe a valid operating
|
||||
/// system. If archetecture or environment components are present
|
||||
/// they too will be used to further resolve the CPU type and
|
||||
/// subtype, endian characteristics, etc.
|
||||
///
|
||||
/// @return A triple describing this ArchSpec.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
SetTriple (const llvm::Triple &triple);
|
||||
|
||||
bool
|
||||
SetTriple (const char *triple_cstr);
|
||||
|
||||
void
|
||||
SetTriple (const llvm::Triple &triple)
|
||||
{
|
||||
m_triple = triple;
|
||||
}
|
||||
|
||||
void
|
||||
SetElfArch (uint32_t cpu, uint32_t sub)
|
||||
{
|
||||
m_type = lldb::eArchTypeELF;
|
||||
m_cpu = cpu;
|
||||
m_sub = sub;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the default endianness of the architecture.
|
||||
///
|
||||
/// @return The endian enumeration for the default endianness of
|
||||
/// the architecture.
|
||||
/// the architecture.
|
||||
//------------------------------------------------------------------
|
||||
lldb::ByteOrder
|
||||
GetDefaultEndian () const;
|
||||
|
||||
|
||||
lldb::ArchitectureType
|
||||
GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member variables
|
||||
//------------------------------------------------------------------
|
||||
lldb::ArchitectureType m_type;
|
||||
// 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;
|
||||
Core m_core;
|
||||
lldb::ByteOrder m_byte_order;
|
||||
uint32_t m_addr_byte_size;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// Called when m_def or m_entry are changed. Fills in all remaining
|
||||
// members with default values.
|
||||
void
|
||||
MachOArchUpdated (size_t macho_idx = ~(size_t)0);
|
||||
|
||||
void
|
||||
ELFArchUpdated (size_t idx = ~(size_t)0);
|
||||
CoreUpdated (bool update_triple);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ public:
|
|||
GetDefaultArchitecture ();
|
||||
|
||||
static void
|
||||
SetDefaultArchitecture (ArchSpec new_arch);
|
||||
SetDefaultArchitecture (const ArchSpec &arch);
|
||||
|
||||
void
|
||||
UpdateInstanceName ();
|
||||
|
@ -534,6 +534,11 @@ public:
|
|||
static SettingEntry global_settings_table[];
|
||||
static SettingEntry instance_settings_table[];
|
||||
|
||||
ArchSpec &
|
||||
GetArchitecture ()
|
||||
{
|
||||
return m_default_architecture;
|
||||
}
|
||||
protected:
|
||||
|
||||
lldb::InstanceSettingsSP
|
||||
|
|
|
@ -72,11 +72,11 @@
|
|||
</EnvironmentVariables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
displayScaleIsEnabled = "NO"
|
||||
displayScale = "1.00"
|
||||
launchStyle = "1"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug">
|
||||
<BuildableProductRunnable>
|
||||
|
@ -88,6 +88,20 @@
|
|||
ReferencedContainer = "container:lldb.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "/Volumes/work/gclayton/Documents/src/attach/a.out"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "/Volumes/work/gclayton/Documents/src/lldb/test/abbreviation_tests/a.out"
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "/Volumes/work/gclayton/Documents/src/lldb/test/alias_tests/a.out"
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "LLDB_LAUNCH_FLAG_DISABLE_ASLR"
|
||||
|
|
|
@ -341,7 +341,7 @@ SBDebugger::GetDefaultArchitecture (char *arch_name, size_t arch_name_len)
|
|||
|
||||
if (default_arch.IsValid())
|
||||
{
|
||||
::snprintf (arch_name, arch_name_len, "%s", default_arch.AsCString());
|
||||
::snprintf (arch_name, arch_name_len, "%s", default_arch.GetArchitectureName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
|
|||
{
|
||||
ArchSpec arch;
|
||||
FileSpec file_spec (filename, true);
|
||||
arch.SetArchFromTargetTriple(target_triple);
|
||||
arch.SetTriple (target_triple);
|
||||
TargetSP target_sp;
|
||||
Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp));
|
||||
target.reset (target_sp);
|
||||
|
@ -440,7 +440,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
|
|||
}
|
||||
|
||||
SBTarget
|
||||
SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname)
|
||||
SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *arch_cstr)
|
||||
{
|
||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
||||
|
@ -448,31 +448,28 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn
|
|||
if (m_opaque_sp)
|
||||
{
|
||||
FileSpec file (filename, true);
|
||||
ArchSpec arch = lldb_private::Target::GetDefaultArchitecture ();
|
||||
ArchSpec arch;
|
||||
TargetSP target_sp;
|
||||
Error error;
|
||||
|
||||
if (archname != NULL)
|
||||
{
|
||||
ArchSpec arch2 (archname);
|
||||
error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch2, NULL, true, target_sp);
|
||||
}
|
||||
if (arch_cstr)
|
||||
arch.SetTriple (arch_cstr);
|
||||
else
|
||||
arch = lldb_private::Target::GetDefaultArchitecture ();
|
||||
|
||||
if (!arch.IsValid())
|
||||
arch.SetTriple (LLDB_ARCH_DEFAULT);
|
||||
|
||||
error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
|
||||
|
||||
if (error.Fail())
|
||||
{
|
||||
if (!arch.IsValid())
|
||||
arch = LLDB_ARCH_DEFAULT;
|
||||
if (strcmp (LLDB_ARCH_DEFAULT, LLDB_ARCH_DEFAULT_32BIT) == 0)
|
||||
arch.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
|
||||
else
|
||||
arch.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
|
||||
|
||||
error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
|
||||
|
||||
if (error.Fail())
|
||||
{
|
||||
if (arch == LLDB_ARCH_DEFAULT_32BIT)
|
||||
arch = LLDB_ARCH_DEFAULT_64BIT;
|
||||
else
|
||||
arch = LLDB_ARCH_DEFAULT_32BIT;
|
||||
|
||||
error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
|
||||
}
|
||||
}
|
||||
|
||||
if (error.Success())
|
||||
|
@ -485,7 +482,7 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn
|
|||
if (log)
|
||||
{
|
||||
log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)",
|
||||
m_opaque_sp.get(), filename, archname, target.get());
|
||||
m_opaque_sp.get(), filename, arch_cstr, target.get());
|
||||
}
|
||||
|
||||
return target;
|
||||
|
@ -503,16 +500,16 @@ SBDebugger::CreateTarget (const char *filename)
|
|||
Error error;
|
||||
|
||||
if (!arch.IsValid())
|
||||
arch = LLDB_ARCH_DEFAULT;
|
||||
arch.SetTriple (LLDB_ARCH_DEFAULT);
|
||||
|
||||
error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
|
||||
|
||||
if (error.Fail())
|
||||
{
|
||||
if (arch == LLDB_ARCH_DEFAULT_32BIT)
|
||||
arch = LLDB_ARCH_DEFAULT_64BIT;
|
||||
if (strcmp (LLDB_ARCH_DEFAULT, LLDB_ARCH_DEFAULT_32BIT) == 0)
|
||||
arch.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
|
||||
else
|
||||
arch = LLDB_ARCH_DEFAULT_32BIT;
|
||||
arch.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
|
||||
|
||||
error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
|
||||
}
|
||||
|
@ -563,9 +560,7 @@ SBDebugger::FindTargetWithFileAndArch (const char *filename, const char *arch_na
|
|||
if (m_opaque_sp && filename && filename[0])
|
||||
{
|
||||
// No need to lock, the target list is thread safe
|
||||
ArchSpec arch;
|
||||
if (arch_name)
|
||||
arch.SetArch(arch_name);
|
||||
ArchSpec arch (arch_name);
|
||||
TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename, false), arch_name ? &arch : NULL));
|
||||
sb_target.reset(target_sp);
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ CommandObjectDisassemble::Execute
|
|||
|
||||
if (disassembler == NULL)
|
||||
{
|
||||
result.AppendErrorWithFormat ("Unable to find Disassembler plug-in for %s architecture.\n", arch.AsCString());
|
||||
result.AppendErrorWithFormat ("Unable to find Disassembler plug-in for %s architecture.\n", arch.GetArchitectureName());
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ CommandObjectFile::Execute
|
|||
if (target_sp)
|
||||
{
|
||||
debugger.GetTargetList().SetSelectedTarget(target_sp.get());
|
||||
result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, target_sp->GetArchitecture().AsCString());
|
||||
result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, target_sp->GetArchitecture().GetArchitectureName());
|
||||
result.SetStatus (eReturnStatusSuccessFinishNoResult);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -42,9 +42,9 @@ DumpModuleArchitecture (Stream &strm, Module *module, uint32_t width)
|
|||
if (module)
|
||||
{
|
||||
if (width)
|
||||
strm.Printf("%-*s", width, module->GetArchitecture().AsCString());
|
||||
strm.Printf("%-*s", width, module->GetArchitecture().GetArchitectureName());
|
||||
else
|
||||
strm.PutCString(module->GetArchitecture().AsCString());
|
||||
strm.PutCString(module->GetArchitecture().GetArchitectureName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ DumpModuleSections (CommandInterpreter &interpreter, Stream &strm, Module *modul
|
|||
{
|
||||
strm.PutCString ("Sections for '");
|
||||
strm << module->GetFileSpec();
|
||||
strm.Printf ("' (%s):\n", module->GetArchitecture().AsCString());
|
||||
strm.Printf ("' (%s):\n", module->GetArchitecture().GetArchitectureName());
|
||||
strm.IndentMore();
|
||||
section_list->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().target, true, UINT32_MAX);
|
||||
strm.IndentLess();
|
||||
|
|
|
@ -310,7 +310,7 @@ public:
|
|||
|
||||
if (error.Success())
|
||||
{
|
||||
const char *archname = exe_module->GetArchitecture().AsCString();
|
||||
const char *archname = exe_module->GetArchitecture().GetArchitectureName();
|
||||
|
||||
result.AppendMessageWithFormat ("Process %i launched: '%s' (%s)\n", process->GetID(), filename, archname);
|
||||
result.SetDidChangeProcessState (true);
|
||||
|
@ -328,7 +328,7 @@ public:
|
|||
if (synchronous_execution)
|
||||
{
|
||||
state = process->WaitForProcessToStop (NULL);
|
||||
if (!StateIsStoppedState(state));
|
||||
if (!StateIsStoppedState(state))
|
||||
{
|
||||
result.AppendErrorWithFormat ("Process isn't stopped: %s", StateAsCString(state));
|
||||
}
|
||||
|
@ -777,12 +777,12 @@ public:
|
|||
|
||||
if (!old_arch_spec.IsValid())
|
||||
{
|
||||
result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().AsCString());
|
||||
result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().GetArchitectureName());
|
||||
}
|
||||
else if (old_arch_spec != target->GetArchitecture())
|
||||
{
|
||||
result.AppendWarningWithFormat("Architecture changed from %s to %s.\n",
|
||||
old_arch_spec.AsCString(), target->GetArchitecture().AsCString());
|
||||
old_arch_spec.GetArchitectureName(), target->GetArchitecture().GetArchitectureName());
|
||||
}
|
||||
}
|
||||
return result.Succeeded();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -877,7 +877,7 @@ Debugger::FormatPrompt
|
|||
ArchSpec arch (target->GetArchitecture ());
|
||||
if (arch.IsValid())
|
||||
{
|
||||
s.PutCString (arch.AsCString());
|
||||
s.PutCString (arch.GetArchitectureName());
|
||||
var_success = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ Disassembler::FindPlugin (const ArchSpec &arch)
|
|||
{
|
||||
Timer scoped_timer (__PRETTY_FUNCTION__,
|
||||
"Disassembler::FindPlugin (arch = %s)",
|
||||
arch.AsCString());
|
||||
arch.GetArchitectureName());
|
||||
|
||||
std::auto_ptr<Disassembler> disassembler_ap;
|
||||
DisassemblerCreateInstance create_callback;
|
||||
|
|
|
@ -87,13 +87,10 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args)
|
|||
{
|
||||
static uint32_t g_sequence_id = 0;
|
||||
StreamString header;
|
||||
static Mutex g_LogThreadedMutex(Mutex::eMutexTypeRecursive);
|
||||
|
||||
Mutex::Locker locker;
|
||||
|
||||
// Lock the threaded logging mutex if we are doing thread safe logging
|
||||
if (m_options.Test (LLDB_LOG_OPTION_THREADSAFE))
|
||||
locker.Reset(g_LogThreadedMutex.GetMutex());
|
||||
// Enabling the thread safe logging actually deadlocks right now.
|
||||
// Need to fix this at some point.
|
||||
// static Mutex g_LogThreadedMutex(Mutex::eMutexTypeRecursive);
|
||||
// Mutex::Locker locker (g_LogThreadedMutex);
|
||||
|
||||
// Add a sequence ID if requested
|
||||
if (m_options.Test (LLDB_LOG_OPTION_PREPEND_SEQUENCE))
|
||||
|
|
|
@ -42,7 +42,7 @@ Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstStrin
|
|||
if (log)
|
||||
log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')",
|
||||
this,
|
||||
m_arch.AsCString(),
|
||||
m_arch.GetArchitectureName(),
|
||||
m_file.GetDirectory().AsCString(""),
|
||||
m_file.GetFilename().AsCString(""),
|
||||
m_object_name.IsEmpty() ? "" : "(",
|
||||
|
@ -56,7 +56,7 @@ Module::~Module()
|
|||
if (log)
|
||||
log->Printf ("%p Module::~Module((%s) '%s/%s%s%s%s')",
|
||||
this,
|
||||
m_arch.AsCString(),
|
||||
m_arch.GetArchitectureName(),
|
||||
m_file.GetDirectory().AsCString(""),
|
||||
m_file.GetFilename().AsCString(""),
|
||||
m_object_name.IsEmpty() ? "" : "(",
|
||||
|
@ -474,7 +474,7 @@ Module::GetDescription (Stream *s)
|
|||
Mutex::Locker locker (m_mutex);
|
||||
|
||||
if (m_arch.IsValid())
|
||||
s->Printf("(%s) ", m_arch.AsCString());
|
||||
s->Printf("(%s) ", m_arch.GetArchitectureName());
|
||||
|
||||
char path[PATH_MAX];
|
||||
if (m_file.GetPath(path, sizeof(path)))
|
||||
|
@ -648,17 +648,11 @@ Module::IsExecutable ()
|
|||
bool
|
||||
Module::SetArchitecture (const ArchSpec &new_arch)
|
||||
{
|
||||
if (m_arch == new_arch)
|
||||
return true;
|
||||
else if (!m_arch.IsValid())
|
||||
if (!m_arch.IsValid())
|
||||
{
|
||||
m_arch = new_arch;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return m_arch == new_arch;
|
||||
}
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ ModuleList::LogUUIDAndPaths (LogSP &log_sp, const char *prefix_cstr)
|
|||
prefix_cstr ? prefix_cstr : "",
|
||||
(uint32_t)std::distance (begin, pos),
|
||||
uuid_cstr,
|
||||
module->GetArchitecture().AsCString(),
|
||||
module->GetArchitecture().GetArchitectureName(),
|
||||
module_file_spec.GetDirectory().GetCString(),
|
||||
module_file_spec.GetFilename().GetCString());
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ ModuleList::GetModuleSP (const Module *module_ptr)
|
|||
const FileSpec &module_file_spec = module_ptr->GetFileSpec();
|
||||
fprintf (stderr, "warning: module not in shared module list: %s (%s) \"%s/%s\"\n",
|
||||
uuid_cstr,
|
||||
module_ptr->GetArchitecture().AsCString(),
|
||||
module_ptr->GetArchitecture().GetArchitectureName(),
|
||||
module_file_spec.GetDirectory().GetCString(),
|
||||
module_file_spec.GetFilename().GetCString());
|
||||
}
|
||||
|
@ -650,9 +650,9 @@ ModuleList::GetSharedModule
|
|||
if (arch.IsValid())
|
||||
{
|
||||
if (uuid_cstr[0])
|
||||
error.SetErrorStringWithFormat("'%s' does not contain the %s architecture and UUID %s.\n", path, arch.AsCString(), uuid_cstr[0]);
|
||||
error.SetErrorStringWithFormat("'%s' does not contain the %s architecture and UUID %s.\n", path, arch.GetArchitectureName(), uuid_cstr[0]);
|
||||
else
|
||||
error.SetErrorStringWithFormat("'%s' does not contain the %s architecture.\n", path, arch.AsCString());
|
||||
error.SetErrorStringWithFormat("'%s' does not contain the %s architecture.\n", path, arch.GetArchitectureName());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -707,7 +707,7 @@ ModuleList::GetSharedModule
|
|||
if (file_spec)
|
||||
{
|
||||
if (arch.IsValid())
|
||||
error.SetErrorStringWithFormat("Unable to open %s architecture in '%s'.\n", arch.AsCString(), path);
|
||||
error.SetErrorStringWithFormat("Unable to open %s architecture in '%s'.\n", arch.GetArchitectureName(), path);
|
||||
else
|
||||
error.SetErrorStringWithFormat("Unable to open '%s'.\n", path);
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ ModuleList::GetSharedModule
|
|||
if (uuid_cstr[0])
|
||||
error.SetErrorStringWithFormat("Cannot locate a module for UUID '%s'.\n", uuid_cstr[0]);
|
||||
else
|
||||
error.SetErrorStringWithFormat("Cannot locate a module.\n", path, arch.AsCString());
|
||||
error.SetErrorStringWithFormat("Cannot locate a module.\n", path, arch.GetArchitectureName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -714,7 +714,7 @@ ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &ex
|
|||
if (disassembler == NULL)
|
||||
{
|
||||
ret.SetErrorToGenericError();
|
||||
ret.SetErrorStringWithFormat("Unable to find disassembler plug-in for %s architecture.", arch.AsCString());
|
||||
ret.SetErrorStringWithFormat("Unable to find disassembler plug-in for %s architecture.", arch.GetArchitectureName());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,20 +268,20 @@ Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
|
|||
if (cputype & CPU_ARCH_ABI64)
|
||||
{
|
||||
// We have a 64 bit kernel on a 64 bit system
|
||||
g_host_arch_32.SetMachOArch (~(CPU_ARCH_MASK) & cputype, cpusubtype);
|
||||
g_host_arch_64.SetMachOArch (cputype, cpusubtype);
|
||||
g_host_arch_32.SetArchitecture (lldb::eArchTypeMachO, ~(CPU_ARCH_MASK) & cputype, cpusubtype);
|
||||
g_host_arch_64.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have a 32 bit kernel on a 64 bit system
|
||||
g_host_arch_32.SetMachOArch (cputype, cpusubtype);
|
||||
g_host_arch_32.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
|
||||
cputype |= CPU_ARCH_ABI64;
|
||||
g_host_arch_64.SetMachOArch (cputype, cpusubtype);
|
||||
g_host_arch_64.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_host_arch_32.SetMachOArch (cputype, cpusubtype);
|
||||
g_host_arch_32.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
|
||||
g_host_arch_64.Clear();
|
||||
}
|
||||
}
|
||||
|
@ -293,23 +293,23 @@ Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
|
|||
{
|
||||
#if defined (__x86_64__)
|
||||
|
||||
g_host_arch_64.SetArch ("x86_64");
|
||||
g_host_arch_64.SetTriple ("x86_64");
|
||||
|
||||
#elif defined (__i386__)
|
||||
|
||||
g_host_arch_32.SetArch ("i386");
|
||||
g_host_arch_32.SetTriple ("i386");
|
||||
|
||||
#elif defined (__arm__)
|
||||
|
||||
g_host_arch_32.SetArch ("arm");
|
||||
g_host_arch_32.SetTriple ("arm");
|
||||
|
||||
#elif defined (__ppc64__)
|
||||
|
||||
g_host_arch_64.SetArch ("ppc64");
|
||||
g_host_arch_64.SetTriple ("ppc64");
|
||||
|
||||
#elif defined (__powerpc__) || defined (__ppc__)
|
||||
|
||||
g_host_arch_32.SetArch ("ppc");
|
||||
g_host_arch_32.SetTriple ("ppc");
|
||||
|
||||
#else
|
||||
|
||||
|
@ -377,7 +377,7 @@ Host::GetTargetTriple()
|
|||
{
|
||||
StreamString triple;
|
||||
triple.Printf("%s-%s-%s",
|
||||
GetArchitecture().AsCString(),
|
||||
GetArchitecture().GetArchitectureName(),
|
||||
GetVendorString().AsCString(),
|
||||
GetOSString().AsCString());
|
||||
|
||||
|
@ -1093,9 +1093,9 @@ Host::GetArchSpecForExistingProcess (lldb::pid_t pid)
|
|||
if (error == 0)
|
||||
return return_spec;
|
||||
if (bsd_info.pbi_flags & PROC_FLAG_LP64)
|
||||
return_spec.SetArch(LLDB_ARCH_DEFAULT_64BIT);
|
||||
return_spec.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
|
||||
else
|
||||
return_spec.SetArch(LLDB_ARCH_DEFAULT_32BIT);
|
||||
return_spec.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
|
||||
#endif
|
||||
|
||||
return return_spec;
|
||||
|
|
|
@ -279,7 +279,7 @@ LaunchInNewTerminalWithCommandFile
|
|||
|
||||
if (arch_spec && arch_spec->IsValid())
|
||||
{
|
||||
command_file.Printf("--arch=%s ", arch_spec->AsCString());
|
||||
command_file.Printf("--arch=%s ", arch_spec->GetArchitectureName());
|
||||
}
|
||||
|
||||
if (disable_aslr)
|
||||
|
@ -441,12 +441,12 @@ LaunchInNewTerminalWithAppleScript
|
|||
darwin_debug_file_spec.GetPath(launcher_path, sizeof(launcher_path));
|
||||
|
||||
if (arch_spec)
|
||||
command.Printf("arch -arch %s ", arch_spec->AsCString());
|
||||
command.Printf("arch -arch %s ", arch_spec->GetArchitectureName());
|
||||
|
||||
command.Printf("'%s' --unix-socket=%s", launcher_path, unix_socket_name.c_str());
|
||||
|
||||
if (arch_spec && arch_spec->IsValid())
|
||||
command.Printf(" --arch=%s", arch_spec->AsCString());
|
||||
command.Printf(" --arch=%s", arch_spec->GetArchitectureName());
|
||||
|
||||
if (working_dir)
|
||||
command.Printf(" --working-dir '%s'", working_dir);
|
||||
|
|
|
@ -433,7 +433,7 @@ Symbols::LocateExecutableObjectFile (const FileSpec *exec_fspec, const ArchSpec*
|
|||
Timer scoped_timer (__PRETTY_FUNCTION__,
|
||||
"LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
|
||||
exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
|
||||
arch ? arch->AsCString() : "<NULL>",
|
||||
arch ? arch->GetArchitectureName() : "<NULL>",
|
||||
uuid);
|
||||
|
||||
FileSpec objfile_fspec;
|
||||
|
@ -450,7 +450,7 @@ Symbols::LocateExecutableSymbolFile (const FileSpec *exec_fspec, const ArchSpec*
|
|||
Timer scoped_timer (__PRETTY_FUNCTION__,
|
||||
"LocateExecutableSymbolFile (file = %s, arch = %s, uuid = %p)",
|
||||
exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
|
||||
arch ? arch->AsCString() : "<NULL>",
|
||||
arch ? arch->GetArchitectureName() : "<NULL>",
|
||||
uuid);
|
||||
|
||||
FileSpec symbol_fspec;
|
||||
|
|
|
@ -345,16 +345,12 @@ DisassemblerLLVM::InstructionLLVM::Extract(const DataExtractor &data, uint32_t d
|
|||
static inline EDAssemblySyntax_t
|
||||
SyntaxForArchSpec (const ArchSpec &arch)
|
||||
{
|
||||
switch (arch.GetGenericCPUType())
|
||||
switch (arch.GetMachine ())
|
||||
{
|
||||
case ArchSpec::eCPU_i386:
|
||||
case ArchSpec::eCPU_x86_64:
|
||||
case llvm::Triple::x86:
|
||||
case llvm::Triple::x86_64:
|
||||
return kEDAssemblySyntaxX86ATT;
|
||||
|
||||
case ArchSpec::eCPU_arm:
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case ArchSpec::eCPU_sparc:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -6814,7 +6814,7 @@ bool
|
|||
EmulateInstructionARM::SetArchitecture (const ArchSpec &arch)
|
||||
{
|
||||
m_arm_isa = 0;
|
||||
const char *arch_cstr = arch.AsCString ();
|
||||
const char *arch_cstr = arch.GetArchitectureName ();
|
||||
if (arch_cstr)
|
||||
{
|
||||
if (0 == ::strcasecmp(arch_cstr, "armv4t")) m_arm_isa = ARMv4T;
|
||||
|
|
|
@ -360,7 +360,7 @@ ObjectContainerBSDArchive::Dump (Stream *s) const
|
|||
{
|
||||
s->Indent();
|
||||
GetArchitectureAtIndex(i, arch);
|
||||
s->Printf("arch[%u] = %s\n", arch.AsCString());
|
||||
s->Printf("arch[%u] = %s\n", arch.GetArchitectureName());
|
||||
}
|
||||
for (i=0; i<num_objects; i++)
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ ObjectContainerUniversalMachO::Dump (Stream *s) const
|
|||
{
|
||||
s->Indent();
|
||||
GetArchitectureAtIndex(i, arch);
|
||||
s->Printf("arch[%u] = %s\n", arch.AsCString());
|
||||
s->Printf("arch[%u] = %s\n", arch.GetArchitectureName());
|
||||
}
|
||||
for (i=0; i<num_objects; i++)
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ ObjectContainerUniversalMachO::GetArchitectureAtIndex (uint32_t idx, ArchSpec& a
|
|||
{
|
||||
if (idx < m_header.nfat_arch)
|
||||
{
|
||||
arch.SetMachOArch (m_fat_archs[idx].cputype, m_fat_archs[idx].cpusubtype);
|
||||
arch.SetArchitecture (lldb::eArchTypeMachO, m_fat_archs[idx].cputype, m_fat_archs[idx].cpusubtype);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -207,7 +207,7 @@ ObjectContainerUniversalMachO::GetObjectFile (const FileSpec *file)
|
|||
{
|
||||
arch = Target::GetDefaultArchitecture ();
|
||||
if (!arch.IsValid())
|
||||
arch = LLDB_ARCH_DEFAULT;
|
||||
arch.SetTriple (LLDB_ARCH_DEFAULT);
|
||||
}
|
||||
else
|
||||
arch = m_module->GetArchitecture();
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "lldb/Core/PluginManager.h"
|
||||
#include "lldb/Core/Section.h"
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
|
||||
#define CASE_AND_STREAM(s, def, width) \
|
||||
case def: s->Printf("%-*s", width, #def); break;
|
||||
|
@ -1045,28 +1046,9 @@ ObjectFileELF::DumpDependentModules(lldb_private::Stream *s)
|
|||
bool
|
||||
ObjectFileELF::GetArchitecture (ArchSpec &arch)
|
||||
{
|
||||
switch (m_header.e_machine)
|
||||
{
|
||||
default:
|
||||
assert(false && "Unexpected machine type.");
|
||||
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
|
||||
arch.GetTriple().setOSName ("linux");
|
||||
// TODO: determine if there is an OS in the ELF? Default to "gnu" for now
|
||||
arch.GetTriple().setVendorName("gnu");
|
||||
|
||||
arch.SetElfArch(m_header.e_machine, m_header.e_flags);
|
||||
arch.SetArchitecture (lldb::eArchTypeELF, m_header.e_machine, m_header.e_flags);
|
||||
arch.GetTriple().setOSName (Host::GetOSString().GetCString());
|
||||
arch.GetTriple().setVendorName(Host::GetVendorString().GetCString());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1351,7 +1351,7 @@ ObjectFileMachO::Dump (Stream *s)
|
|||
|
||||
ArchSpec header_arch(eArchTypeMachO, m_header.cputype, m_header.cpusubtype);
|
||||
|
||||
*s << ", file = '" << m_file << "', arch = " << header_arch.AsCString() << "\n";
|
||||
*s << ", file = '" << m_file << "', arch = " << header_arch.GetArchitectureName() << "\n";
|
||||
|
||||
if (m_sections_ap.get())
|
||||
m_sections_ap->Dump(s, NULL, true, UINT32_MAX);
|
||||
|
@ -1439,7 +1439,7 @@ bool
|
|||
ObjectFileMachO::GetArchitecture (ArchSpec &arch)
|
||||
{
|
||||
lldb_private::Mutex::Locker locker(m_mutex);
|
||||
arch.SetMachOArch(m_header.cputype, m_header.cpusubtype);
|
||||
arch.SetArchitecture (lldb::eArchTypeMachO, m_header.cputype, m_header.cpusubtype);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,11 @@ MachThreadContext_i386::Create (const ArchSpec &arch_spec, ThreadMacOSX &thread)
|
|||
void
|
||||
MachThreadContext_i386::Initialize()
|
||||
{
|
||||
ArchSpec arch_spec("i386");
|
||||
llvm::Triple triple;
|
||||
triple.setArch (llvm::Triple::x86);
|
||||
triple.setVendor (llvm::Triple::Apple);
|
||||
triple.setOS (llvm::Triple::Darwin);
|
||||
ArchSpec arch_spec (triple);
|
||||
ProcessMacOSX::AddArchCreateCallback(arch_spec, MachThreadContext_i386::Create);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
||||
#include "lldb/Symbol/Function.h"
|
||||
#include "lldb/Symbol/Symbol.h"
|
||||
|
||||
|
@ -41,7 +43,11 @@ MachThreadContext_x86_64::Create(const ArchSpec &arch_spec, ThreadMacOSX &thread
|
|||
void
|
||||
MachThreadContext_x86_64::Initialize()
|
||||
{
|
||||
ArchSpec arch_spec("x86_64");
|
||||
llvm::Triple triple;
|
||||
triple.setArch (llvm::Triple::x86_64);
|
||||
triple.setVendor (llvm::Triple::Apple);
|
||||
triple.setOS (llvm::Triple::Darwin);
|
||||
ArchSpec arch_spec (triple);
|
||||
ProcessMacOSX::AddArchCreateCallback(arch_spec, MachThreadContext_x86_64::Create);
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,9 @@ ProcessMacOSX::DoLaunch
|
|||
// Set our user ID to an invalid process ID.
|
||||
SetID (LLDB_INVALID_PROCESS_ID);
|
||||
error.SetErrorToGenericError ();
|
||||
error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n", module->GetFileSpec().GetFilename().AsCString(), module->GetArchitecture().AsCString());
|
||||
error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n",
|
||||
module->GetFileSpec().GetFilename().AsCString(),
|
||||
module->GetArchitecture().GetArchitectureName());
|
||||
}
|
||||
|
||||
// Return the process ID we have
|
||||
|
@ -498,16 +500,16 @@ ProcessMacOSX::GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site)
|
|||
static const uint8_t g_ppc_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 };
|
||||
static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
|
||||
|
||||
ArchSpec::CPU arch_cpu = m_arch_spec.GetGenericCPUType();
|
||||
switch (arch_cpu)
|
||||
llvm::Triple::ArchType machine = m_arch_spec.GetMachine();
|
||||
switch (machine)
|
||||
{
|
||||
case ArchSpec::eCPU_i386:
|
||||
case ArchSpec::eCPU_x86_64:
|
||||
case llvm::Triple::x86:
|
||||
case llvm::Triple::x86_64:
|
||||
trap_opcode = g_i386_breakpoint_opcode;
|
||||
trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_arm:
|
||||
case llvm::Triple::arm:
|
||||
// TODO: fill this in for ARM. We need to dig up the symbol for
|
||||
// the address in the breakpoint locaiton and figure out if it is
|
||||
// an ARM or Thumb breakpoint.
|
||||
|
@ -515,8 +517,8 @@ ProcessMacOSX::GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site)
|
|||
trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
trap_opcode = g_ppc_breakpoint_opcode;
|
||||
trap_opcode_size = sizeof(g_ppc_breakpoint_opcode);
|
||||
break;
|
||||
|
@ -1672,19 +1674,16 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
|
|||
// We don't need to do this for ARM, and we really shouldn't now that we
|
||||
// have multiple CPU subtypes and no posix_spawnattr call that allows us
|
||||
// to set which CPU subtype to launch...
|
||||
if (arch_spec.GetType() == eArchTypeMachO)
|
||||
cpu_type_t cpu = arch_spec.GetMachOCPUType();
|
||||
if (cpu != 0 && cpu != UINT32_MAX && cpu != LLDB_INVALID_CPUTYPE)
|
||||
{
|
||||
cpu_type_t cpu = arch_spec.GetCPUType();
|
||||
if (cpu != 0 && cpu != UINT32_MAX && cpu != LLDB_INVALID_CPUTYPE)
|
||||
{
|
||||
size_t ocount = 0;
|
||||
err.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
|
||||
if (err.Fail() || log)
|
||||
err.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
|
||||
size_t ocount = 0;
|
||||
err.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
|
||||
if (err.Fail() || log)
|
||||
err.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
|
||||
|
||||
if (err.Fail() != 0 || ocount != 1)
|
||||
return LLDB_INVALID_PROCESS_ID;
|
||||
}
|
||||
if (err.Fail() != 0 || ocount != 1)
|
||||
return LLDB_INVALID_PROCESS_ID;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@ using namespace lldb_private;
|
|||
lldb_private::ArchDefaultUnwindPlan *
|
||||
ArchDefaultUnwindPlan_x86_64::CreateInstance (const lldb_private::ArchSpec &arch)
|
||||
{
|
||||
if (arch.GetGenericCPUType () == ArchSpec::eCPU_x86_64)
|
||||
if (arch.GetMachine () == llvm::Triple::x86_64)
|
||||
return new ArchDefaultUnwindPlan_x86_64 ();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ ArchDefaultUnwindPlan_x86_64::GetArchDefaultUnwindPlan (Thread& thread, Address
|
|||
lldb_private::ArchDefaultUnwindPlan *
|
||||
ArchDefaultUnwindPlan_i386::CreateInstance (const lldb_private::ArchSpec &arch)
|
||||
{
|
||||
if (arch.GetGenericCPUType () == ArchSpec::eCPU_i386)
|
||||
if (arch.GetMachine () == llvm::Triple::x86)
|
||||
return new ArchDefaultUnwindPlan_i386 ();
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -34,22 +34,20 @@ ArchVolatileRegs_x86::RegisterIsVolatile (Thread& thread, uint32_t regnum)
|
|||
lldb_private::ArchVolatileRegs *
|
||||
ArchVolatileRegs_x86::CreateInstance (const lldb_private::ArchSpec &arch)
|
||||
{
|
||||
uint32_t cpu = arch.GetCPUType ();
|
||||
if (cpu != llvm::MachO::CPUTypeX86_64 && cpu != llvm::MachO::CPUTypeI386)
|
||||
return NULL;
|
||||
|
||||
return new ArchVolatileRegs_x86 (cpu);
|
||||
llvm::Triple::ArchType cpu = arch.GetMachine ();
|
||||
if (cpu == llvm::Triple::x86 || cpu == llvm::Triple::x86_64)
|
||||
return new ArchVolatileRegs_x86 (cpu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ArchVolatileRegs_x86::ArchVolatileRegs_x86(int cpu) :
|
||||
lldb_private::ArchVolatileRegs(),
|
||||
m_cpu(cpu),
|
||||
m_non_volatile_regs()
|
||||
ArchVolatileRegs_x86::ArchVolatileRegs_x86(llvm::Triple::ArchType cpu) :
|
||||
lldb_private::ArchVolatileRegs(),
|
||||
m_cpu(cpu),
|
||||
m_non_volatile_regs()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
ArchVolatileRegs_x86::initialize_regset(Thread& thread)
|
||||
{
|
||||
if (m_non_volatile_regs.size() > 0)
|
||||
|
@ -78,13 +76,14 @@ ArchVolatileRegs_x86::initialize_regset(Thread& thread)
|
|||
|
||||
const char **names;
|
||||
int namecount;
|
||||
if (m_cpu == llvm::MachO::CPUTypeX86_64)
|
||||
if (m_cpu == llvm::Triple::x86_64)
|
||||
{
|
||||
names = x86_64_regnames;
|
||||
namecount = sizeof (x86_64_regnames) / sizeof (char *);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (m_cpu == llvm::Triple::x86);
|
||||
names = i386_regnames;
|
||||
namecount = sizeof (i386_regnames) / sizeof (char *);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define liblldb_ArchVolatileRegs_x86_h_
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Utility/ArchVolatileRegs.h"
|
||||
#include <set>
|
||||
|
||||
|
@ -62,11 +63,11 @@ public:
|
|||
EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
|
||||
|
||||
private:
|
||||
ArchVolatileRegs_x86(int cpu); // Call CreateInstance instead.
|
||||
ArchVolatileRegs_x86(llvm::Triple::ArchType cpu); // Call CreateInstance instead.
|
||||
|
||||
void initialize_regset(lldb_private::Thread& thread);
|
||||
|
||||
int m_cpu;
|
||||
llvm::Triple::ArchType m_cpu;
|
||||
std::set<int> m_non_volatile_regs;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ StopInfoMachException::GetDescription ()
|
|||
{
|
||||
if (m_description.empty() && m_value != 0)
|
||||
{
|
||||
ArchSpec::CPU cpu = m_thread.GetProcess().GetTarget().GetArchitecture().GetGenericCPUType();
|
||||
const llvm::Triple::ArchType cpu = m_thread.GetProcess().GetTarget().GetArchitecture().GetMachine();
|
||||
|
||||
const char *exc_desc = NULL;
|
||||
const char *code_label = "code";
|
||||
|
@ -44,7 +44,7 @@ StopInfoMachException::GetDescription ()
|
|||
subcode_label = "address";
|
||||
switch (cpu)
|
||||
{
|
||||
case ArchSpec::eCPU_arm:
|
||||
case llvm::Triple::arm:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 0x101: code_desc = "EXC_ARM_DA_ALIGN"; break;
|
||||
|
@ -52,8 +52,8 @@ StopInfoMachException::GetDescription ()
|
|||
}
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 0x101: code_desc = "EXC_PPC_VM_PROT_READ"; break;
|
||||
|
@ -71,14 +71,14 @@ StopInfoMachException::GetDescription ()
|
|||
exc_desc = "EXC_BAD_INSTRUCTION";
|
||||
switch (cpu)
|
||||
{
|
||||
case ArchSpec::eCPU_i386:
|
||||
case ArchSpec::eCPU_x86_64:
|
||||
case llvm::Triple::x86:
|
||||
case llvm::Triple::x86_64:
|
||||
if (m_exc_code == 1)
|
||||
code_desc = "EXC_I386_INVOP";
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 1: code_desc = "EXC_PPC_INVALID_SYSCALL"; break;
|
||||
|
@ -90,7 +90,7 @@ StopInfoMachException::GetDescription ()
|
|||
}
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_arm:
|
||||
case llvm::Triple::arm:
|
||||
if (m_exc_code == 1)
|
||||
code_desc = "EXC_ARM_UNDEFINED";
|
||||
break;
|
||||
|
@ -104,8 +104,8 @@ StopInfoMachException::GetDescription ()
|
|||
exc_desc = "EXC_ARITHMETIC";
|
||||
switch (cpu)
|
||||
{
|
||||
case ArchSpec::eCPU_i386:
|
||||
case ArchSpec::eCPU_x86_64:
|
||||
case llvm::Triple::x86:
|
||||
case llvm::Triple::x86_64:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 1: code_desc = "EXC_I386_DIV"; break;
|
||||
|
@ -119,8 +119,8 @@ StopInfoMachException::GetDescription ()
|
|||
}
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 1: code_desc = "EXC_PPC_OVERFLOW"; break;
|
||||
|
@ -157,8 +157,8 @@ StopInfoMachException::GetDescription ()
|
|||
exc_desc = "EXC_BREAKPOINT";
|
||||
switch (cpu)
|
||||
{
|
||||
case ArchSpec::eCPU_i386:
|
||||
case ArchSpec::eCPU_x86_64:
|
||||
case llvm::Triple::x86:
|
||||
case llvm::Triple::x86_64:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 1: subcode_desc = "EXC_I386_SGL"; break;
|
||||
|
@ -166,15 +166,15 @@ StopInfoMachException::GetDescription ()
|
|||
}
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 1: subcode_desc = "EXC_PPC_BREAKPOINT"; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_arm:
|
||||
case llvm::Triple::arm:
|
||||
switch (m_exc_code)
|
||||
{
|
||||
case 1: subcode_desc = "EXC_ARM_BREAKPOINT"; break;
|
||||
|
@ -248,7 +248,7 @@ StopInfoMachException::CreateStopReasonWithMachException
|
|||
{
|
||||
if (exc_type != 0)
|
||||
{
|
||||
ArchSpec::CPU cpu = thread.GetProcess().GetTarget().GetArchitecture().GetGenericCPUType();
|
||||
const llvm::Triple::ArchType cpu = thread.GetProcess().GetTarget().GetArchitecture().GetMachine();
|
||||
|
||||
switch (exc_type)
|
||||
{
|
||||
|
@ -258,8 +258,8 @@ StopInfoMachException::CreateStopReasonWithMachException
|
|||
case 2: // EXC_BAD_INSTRUCTION
|
||||
switch (cpu)
|
||||
{
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
switch (exc_code)
|
||||
{
|
||||
case 1: // EXC_PPC_INVALID_SYSCALL
|
||||
|
@ -293,8 +293,8 @@ StopInfoMachException::CreateStopReasonWithMachException
|
|||
bool is_software_breakpoint = false;
|
||||
switch (cpu)
|
||||
{
|
||||
case ArchSpec::eCPU_i386:
|
||||
case ArchSpec::eCPU_x86_64:
|
||||
case llvm::Triple::x86:
|
||||
case llvm::Triple::x86_64:
|
||||
if (exc_code == 1) // EXC_I386_SGL
|
||||
{
|
||||
return StopInfo::CreateStopReasonToTrace(thread);
|
||||
|
@ -305,12 +305,12 @@ StopInfoMachException::CreateStopReasonWithMachException
|
|||
}
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
is_software_breakpoint = exc_code == 1; // EXC_PPC_BREAKPOINT
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_arm:
|
||||
case llvm::Triple::arm:
|
||||
is_software_breakpoint = exc_code == 1; // EXC_ARM_BREAKPOINT
|
||||
break;
|
||||
|
||||
|
|
|
@ -847,11 +847,12 @@ UnwindAssemblyProfiler_x86::FirstNonPrologueInsn (AddressRange& func, Target& ta
|
|||
UnwindAssemblyProfiler *
|
||||
UnwindAssemblyProfiler_x86::CreateInstance (const ArchSpec &arch)
|
||||
{
|
||||
ArchSpec::CPU cpu = arch.GetGenericCPUType ();
|
||||
if (cpu != ArchSpec::eCPU_x86_64 && cpu != ArchSpec::eCPU_i386)
|
||||
return NULL;
|
||||
|
||||
return new UnwindAssemblyProfiler_x86 (cpu == ArchSpec::eCPU_x86_64 ? k_x86_64 : k_i386);
|
||||
const llvm::Triple::ArchType cpu = arch.GetMachine ();
|
||||
if (cpu == llvm::Triple::x86)
|
||||
return new UnwindAssemblyProfiler_x86 (k_i386);
|
||||
else if (cpu == llvm::Triple::x86_64)
|
||||
return new UnwindAssemblyProfiler_x86 (k_x86_64);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ UnwindMacOSXFrameBackchain::GetFrameCount()
|
|||
{
|
||||
if (m_cursors.empty())
|
||||
{
|
||||
const ArchSpec target_arch (m_thread.GetProcess().GetTarget().GetArchitecture ());
|
||||
const ArchSpec& target_arch = m_thread.GetProcess().GetTarget().GetArchitecture ();
|
||||
// Frame zero should always be supplied by the thread...
|
||||
StackFrameSP frame_sp (m_thread.GetStackFrameAtIndex (0));
|
||||
if (target_arch == ArchSpec("x86_64"))
|
||||
if (target_arch.GetMachine() == llvm::Triple::x86_64)
|
||||
GetStackFrameData_x86_64 (frame_sp.get());
|
||||
else if (target_arch == ArchSpec("i386"))
|
||||
else if (target_arch.GetMachine() == llvm::Triple::x86)
|
||||
GetStackFrameData_i386 (frame_sp.get());
|
||||
|
||||
}
|
||||
|
|
|
@ -1001,7 +1001,7 @@ GDBRemoteCommunication::GetHostInfo ()
|
|||
}
|
||||
|
||||
if (cpu != LLDB_INVALID_CPUTYPE)
|
||||
m_arch.SetMachOArch (cpu, sub);
|
||||
m_arch.SetArchitecture (lldb::eArchTypeMachO, cpu, sub);
|
||||
}
|
||||
}
|
||||
return m_supports_qHostInfo == eLazyBoolYes;
|
||||
|
|
|
@ -328,8 +328,7 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force)
|
|||
// We didn't get anything. See if we are debugging ARM and fill with
|
||||
// a hard coded register set until we can get an updated debugserver
|
||||
// down on the devices.
|
||||
ArchSpec arm_arch ("arm");
|
||||
if (GetTarget().GetArchitecture() == arm_arch)
|
||||
if (GetTarget().GetArchitecture().GetMachine() == llvm::Triple::arm)
|
||||
m_register_info.HardcodeARMRegisters();
|
||||
}
|
||||
m_register_info.Finalize ();
|
||||
|
@ -553,7 +552,9 @@ ProcessGDBRemote::DoLaunch
|
|||
{
|
||||
// Set our user ID to an invalid process ID.
|
||||
SetID(LLDB_INVALID_PROCESS_ID);
|
||||
error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n", module->GetFileSpec().GetFilename().AsCString(), module->GetArchitecture().AsCString());
|
||||
error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n",
|
||||
module->GetFileSpec().GetFilename().AsCString(),
|
||||
module->GetArchitecture().GetArchitectureName());
|
||||
}
|
||||
return error;
|
||||
|
||||
|
@ -642,8 +643,8 @@ ProcessGDBRemote::DidLaunchOrAttach ()
|
|||
// it has, so we really need to take the remote host architecture as our
|
||||
// defacto architecture in this case.
|
||||
|
||||
if (gdb_remote_arch == ArchSpec ("arm") &&
|
||||
vendor && ::strcmp(vendor, "apple") == 0)
|
||||
if (gdb_remote_arch.GetMachine() == llvm::Triple::arm &&
|
||||
gdb_remote_arch.GetTriple().getVendor() == llvm::Triple::Apple)
|
||||
{
|
||||
GetTarget().SetArchitecture (gdb_remote_arch);
|
||||
target_arch = gdb_remote_arch;
|
||||
|
@ -1044,16 +1045,16 @@ ProcessGDBRemote::GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site)
|
|||
static const uint8_t g_ppc_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 };
|
||||
static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
|
||||
|
||||
ArchSpec::CPU arch_cpu = GetTarget().GetArchitecture().GetGenericCPUType();
|
||||
switch (arch_cpu)
|
||||
const llvm::Triple::ArchType machine = GetTarget().GetArchitecture().GetMachine();
|
||||
switch (machine)
|
||||
{
|
||||
case ArchSpec::eCPU_i386:
|
||||
case ArchSpec::eCPU_x86_64:
|
||||
case llvm::Triple::x86:
|
||||
case llvm::Triple::x86_64:
|
||||
trap_opcode = g_i386_breakpoint_opcode;
|
||||
trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_arm:
|
||||
case llvm::Triple::arm:
|
||||
// TODO: fill this in for ARM. We need to dig up the symbol for
|
||||
// the address in the breakpoint locaiton and figure out if it is
|
||||
// an ARM or Thumb breakpoint.
|
||||
|
@ -1061,8 +1062,8 @@ ProcessGDBRemote::GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site)
|
|||
trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
|
||||
break;
|
||||
|
||||
case ArchSpec::eCPU_ppc:
|
||||
case ArchSpec::eCPU_ppc64:
|
||||
case llvm::Triple::ppc:
|
||||
case llvm::Triple::ppc64:
|
||||
trap_opcode = g_ppc_breakpoint_opcode;
|
||||
trap_opcode_size = sizeof(g_ppc_breakpoint_opcode);
|
||||
break;
|
||||
|
@ -1955,31 +1956,33 @@ ProcessGDBRemote::StartDebugserverProcess
|
|||
|
||||
Error local_err; // Errors that don't affect the spawning.
|
||||
if (log)
|
||||
log->Printf ("%s ( path='%s', argv=%p, envp=%p, arch=%s )", __FUNCTION__, debugserver_path, inferior_argv, inferior_envp, inferior_arch.AsCString());
|
||||
log->Printf ("%s ( path='%s', argv=%p, envp=%p, arch=%s )",
|
||||
__FUNCTION__,
|
||||
debugserver_path,
|
||||
inferior_argv,
|
||||
inferior_envp,
|
||||
inferior_arch.GetArchitectureName());
|
||||
error.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX);
|
||||
if (error.Fail() || log)
|
||||
error.PutToLog(log.get(), "::posix_spawnattr_init ( &attr )");
|
||||
if (error.Fail())
|
||||
return error;;
|
||||
return error;
|
||||
|
||||
#if !defined (__arm__)
|
||||
|
||||
// We don't need to do this for ARM, and we really shouldn't now
|
||||
// that we have multiple CPU subtypes and no posix_spawnattr call
|
||||
// that allows us to set which CPU subtype to launch...
|
||||
if (inferior_arch.GetType() == eArchTypeMachO)
|
||||
cpu_type_t cpu = inferior_arch.GetMachOCPUType();
|
||||
if (cpu != 0 && cpu != UINT32_MAX && cpu != LLDB_INVALID_CPUTYPE)
|
||||
{
|
||||
cpu_type_t cpu = inferior_arch.GetCPUType();
|
||||
if (cpu != 0 && cpu != UINT32_MAX && cpu != LLDB_INVALID_CPUTYPE)
|
||||
{
|
||||
size_t ocount = 0;
|
||||
error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
|
||||
if (error.Fail() || log)
|
||||
error.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
|
||||
|
||||
if (error.Fail() != 0 || ocount != 1)
|
||||
return error;
|
||||
}
|
||||
size_t ocount = 0;
|
||||
error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
|
||||
if (error.Fail() || log)
|
||||
error.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
|
||||
|
||||
if (error.Fail() != 0 || ocount != 1)
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -142,7 +142,8 @@ ThreadGDBRemote::GetUnwinder ()
|
|||
if (m_unwinder_ap.get() == NULL)
|
||||
{
|
||||
const ArchSpec target_arch (GetProcess().GetTarget().GetArchitecture ());
|
||||
if (target_arch == ArchSpec("x86_64") || target_arch == ArchSpec("i386"))
|
||||
const llvm::Triple::ArchType machine = target_arch.GetMachine();
|
||||
if (machine == llvm::Triple::x86_64 || machine == llvm::Triple::x86)
|
||||
{
|
||||
m_unwinder_ap.reset (new UnwindLLDB (*this));
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *t
|
|||
module_sp->GetFileSpec().Dump(s);
|
||||
*s << '"';
|
||||
if (module_sp->GetArchitecture().IsValid())
|
||||
s->Printf (", arch = \"%s\"", module_sp->GetArchitecture().AsCString());
|
||||
s->Printf (", arch = \"%s\"", module_sp->GetArchitecture().GetArchitectureName());
|
||||
s->EOL();
|
||||
}
|
||||
|
||||
|
|
|
@ -801,28 +801,20 @@ Target::GetSettingsController ()
|
|||
ArchSpec
|
||||
Target::GetDefaultArchitecture ()
|
||||
{
|
||||
lldb::UserSettingsControllerSP &settings_controller = GetSettingsController();
|
||||
lldb::SettableVariableType var_type;
|
||||
Error err;
|
||||
StringList result = settings_controller->GetVariable ("target.default-arch", var_type, "[]", err);
|
||||
|
||||
const char *default_name = "";
|
||||
if (result.GetSize() == 1 && err.Success())
|
||||
default_name = result.GetStringAtIndex (0);
|
||||
|
||||
ArchSpec default_arch (default_name);
|
||||
return default_arch;
|
||||
lldb::UserSettingsControllerSP settings_controller_sp (GetSettingsController());
|
||||
|
||||
if (settings_controller_sp)
|
||||
return static_cast<Target::SettingsController *>(settings_controller_sp.get())->GetArchitecture ();
|
||||
return ArchSpec();
|
||||
}
|
||||
|
||||
void
|
||||
Target::SetDefaultArchitecture (ArchSpec new_arch)
|
||||
Target::SetDefaultArchitecture (const ArchSpec& arch)
|
||||
{
|
||||
if (new_arch.IsValid())
|
||||
GetSettingsController ()->SetVariable ("target.default-arch",
|
||||
new_arch.AsCString(),
|
||||
lldb::eVarSetOperationAssign,
|
||||
false,
|
||||
"[]");
|
||||
lldb::UserSettingsControllerSP settings_controller_sp (GetSettingsController());
|
||||
|
||||
if (settings_controller_sp)
|
||||
static_cast<Target::SettingsController *>(settings_controller_sp.get())->GetArchitecture () = arch;
|
||||
}
|
||||
|
||||
Target *
|
||||
|
@ -854,7 +846,7 @@ Target::UpdateInstanceName ()
|
|||
{
|
||||
sstr.Printf ("%s_%s",
|
||||
module_sp->GetFileSpec().GetFilename().AsCString(),
|
||||
module_sp->GetArchitecture().AsCString());
|
||||
module_sp->GetArchitecture().GetArchitectureName());
|
||||
GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(),
|
||||
sstr.GetData());
|
||||
}
|
||||
|
@ -1053,11 +1045,9 @@ Target::SettingsController::SetGlobalVariable (const ConstString &var_name,
|
|||
{
|
||||
if (var_name == GetSettingNameForDefaultArch())
|
||||
{
|
||||
ArchSpec tmp_spec (value);
|
||||
if (tmp_spec.IsValid())
|
||||
m_default_architecture = tmp_spec;
|
||||
else
|
||||
err.SetErrorStringWithFormat ("'%s' is not a valid architecture.", value);
|
||||
m_default_architecture.SetTriple (value);
|
||||
if (!m_default_architecture.IsValid())
|
||||
err.SetErrorStringWithFormat ("'%s' is not a valid architecture or triple.", value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1072,7 +1062,7 @@ Target::SettingsController::GetGlobalVariable (const ConstString &var_name,
|
|||
{
|
||||
// If the arch is invalid (the default), don't show a string for it
|
||||
if (m_default_architecture.IsValid())
|
||||
value.AppendString (m_default_architecture.AsCString());
|
||||
value.AppendString (m_default_architecture.GetArchitectureName());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -58,7 +58,7 @@ TargetList::CreateTarget
|
|||
"TargetList::CreateTarget (file = '%s/%s', arch = '%s', uuid = %p)",
|
||||
file.GetDirectory().AsCString(),
|
||||
file.GetFilename().AsCString(),
|
||||
arch.AsCString(),
|
||||
arch.GetArchitectureName(),
|
||||
uuid_ptr);
|
||||
Error error;
|
||||
|
||||
|
@ -96,7 +96,7 @@ TargetList::CreateTarget
|
|||
file.GetDirectory().AsCString(),
|
||||
file.GetDirectory() ? "/" : "",
|
||||
file.GetFilename().AsCString(),
|
||||
arch.AsCString());
|
||||
arch.GetArchitectureName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -629,7 +629,7 @@ def lldbLoggings():
|
|||
else:
|
||||
lldb_log_option = "event process expr state api"
|
||||
ci.HandleCommand(
|
||||
"log enable -T -n -f " + os.environ["LLDB_LOG"] + " lldb " + lldb_log_option,
|
||||
"log enable -n -f " + os.environ["LLDB_LOG"] + " lldb " + lldb_log_option,
|
||||
res)
|
||||
if not res.Succeeded():
|
||||
raise Exception('log enable failed (check LLDB_LOG env variable.')
|
||||
|
@ -641,7 +641,7 @@ def lldbLoggings():
|
|||
else:
|
||||
gdb_remote_log_option = "packets process"
|
||||
ci.HandleCommand(
|
||||
"log enable -T -n -f " + os.environ["GDB_REMOTE_LOG"] + " process.gdb-remote "
|
||||
"log enable -n -f " + os.environ["GDB_REMOTE_LOG"] + " process.gdb-remote "
|
||||
+ gdb_remote_log_option,
|
||||
res)
|
||||
if not res.Succeeded():
|
||||
|
|
Loading…
Reference in New Issue