//------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ ABISP ABIMacOSX_arm::CreateInstance (const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); if ((arch_type == llvm::Triple::arm) || (arch_type == llvm::Triple::thumb)) { if (!g_abi_sp) g_abi_sp.reset (new ABIMacOSX_arm); return g_abi_sp; } return ABISP(); }
bool PlatformAppleTVSimulator::GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) { static const ArchSpec platform_arch( HostInfo::GetArchitecture(HostInfo::eArchKind64)); if (idx == 0) { arch = platform_arch; if (arch.IsValid()) { arch.GetTriple().setOS(llvm::Triple::TvOS); return true; } } return false; }
//------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ ABISP ABISysV_mips::CreateInstance (const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); if ((arch_type == llvm::Triple::mips) || (arch_type == llvm::Triple::mipsel)) { if (!g_abi_sp) g_abi_sp.reset (new ABISysV_mips); return g_abi_sp; } return ABISP(); }
bool PlatformOpenBSD::GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) { if (IsHost()) { ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); if (hostArch.GetTriple().isOSOpenBSD()) { if (idx == 0) { arch = hostArch; return arch.IsValid(); } } } else { if (m_remote_platform_sp) return m_remote_platform_sp->GetSupportedArchitectureAtIndex(idx, arch); llvm::Triple triple; // Set the OS to OpenBSD triple.setOS(llvm::Triple::OpenBSD); // Set the architecture switch (idx) { case 0: triple.setArchName("x86_64"); break; case 1: triple.setArchName("i386"); break; case 2: triple.setArchName("aarch64"); break; case 3: triple.setArchName("arm"); break; default: return false; } // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the // vendor by // calling triple.SetVendorName("unknown") so that it is a "unspecified // unknown". // This means when someone calls triple.GetVendorName() it will return an // empty string // which indicates that the vendor can be set when two architectures are // merged // Now set the triple into "arch" and return true arch.SetTriple(triple); return true; } return false; }
PlatformSP OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, Error& error, ArchSpec &platform_arch) const { PlatformSP platform_sp; if (!m_platform_name.empty()) { platform_sp = Platform::Create (ConstString(m_platform_name.c_str()), error); if (platform_sp) { if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) { error.SetErrorStringWithFormat ("platform '%s' doesn't support '%s'", platform_sp->GetName().GetCString(), arch.GetTriple().getTriple().c_str()); platform_sp.reset(); return platform_sp; } } } else if (arch.IsValid()) { platform_sp = Platform::Create (arch, &platform_arch, error); } if (platform_sp) { interpreter.GetDebugger().GetPlatformList().Append (platform_sp, make_selected); if (m_os_version_major != UINT32_MAX) { platform_sp->SetOSVersion (m_os_version_major, m_os_version_minor, m_os_version_update); } if (m_sdk_sysroot) platform_sp->SetSDKRootDirectory (m_sdk_sysroot); if (m_sdk_build) platform_sp->SetSDKBuild (m_sdk_build); } return platform_sp; }
bool PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) { if (idx == 0) { arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); return arch.IsValid(); } else if (idx == 1) { // If the default host architecture is 64-bit, look for a 32-bit variant ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit()) { arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); return arch.IsValid(); } } return false; }
TEST(ArchSpecTest, TestParseMachCPUDashSubtypeTripleExtra) { ArchSpec AS; EXPECT_TRUE(ParseMachCPUDashSubtypeTriple("12-15-vendor-os", AS)); EXPECT_EQ(12u, AS.GetMachOCPUType()); EXPECT_EQ(15u, AS.GetMachOCPUSubType()); EXPECT_EQ("vendor", AS.GetTriple().getVendorName()); EXPECT_EQ("os", AS.GetTriple().getOSName()); AS = ArchSpec(); EXPECT_TRUE(ParseMachCPUDashSubtypeTriple("12-10-vendor-os-name", AS)); EXPECT_EQ(12u, AS.GetMachOCPUType()); EXPECT_EQ(10u, AS.GetMachOCPUSubType()); EXPECT_EQ("vendor", AS.GetTriple().getVendorName()); EXPECT_EQ("os", AS.GetTriple().getOSName()); AS = ArchSpec(); EXPECT_TRUE(ParseMachCPUDashSubtypeTriple("12-15-vendor.os-name", AS)); EXPECT_EQ(12u, AS.GetMachOCPUType()); EXPECT_EQ(15u, AS.GetMachOCPUSubType()); EXPECT_EQ("vendor.os", AS.GetTriple().getVendorName()); EXPECT_EQ("name", AS.GetTriple().getOSName()); // These there should parse correctly, but the vendor / OS should be defaulted // since they are unrecognized. AS = ArchSpec(); EXPECT_TRUE(ParseMachCPUDashSubtypeTriple("12-10-vendor", AS)); EXPECT_EQ(12u, AS.GetMachOCPUType()); EXPECT_EQ(10u, AS.GetMachOCPUSubType()); EXPECT_EQ("apple", AS.GetTriple().getVendorName()); EXPECT_EQ("", AS.GetTriple().getOSName()); AS = ArchSpec(); EXPECT_FALSE(ParseMachCPUDashSubtypeTriple("12.10.10", AS)); AS = ArchSpec(); EXPECT_FALSE(ParseMachCPUDashSubtypeTriple("12-10.10", AS)); }
lldb::UnixSignalsSP UnixSignals::Create(const ArchSpec &arch) { const auto &triple = arch.GetTriple(); switch (triple.getOS()) { case llvm::Triple::Linux: { switch (triple.getArch()) { case llvm::Triple::mips: case llvm::Triple::mipsel: case llvm::Triple::mips64: case llvm::Triple::mips64el: return std::make_shared<MipsLinuxSignals>(); default: return std::make_shared<LinuxSignals>(); } } case llvm::Triple::FreeBSD: case llvm::Triple::OpenBSD: return std::make_shared<FreeBSDSignals>(); case llvm::Triple::NetBSD: return std::make_shared<NetBSDSignals>(); default: return std::make_shared<UnixSignals>(); } }
TEST(ArchSpecTest, TestSetTriple) { ArchSpec AS; // Various flavors of valid triples. EXPECT_TRUE(AS.SetTriple("12-10-apple-darwin")); EXPECT_EQ(uint32_t(llvm::MachO::CPU_TYPE_ARM), AS.GetMachOCPUType()); EXPECT_EQ(10u, AS.GetMachOCPUSubType()); EXPECT_TRUE(llvm::StringRef(AS.GetTriple().str()) .consume_front("armv7f-apple-darwin")); EXPECT_EQ(ArchSpec::eCore_arm_armv7f, AS.GetCore()); AS = ArchSpec(); EXPECT_TRUE(AS.SetTriple("18.100-apple-darwin")); EXPECT_EQ(uint32_t(llvm::MachO::CPU_TYPE_POWERPC), AS.GetMachOCPUType()); EXPECT_EQ(100u, AS.GetMachOCPUSubType()); EXPECT_TRUE(llvm::StringRef(AS.GetTriple().str()) .consume_front("powerpc-apple-darwin")); EXPECT_EQ(ArchSpec::eCore_ppc_ppc970, AS.GetCore()); AS = ArchSpec(); EXPECT_TRUE(AS.SetTriple("i686-pc-windows")); EXPECT_EQ(llvm::Triple::x86, AS.GetTriple().getArch()); EXPECT_EQ(llvm::Triple::PC, AS.GetTriple().getVendor()); EXPECT_EQ(llvm::Triple::Win32, AS.GetTriple().getOS()); EXPECT_TRUE( llvm::StringRef(AS.GetTriple().str()).consume_front("i686-pc-windows")); EXPECT_STREQ("i686", AS.GetArchitectureName()); EXPECT_EQ(ArchSpec::eCore_x86_32_i686, AS.GetCore()); // Various flavors of invalid triples. AS = ArchSpec(); EXPECT_FALSE(AS.SetTriple("unknown-unknown-unknown")); AS = ArchSpec(); EXPECT_FALSE(AS.SetTriple("unknown")); AS = ArchSpec(); EXPECT_FALSE(AS.SetTriple("")); }
DisassemblerLLVMC::DisassemblerLLVMC (const ArchSpec &arch, const char *flavor_string) : Disassembler(arch, flavor_string), m_exe_ctx (NULL), m_inst (NULL), m_data_from_file (false) { if (!FlavorValidForArchSpec (arch, m_flavor.c_str())) { m_flavor.assign("default"); } const char *triple = arch.GetTriple().getTriple().c_str(); unsigned flavor = ~0U; // So far the only supported flavor is "intel" on x86. The base class will set this // correctly coming in. if (arch.GetTriple().getArch() == llvm::Triple::x86 || arch.GetTriple().getArch() == llvm::Triple::x86_64) { if (m_flavor == "intel") { flavor = 1; } else if (m_flavor == "att") { flavor = 0; } } ArchSpec thumb_arch(arch); if (arch.GetTriple().getArch() == llvm::Triple::arm) { std::string thumb_arch_name (thumb_arch.GetTriple().getArchName().str()); // Replace "arm" with "thumb" so we get all thumb variants correct if (thumb_arch_name.size() > 3) { thumb_arch_name.erase(0,3); thumb_arch_name.insert(0, "thumb"); } else { thumb_arch_name = "thumbv7"; } thumb_arch.GetTriple().setArchName(llvm::StringRef(thumb_arch_name.c_str())); } // Cortex-M3 devices (e.g. armv7m) can only execute thumb (T2) instructions, // so hardcode the primary disassembler to thumb mode. Same for Cortex-M4 (armv7em). // // Handle the Cortex-M0 (armv6m) the same; the ISA is a subset of the T and T32 // instructions defined in ARMv7-A. if (arch.GetTriple().getArch() == llvm::Triple::arm && (arch.GetCore() == ArchSpec::Core::eCore_arm_armv7m || arch.GetCore() == ArchSpec::Core::eCore_arm_armv7em || arch.GetCore() == ArchSpec::Core::eCore_arm_armv6m)) { triple = thumb_arch.GetTriple().getTriple().c_str(); } m_disasm_ap.reset (new LLVMCDisassembler(triple, flavor, *this)); if (!m_disasm_ap->IsValid()) { // We use m_disasm_ap.get() to tell whether we are valid or not, so if this isn't good for some reason, // we reset it, and then we won't be valid and FindPlugin will fail and we won't get used. m_disasm_ap.reset(); } // For arm CPUs that can execute arm or thumb instructions, also create a thumb instruction disassembler. if (arch.GetTriple().getArch() == llvm::Triple::arm) { std::string thumb_triple(thumb_arch.GetTriple().getTriple()); m_alternate_disasm_ap.reset(new LLVMCDisassembler(thumb_triple.c_str(), flavor, *this)); if (!m_alternate_disasm_ap->IsValid()) { m_disasm_ap.reset(); m_alternate_disasm_ap.reset(); } } }
RegisterContextSP ThreadElfCore::CreateRegisterContextForFrame (StackFrame *frame) { RegisterContextSP reg_ctx_sp; uint32_t concrete_frame_idx = 0; Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD)); if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex (); if (concrete_frame_idx == 0) { if (m_thread_reg_ctx_sp) return m_thread_reg_ctx_sp; ProcessElfCore *process = static_cast<ProcessElfCore *>(GetProcess().get()); ArchSpec arch = process->GetArchitecture(); RegisterInfoInterface *reg_interface = NULL; switch (arch.GetTriple().getOS()) { case llvm::Triple::FreeBSD: { switch (arch.GetMachine()) { case llvm::Triple::mips64: reg_interface = new RegisterContextFreeBSD_mips64(arch); break; case llvm::Triple::x86: reg_interface = new RegisterContextFreeBSD_i386(arch); break; case llvm::Triple::x86_64: reg_interface = new RegisterContextFreeBSD_x86_64(arch); break; default: break; } break; } case llvm::Triple::Linux: { switch (arch.GetMachine()) { case llvm::Triple::x86_64: reg_interface = new RegisterContextLinux_x86_64(arch); break; default: break; } break; } default: break; } if (!reg_interface) { if (log) log->Printf ("elf-core::%s:: Architecture(%d) or OS(%d) not supported", __FUNCTION__, arch.GetMachine(), arch.GetTriple().getOS()); assert (false && "Architecture or OS not supported"); } switch (arch.GetMachine()) { case llvm::Triple::mips64: m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_mips64 (*this, reg_interface, m_gpregset_data, m_fpregset_data)); break; case llvm::Triple::x86: case llvm::Triple::x86_64: m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64 (*this, reg_interface, m_gpregset_data, m_fpregset_data)); break; default: break; } reg_ctx_sp = m_thread_reg_ctx_sp; } else if (m_unwinder_ap.get()) { reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame (frame); } return reg_ctx_sp; }
bool ArchSpec::Compare (const ArchSpec& rhs, bool exact_match) const { if (GetByteOrder() != rhs.GetByteOrder()) return false; const ArchSpec::Core lhs_core = GetCore (); const ArchSpec::Core rhs_core = rhs.GetCore (); const bool core_match = cores_match (lhs_core, rhs_core, true, exact_match); if (core_match) { const llvm::Triple &lhs_triple = GetTriple(); const llvm::Triple &rhs_triple = rhs.GetTriple(); const llvm::Triple::VendorType lhs_triple_vendor = lhs_triple.getVendor(); const llvm::Triple::VendorType rhs_triple_vendor = rhs_triple.getVendor(); if (lhs_triple_vendor != rhs_triple_vendor) { const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified(); const bool lhs_vendor_specified = TripleVendorWasSpecified(); // Both architectures had the vendor specified, so if they aren't // equal then we return false if (rhs_vendor_specified && lhs_vendor_specified) return false; // Only fail if both vendor types are not unknown if (lhs_triple_vendor != llvm::Triple::UnknownVendor && rhs_triple_vendor != llvm::Triple::UnknownVendor) return false; } const llvm::Triple::OSType lhs_triple_os = lhs_triple.getOS(); const llvm::Triple::OSType rhs_triple_os = rhs_triple.getOS(); if (lhs_triple_os != rhs_triple_os) { const bool rhs_os_specified = rhs.TripleOSWasSpecified(); const bool lhs_os_specified = TripleOSWasSpecified(); // Both architectures had the OS specified, so if they aren't // equal then we return false if (rhs_os_specified && lhs_os_specified) return false; // Only fail if both os types are not unknown if (lhs_triple_os != llvm::Triple::UnknownOS && rhs_triple_os != llvm::Triple::UnknownOS) return false; } const llvm::Triple::EnvironmentType lhs_triple_env = lhs_triple.getEnvironment(); const llvm::Triple::EnvironmentType rhs_triple_env = rhs_triple.getEnvironment(); if (lhs_triple_env != rhs_triple_env) { // Only fail if both environment types are not unknown if (lhs_triple_env != llvm::Triple::UnknownEnvironment && rhs_triple_env != llvm::Triple::UnknownEnvironment) return false; } return true; } return false; }
RegisterContextSP ThreadMinidump::CreateRegisterContextForFrame(StackFrame *frame) { RegisterContextSP reg_ctx_sp; uint32_t concrete_frame_idx = 0; if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex(); if (concrete_frame_idx == 0) { if (m_thread_reg_ctx_sp) return m_thread_reg_ctx_sp; ProcessMinidump *process = static_cast<ProcessMinidump *>(GetProcess().get()); ArchSpec arch = process->GetArchitecture(); RegisterInfoInterface *reg_interface = nullptr; // TODO write other register contexts and add them here switch (arch.GetMachine()) { case llvm::Triple::x86: { reg_interface = new RegisterContextLinux_i386(arch); lldb::DataBufferSP buf = ConvertMinidumpContext_x86_32(m_gpregset_data, reg_interface); DataExtractor gpregset(buf, lldb::eByteOrderLittle, 4); m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64( *this, reg_interface, gpregset, {})); break; } case llvm::Triple::x86_64: { reg_interface = new RegisterContextLinux_x86_64(arch); lldb::DataBufferSP buf = ConvertMinidumpContext_x86_64(m_gpregset_data, reg_interface); DataExtractor gpregset(buf, lldb::eByteOrderLittle, 8); m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64( *this, reg_interface, gpregset, {})); break; } case llvm::Triple::aarch64: { DataExtractor data(m_gpregset_data.data(), m_gpregset_data.size(), lldb::eByteOrderLittle, 8); m_thread_reg_ctx_sp.reset(new RegisterContextMinidump_ARM64(*this, data)); break; } case llvm::Triple::arm: { DataExtractor data(m_gpregset_data.data(), m_gpregset_data.size(), lldb::eByteOrderLittle, 8); const bool apple = arch.GetTriple().getVendor() == llvm::Triple::Apple; m_thread_reg_ctx_sp.reset( new RegisterContextMinidump_ARM(*this, data, apple)); break; } default: break; } reg_ctx_sp = m_thread_reg_ctx_sp; } else if (m_unwinder_ap) { reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame(frame); } return reg_ctx_sp; }
void DynamicRegisterInfo::Finalize(const ArchSpec &arch) { if (m_finalized) return; m_finalized = true; const size_t num_sets = m_sets.size(); for (size_t set = 0; set < num_sets; ++set) { assert(m_sets.size() == m_set_reg_nums.size()); m_sets[set].num_registers = m_set_reg_nums[set].size(); m_sets[set].registers = &m_set_reg_nums[set][0]; } // sort and unique all value registers and make sure each is terminated with // LLDB_INVALID_REGNUM for (reg_to_regs_map::iterator pos = m_value_regs_map.begin(), end = m_value_regs_map.end(); pos != end; ++pos) { if (pos->second.size() > 1) { std::sort(pos->second.begin(), pos->second.end()); reg_num_collection::iterator unique_end = std::unique(pos->second.begin(), pos->second.end()); if (unique_end != pos->second.end()) pos->second.erase(unique_end, pos->second.end()); } assert(!pos->second.empty()); if (pos->second.back() != LLDB_INVALID_REGNUM) pos->second.push_back(LLDB_INVALID_REGNUM); } // Now update all value_regs with each register info as needed const size_t num_regs = m_regs.size(); for (size_t i = 0; i < num_regs; ++i) { if (m_value_regs_map.find(i) != m_value_regs_map.end()) m_regs[i].value_regs = m_value_regs_map[i].data(); else m_regs[i].value_regs = NULL; } // Expand all invalidation dependencies for (reg_to_regs_map::iterator pos = m_invalidate_regs_map.begin(), end = m_invalidate_regs_map.end(); pos != end; ++pos) { const uint32_t reg_num = pos->first; if (m_regs[reg_num].value_regs) { reg_num_collection extra_invalid_regs; for (const uint32_t invalidate_reg_num : pos->second) { reg_to_regs_map::iterator invalidate_pos = m_invalidate_regs_map.find(invalidate_reg_num); if (invalidate_pos != m_invalidate_regs_map.end()) { for (const uint32_t concrete_invalidate_reg_num : invalidate_pos->second) { if (concrete_invalidate_reg_num != reg_num) extra_invalid_regs.push_back(concrete_invalidate_reg_num); } } } pos->second.insert(pos->second.end(), extra_invalid_regs.begin(), extra_invalid_regs.end()); } } // sort and unique all invalidate registers and make sure each is terminated // with // LLDB_INVALID_REGNUM for (reg_to_regs_map::iterator pos = m_invalidate_regs_map.begin(), end = m_invalidate_regs_map.end(); pos != end; ++pos) { if (pos->second.size() > 1) { std::sort(pos->second.begin(), pos->second.end()); reg_num_collection::iterator unique_end = std::unique(pos->second.begin(), pos->second.end()); if (unique_end != pos->second.end()) pos->second.erase(unique_end, pos->second.end()); } assert(!pos->second.empty()); if (pos->second.back() != LLDB_INVALID_REGNUM) pos->second.push_back(LLDB_INVALID_REGNUM); } // Now update all invalidate_regs with each register info as needed for (size_t i = 0; i < num_regs; ++i) { if (m_invalidate_regs_map.find(i) != m_invalidate_regs_map.end()) m_regs[i].invalidate_regs = m_invalidate_regs_map[i].data(); else m_regs[i].invalidate_regs = NULL; } // Check if we need to automatically set the generic registers in case // they weren't set bool generic_regs_specified = false; for (const auto ® : m_regs) { if (reg.kinds[eRegisterKindGeneric] != LLDB_INVALID_REGNUM) { generic_regs_specified = true; break; } } if (!generic_regs_specified) { switch (arch.GetMachine()) { case llvm::Triple::aarch64: case llvm::Triple::aarch64_be: for (auto ® : m_regs) { if (strcmp(reg.name, "pc") == 0) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; else if ((strcmp(reg.name, "fp") == 0) || (strcmp(reg.name, "x29") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FP; else if ((strcmp(reg.name, "lr") == 0) || (strcmp(reg.name, "x30") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_RA; else if ((strcmp(reg.name, "sp") == 0) || (strcmp(reg.name, "x31") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_SP; else if (strcmp(reg.name, "cpsr") == 0) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FLAGS; } break; case llvm::Triple::arm: case llvm::Triple::armeb: case llvm::Triple::thumb: case llvm::Triple::thumbeb: for (auto ® : m_regs) { if ((strcmp(reg.name, "pc") == 0) || (strcmp(reg.name, "r15") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; else if ((strcmp(reg.name, "sp") == 0) || (strcmp(reg.name, "r13") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_SP; else if ((strcmp(reg.name, "lr") == 0) || (strcmp(reg.name, "r14") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_RA; else if ((strcmp(reg.name, "r7") == 0) && arch.GetTriple().getVendor() == llvm::Triple::Apple) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FP; else if ((strcmp(reg.name, "r11") == 0) && arch.GetTriple().getVendor() != llvm::Triple::Apple) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FP; else if (strcmp(reg.name, "fp") == 0) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FP; else if (strcmp(reg.name, "cpsr") == 0) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FLAGS; } break; case llvm::Triple::x86: for (auto ® : m_regs) { if ((strcmp(reg.name, "eip") == 0) || (strcmp(reg.name, "pc") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; else if ((strcmp(reg.name, "esp") == 0) || (strcmp(reg.name, "sp") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_SP; else if ((strcmp(reg.name, "ebp") == 0) || (strcmp(reg.name, "fp") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FP; else if ((strcmp(reg.name, "eflags") == 0) || (strcmp(reg.name, "flags") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FLAGS; } break; case llvm::Triple::x86_64: for (auto ® : m_regs) { if ((strcmp(reg.name, "rip") == 0) || (strcmp(reg.name, "pc") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; else if ((strcmp(reg.name, "rsp") == 0) || (strcmp(reg.name, "sp") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_SP; else if ((strcmp(reg.name, "rbp") == 0) || (strcmp(reg.name, "fp") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FP; else if ((strcmp(reg.name, "rflags") == 0) || (strcmp(reg.name, "flags") == 0)) reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_FLAGS; } break; default: break; } } }