Skip to content

🍒/ganymede/870a58a75889+9a62b7242aea+ec6815a72dfc+39047f6c2e5e #2424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ static uint32_t LoHi[16] = {0};
#define MNEMONIC_STRING_SIZE 32
#define OPERAND_STRING_SIZE 128

#if !defined(__arm64__) && !defined(__aarch64__)
// Returns true if the first 16 bit opcode of a thumb instruction indicates
// the instruction will be a 32 bit thumb opcode
static bool IsThumb32Opcode(uint16_t opcode) {
if (((opcode & 0xE000) == 0xE000) && (opcode & 0x1800))
return true;
return false;
}
#endif

void DNBArchMachARM::Initialize() {
DNBArchPluginInfo arch_plugin_info = {
Expand Down Expand Up @@ -315,6 +317,7 @@ kern_return_t DNBArchMachARM::GetEXCState(bool force) {
return kret;
}

#if 0
static void DumpDBGState(const DNBArchMachARM::DBG &dbg) {
uint32_t i = 0;
for (i = 0; i < 16; i++) {
Expand All @@ -324,6 +327,7 @@ static void DumpDBGState(const DNBArchMachARM::DBG &dbg) {
dbg.__wcr[i]);
}
}
#endif

kern_return_t DNBArchMachARM::GetDBGState(bool force) {
int set = e_regSetDBG;
Expand Down Expand Up @@ -643,8 +647,8 @@ bool DNBArchMachARM::NotifyException(MachException::Data &exc) {
"watchpoint %d was hit on address "
"0x%llx",
hw_index, (uint64_t)addr);
const int num_watchpoints = NumSupportedHardwareWatchpoints();
for (int i = 0; i < num_watchpoints; i++) {
const uint32_t num_watchpoints = NumSupportedHardwareWatchpoints();
for (uint32_t i = 0; i < num_watchpoints; i++) {
if (LoHi[i] != 0 && LoHi[i] == hw_index && LoHi[i] != i &&
GetWatchpointAddressByIndex(i) != INVALID_NUB_ADDRESS) {
addr = GetWatchpointAddressByIndex(i);
Expand Down Expand Up @@ -1758,13 +1762,13 @@ const DNBRegisterInfo DNBArchMachARM::g_vfp_registers[] = {
const DNBRegisterInfo DNBArchMachARM::g_exc_registers[] = {
{e_regSetVFP, exc_exception, "exception", NULL, Uint, Hex, 4,
EXC_OFFSET(exception), INVALID_NUB_REGNUM, INVALID_NUB_REGNUM,
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM},
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, NULL, NULL},
{e_regSetVFP, exc_fsr, "fsr", NULL, Uint, Hex, 4, EXC_OFFSET(fsr),
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM,
INVALID_NUB_REGNUM},
INVALID_NUB_REGNUM, NULL, NULL},
{e_regSetVFP, exc_far, "far", NULL, Uint, Hex, 4, EXC_OFFSET(far),
INVALID_NUB_REGNUM, INVALID_NUB_REGNUM, INVALID_NUB_REGNUM,
INVALID_NUB_REGNUM}};
INVALID_NUB_REGNUM, NULL, NULL}};

// Number of registers in each register set
const size_t DNBArchMachARM::k_num_gpr_registers =
Expand Down
65 changes: 32 additions & 33 deletions lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,49 +44,48 @@ class DNBArchMachARM : public DNBArchProtocol {
static void Initialize();
static const DNBRegisterSetInfo *GetRegisterSetInfo(nub_size_t *num_reg_sets);

virtual bool GetRegisterValue(uint32_t set, uint32_t reg,
DNBRegisterValue *value);
virtual bool SetRegisterValue(uint32_t set, uint32_t reg,
const DNBRegisterValue *value);
virtual nub_size_t GetRegisterContext(void *buf, nub_size_t buf_len);
virtual nub_size_t SetRegisterContext(const void *buf, nub_size_t buf_len);
virtual uint32_t SaveRegisterState();
virtual bool RestoreRegisterState(uint32_t save_id);

virtual kern_return_t GetRegisterState(int set, bool force);
virtual kern_return_t SetRegisterState(int set);
virtual bool RegisterSetStateIsValid(int set) const;

virtual uint64_t GetPC(uint64_t failValue); // Get program counter
virtual kern_return_t SetPC(uint64_t value);
virtual uint64_t GetSP(uint64_t failValue); // Get stack pointer
virtual void ThreadWillResume();
virtual bool ThreadDidStop();
virtual bool NotifyException(MachException::Data &exc);
bool GetRegisterValue(uint32_t set, uint32_t reg,
DNBRegisterValue *value) override;
bool SetRegisterValue(uint32_t set, uint32_t reg,
const DNBRegisterValue *value) override;
nub_size_t GetRegisterContext(void *buf, nub_size_t buf_len) override;
nub_size_t SetRegisterContext(const void *buf, nub_size_t buf_len) override;
uint32_t SaveRegisterState() override;
bool RestoreRegisterState(uint32_t save_id) override;

kern_return_t GetRegisterState(int set, bool force) override;
kern_return_t SetRegisterState(int set) override;
bool RegisterSetStateIsValid(int set) const override;

uint64_t GetPC(uint64_t failValue) override; // Get program counter
kern_return_t SetPC(uint64_t value) override;
uint64_t GetSP(uint64_t failValue) override; // Get stack pointer
void ThreadWillResume() override;
bool ThreadDidStop() override;
bool NotifyException(MachException::Data &exc) override;

static DNBArchProtocol *Create(MachThread *thread);
static const uint8_t *SoftwareBreakpointOpcode(nub_size_t byte_size);
static uint32_t GetCPUType();

virtual uint32_t NumSupportedHardwareBreakpoints();
virtual uint32_t NumSupportedHardwareWatchpoints();
virtual uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size,
bool also_set_on_task);
virtual bool DisableHardwareBreakpoint(uint32_t hw_break_index,
bool also_set_on_task);

virtual uint32_t EnableHardwareWatchpoint(nub_addr_t addr, nub_size_t size,
bool read, bool write,
bool also_set_on_task);
virtual bool DisableHardwareWatchpoint(uint32_t hw_break_index,
bool also_set_on_task);
uint32_t NumSupportedHardwareBreakpoints() override;
uint32_t NumSupportedHardwareWatchpoints() override;
uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size,
bool also_set_on_task) override;
bool DisableHardwareBreakpoint(uint32_t hw_break_index,
bool also_set_on_task) override;

uint32_t EnableHardwareWatchpoint(nub_addr_t addr, nub_size_t size, bool read,
bool write, bool also_set_on_task) override;
bool DisableHardwareWatchpoint(uint32_t hw_break_index,
bool also_set_on_task) override;
virtual bool DisableHardwareWatchpoint_helper(uint32_t hw_break_index,
bool also_set_on_task);
virtual bool ReenableHardwareWatchpoint(uint32_t hw_break_index);
virtual bool ReenableHardwareWatchpoint_helper(uint32_t hw_break_index);

virtual bool StepNotComplete();
virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr);
virtual bool StepNotComplete() override;
uint32_t GetHardwareWatchpointHit(nub_addr_t &addr) override;

#if defined(ARM_DEBUG_STATE32) && (defined(__arm64__) || defined(__aarch64__))
typedef arm_debug_state32_t DBG;
Expand Down
67 changes: 33 additions & 34 deletions lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,44 +40,43 @@ class DNBArchMachARM64 : public DNBArchProtocol {
static void Initialize();
static const DNBRegisterSetInfo *GetRegisterSetInfo(nub_size_t *num_reg_sets);

virtual bool GetRegisterValue(uint32_t set, uint32_t reg,
DNBRegisterValue *value);
virtual bool SetRegisterValue(uint32_t set, uint32_t reg,
const DNBRegisterValue *value);
virtual nub_size_t GetRegisterContext(void *buf, nub_size_t buf_len);
virtual nub_size_t SetRegisterContext(const void *buf, nub_size_t buf_len);
virtual uint32_t SaveRegisterState();
virtual bool RestoreRegisterState(uint32_t save_id);

virtual kern_return_t GetRegisterState(int set, bool force);
virtual kern_return_t SetRegisterState(int set);
virtual bool RegisterSetStateIsValid(int set) const;

virtual uint64_t GetPC(uint64_t failValue); // Get program counter
virtual kern_return_t SetPC(uint64_t value);
virtual uint64_t GetSP(uint64_t failValue); // Get stack pointer
virtual void ThreadWillResume();
virtual bool ThreadDidStop();
virtual bool NotifyException(MachException::Data &exc);
bool GetRegisterValue(uint32_t set, uint32_t reg,
DNBRegisterValue *value) override;
bool SetRegisterValue(uint32_t set, uint32_t reg,
const DNBRegisterValue *value) override;
nub_size_t GetRegisterContext(void *buf, nub_size_t buf_len) override;
nub_size_t SetRegisterContext(const void *buf, nub_size_t buf_len) override;
uint32_t SaveRegisterState() override;
bool RestoreRegisterState(uint32_t save_id) override;

kern_return_t GetRegisterState(int set, bool force) override;
kern_return_t SetRegisterState(int set) override;
bool RegisterSetStateIsValid(int set) const override;

uint64_t GetPC(uint64_t failValue) override; // Get program counter
kern_return_t SetPC(uint64_t value) override;
uint64_t GetSP(uint64_t failValue) override; // Get stack pointer
void ThreadWillResume() override;
bool ThreadDidStop() override;
bool NotifyException(MachException::Data &exc) override;

static DNBArchProtocol *Create(MachThread *thread);
static const uint8_t *SoftwareBreakpointOpcode(nub_size_t byte_size);
static uint32_t GetCPUType();

virtual uint32_t NumSupportedHardwareBreakpoints();
virtual uint32_t NumSupportedHardwareWatchpoints();

virtual uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size,
bool also_set_on_task);
virtual bool DisableHardwareBreakpoint(uint32_t hw_break_index,
bool also_set_on_task);
virtual uint32_t EnableHardwareWatchpoint(nub_addr_t addr, nub_size_t size,
bool read, bool write,
bool also_set_on_task);
virtual bool DisableHardwareWatchpoint(uint32_t hw_break_index,
bool also_set_on_task);
virtual bool DisableHardwareWatchpoint_helper(uint32_t hw_break_index,
bool also_set_on_task);
uint32_t NumSupportedHardwareBreakpoints() override;
uint32_t NumSupportedHardwareWatchpoints() override;

uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size,
bool also_set_on_task) override;
bool DisableHardwareBreakpoint(uint32_t hw_break_index,
bool also_set_on_task) override;
uint32_t EnableHardwareWatchpoint(nub_addr_t addr, nub_size_t size, bool read,
bool write, bool also_set_on_task) override;
bool DisableHardwareWatchpoint(uint32_t hw_break_index,
bool also_set_on_task) override;
bool DisableHardwareWatchpoint_helper(uint32_t hw_break_index,
bool also_set_on_task);

protected:
kern_return_t EnableHardwareSingleStep(bool enable);
Expand Down Expand Up @@ -220,7 +219,7 @@ class DNBArchMachARM64 : public DNBArchProtocol {
nub_addr_t GetWatchAddress(const DBG &debug_state, uint32_t hw_index);
virtual bool ReenableHardwareWatchpoint(uint32_t hw_break_index);
virtual bool ReenableHardwareWatchpoint_helper(uint32_t hw_break_index);
virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr);
uint32_t GetHardwareWatchpointHit(nub_addr_t &addr) override;

class disabled_watchpoint {
public:
Expand Down