LLDB  mainline
ABIAArch64.cpp
Go to the documentation of this file.
1 //===-- AArch66.h ---------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "ABIAArch64.h"
10 #include "ABIMacOSX_arm64.h"
11 #include "ABISysV_arm64.h"
14 #include "lldb/Target/Process.h"
15 
17 
18 void ABIAArch64::Initialize() {
21 }
22 
26 }
27 
29  if (lldb::ProcessSP process_sp = GetProcessSP())
30  return FixAddress(pc, process_sp->GetCodeAddressMask());
31  return pc;
32 }
33 
35  if (lldb::ProcessSP process_sp = GetProcessSP())
36  return FixAddress(pc, process_sp->GetDataAddressMask());
37  return pc;
38 }
39 
40 std::pair<uint32_t, uint32_t>
41 ABIAArch64::GetEHAndDWARFNums(llvm::StringRef name) {
42  if (name == "pc")
44  if (name == "cpsr")
46  return MCBasedABI::GetEHAndDWARFNums(name);
47 }
48 
50  MapRegisterName(reg, "v", "q");
51  MapRegisterName(reg, "x29", "fp");
52  MapRegisterName(reg, "x30", "lr");
53  return reg;
54 }
55 uint32_t ABIAArch64::GetGenericNum(llvm::StringRef name) {
56  return llvm::StringSwitch<uint32_t>(name)
57  .Case("pc", LLDB_REGNUM_GENERIC_PC)
58  .Case("lr", LLDB_REGNUM_GENERIC_RA)
59  .Case("sp", LLDB_REGNUM_GENERIC_SP)
60  .Case("fp", LLDB_REGNUM_GENERIC_FP)
61  .Case("cpsr", LLDB_REGNUM_GENERIC_FLAGS)
62  .Case("x0", LLDB_REGNUM_GENERIC_ARG1)
63  .Case("x1", LLDB_REGNUM_GENERIC_ARG2)
64  .Case("x2", LLDB_REGNUM_GENERIC_ARG3)
65  .Case("x3", LLDB_REGNUM_GENERIC_ARG4)
66  .Case("x4", LLDB_REGNUM_GENERIC_ARG5)
67  .Case("x5", LLDB_REGNUM_GENERIC_ARG6)
68  .Case("x6", LLDB_REGNUM_GENERIC_ARG7)
69  .Case("x7", LLDB_REGNUM_GENERIC_ARG8)
70  .Default(LLDB_INVALID_REGNUM);
71 }
LLDB_REGNUM_GENERIC_ARG2
#define LLDB_REGNUM_GENERIC_ARG2
Definition: lldb-defines.h:70
LLDB_REGNUM_GENERIC_ARG3
#define LLDB_REGNUM_GENERIC_ARG3
Definition: lldb-defines.h:72
LLDB_REGNUM_GENERIC_ARG1
#define LLDB_REGNUM_GENERIC_ARG1
Definition: lldb-defines.h:68
arm64_dwarf::pc
@ pc
Definition: ARM64_DWARF_Registers.h:52
LLDB_INVALID_REGNUM
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:91
ABIMacOSX_arm64.h
LLDB_REGNUM_GENERIC_ARG5
#define LLDB_REGNUM_GENERIC_ARG5
Definition: lldb-defines.h:76
ABIAArch64::Terminate
static void Terminate()
Definition: ABIAArch64.cpp:23
ABIAArch64::GetMCName
std::string GetMCName(std::string reg) override
For the given (capitalized) lldb register name, return the name of this register in the MCRegisterInf...
Definition: ABIAArch64.cpp:49
ABIAArch64::FixDataAddress
virtual lldb::addr_t FixDataAddress(lldb::addr_t pc) override
Definition: ABIAArch64.cpp:34
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
pc
@ pc
Definition: CompactUnwindInfo.cpp:1250
ABISysV_arm64::Initialize
static void Initialize()
Definition: ABISysV_arm64.cpp:840
LLDB_REGNUM_GENERIC_ARG6
#define LLDB_REGNUM_GENERIC_ARG6
Definition: lldb-defines.h:78
Process.h
ABISysV_arm64::Terminate
static void Terminate()
Definition: ABISysV_arm64.cpp:845
ABIAArch64.h
LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_REGNUM_GENERIC_FLAGS
Definition: lldb-defines.h:67
ABIAArch64::GetGenericNum
uint32_t GetGenericNum(llvm::StringRef name) override
Return the generic number of the given register.
Definition: ABIAArch64.cpp:55
arm64_dwarf::cpsr
@ cpsr
Definition: ARM64_DWARF_Registers.h:53
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:39
lldb_private::ABI::GetProcessSP
lldb::ProcessSP GetProcessSP() const
Request to get a Process shared pointer.
Definition: ABI.h:95
ABIAArch64
Definition: ABIAArch64.h:14
ARM64_DWARF_Registers.h
ABISysV_arm64.h
uint32_t
LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_SP
Definition: lldb-defines.h:64
PluginManager.h
LLDB_REGNUM_GENERIC_ARG4
#define LLDB_REGNUM_GENERIC_ARG4
Definition: lldb-defines.h:74
LLDB_REGNUM_GENERIC_FP
#define LLDB_REGNUM_GENERIC_FP
Definition: lldb-defines.h:65
LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:63
ABIAArch64::FixCodeAddress
virtual lldb::addr_t FixCodeAddress(lldb::addr_t pc) override
Some targets might use bits in a code address to indicate a mode switch.
Definition: ABIAArch64.cpp:28
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
ABIMacOSX_arm64::Terminate
static void Terminate()
Definition: ABIMacOSX_arm64.cpp:828
LLDB_REGNUM_GENERIC_ARG8
#define LLDB_REGNUM_GENERIC_ARG8
Definition: lldb-defines.h:82
LLDB_REGNUM_GENERIC_ARG7
#define LLDB_REGNUM_GENERIC_ARG7
Definition: lldb-defines.h:80
ABIAArch64::FixAddress
virtual lldb::addr_t FixAddress(lldb::addr_t pc, lldb::addr_t mask)
Definition: ABIAArch64.h:23
ABIMacOSX_arm64::Initialize
static void Initialize()
Definition: ABIMacOSX_arm64.cpp:823
ABIAArch64::GetEHAndDWARFNums
std::pair< uint32_t, uint32_t > GetEHAndDWARFNums(llvm::StringRef name) override
Return eh_frame and dwarf numbers for the given register.
Definition: ABIAArch64.cpp:41
lldb_private::MCBasedABI::MapRegisterName
static void MapRegisterName(std::string &reg, llvm::StringRef from_prefix, llvm::StringRef to_prefix)
If the register name is of the form "<from_prefix>[<number>]" then change the name to "<to_prefix>[<n...
Definition: ABI.cpp:265
LLDB_REGNUM_GENERIC_RA
#define LLDB_REGNUM_GENERIC_RA
Definition: lldb-defines.h:66