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:
Greg Clayton
2011-02-23 00:35:02 +00:00
parent 37de3235e5
commit 64195a2c8b
40 changed files with 915 additions and 2294 deletions

View File

@@ -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());
}
}
}