forked from OSchip/llvm-project
Use LLDB_LOG in NativeRegisterContextLinux*** files
llvm-svn: 294023
This commit is contained in:
parent
c3e3f59d12
commit
ea1b6b17dc
|
@ -171,10 +171,7 @@ Error NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset,
|
||||||
// First cast to an unsigned of the same size to avoid sign extension.
|
// First cast to an unsigned of the same size to avoid sign extension.
|
||||||
value.SetUInt(static_cast<unsigned long>(data), size);
|
value.SetUInt(static_cast<unsigned long>(data), size);
|
||||||
|
|
||||||
if (log)
|
LLDB_LOG(log, "{0}: {1:x}", reg_name, data);
|
||||||
log->Printf("NativeRegisterContextLinux::%s() reg %s: 0x%lx", __FUNCTION__,
|
|
||||||
reg_name, data);
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,10 +180,7 @@ Error NativeRegisterContextLinux::DoWriteRegisterValue(
|
||||||
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS));
|
||||||
|
|
||||||
void *buf = reinterpret_cast<void *>(value.GetAsUInt64());
|
void *buf = reinterpret_cast<void *>(value.GetAsUInt64());
|
||||||
|
LLDB_LOG(log, "{0}: {1}", reg_name, buf);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux::%s() reg %s: %p", __FUNCTION__,
|
|
||||||
reg_name, buf);
|
|
||||||
|
|
||||||
return NativeProcessLinux::PtraceWrapper(
|
return NativeProcessLinux::PtraceWrapper(
|
||||||
PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
|
PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "lldb/Utility/Error.h"
|
#include "lldb/Utility/Error.h"
|
||||||
|
|
||||||
#include "Plugins/Process/Linux/Procfs.h"
|
#include "Plugins/Process/Linux/Procfs.h"
|
||||||
|
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
|
||||||
#include "Plugins/Process/Utility/RegisterContextLinux_arm.h"
|
#include "Plugins/Process/Utility/RegisterContextLinux_arm.h"
|
||||||
|
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
|
@ -356,15 +357,11 @@ bool NativeRegisterContextLinux_arm::IsFPR(unsigned reg) const {
|
||||||
uint32_t
|
uint32_t
|
||||||
NativeRegisterContextLinux_arm::SetHardwareBreakpoint(lldb::addr_t addr,
|
NativeRegisterContextLinux_arm::SetHardwareBreakpoint(lldb::addr_t addr,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return LLDB_INVALID_INDEX32;
|
return LLDB_INVALID_INDEX32;
|
||||||
|
@ -429,10 +426,8 @@ NativeRegisterContextLinux_arm::SetHardwareBreakpoint(lldb::addr_t addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NativeRegisterContextLinux_arm::ClearHardwareBreakpoint(uint32_t hw_idx) {
|
bool NativeRegisterContextLinux_arm::ClearHardwareBreakpoint(uint32_t hw_idx) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "hw_idx: {0}", hw_idx);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
|
|
||||||
|
@ -477,33 +472,26 @@ bool NativeRegisterContextLinux_arm::ClearHardwareBreakpoint(uint32_t hw_idx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareWatchpoints() {
|
uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareWatchpoints() {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
LLDB_LOG(log, "{0}", m_max_hwp_supported);
|
||||||
return m_max_hwp_supported;
|
return m_max_hwp_supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t NativeRegisterContextLinux_arm::SetHardwareWatchpoint(
|
uint32_t NativeRegisterContextLinux_arm::SetHardwareWatchpoint(
|
||||||
lldb::addr_t addr, size_t size, uint32_t watch_flags) {
|
lldb::addr_t addr, size_t size, uint32_t watch_flags) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size,
|
||||||
if (log)
|
watch_flags);
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return LLDB_INVALID_INDEX32;
|
return LLDB_INVALID_INDEX32;
|
||||||
|
@ -603,15 +591,11 @@ uint32_t NativeRegisterContextLinux_arm::SetHardwareWatchpoint(
|
||||||
|
|
||||||
bool NativeRegisterContextLinux_arm::ClearHardwareWatchpoint(
|
bool NativeRegisterContextLinux_arm::ClearHardwareWatchpoint(
|
||||||
uint32_t wp_index) {
|
uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return false;
|
return false;
|
||||||
|
@ -641,15 +625,8 @@ bool NativeRegisterContextLinux_arm::ClearHardwareWatchpoint(
|
||||||
}
|
}
|
||||||
|
|
||||||
Error NativeRegisterContextLinux_arm::ClearAllHardwareWatchpoints() {
|
Error NativeRegisterContextLinux_arm::ClearAllHardwareWatchpoints() {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
|
||||||
|
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return error;
|
return error;
|
||||||
|
@ -683,10 +660,8 @@ Error NativeRegisterContextLinux_arm::ClearAllHardwareWatchpoints() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t NativeRegisterContextLinux_arm::GetWatchpointSize(uint32_t wp_index) {
|
uint32_t NativeRegisterContextLinux_arm::GetWatchpointSize(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
switch ((m_hwp_regs[wp_index].control >> 5) & 0x0f) {
|
switch ((m_hwp_regs[wp_index].control >> 5) & 0x0f) {
|
||||||
case 0x01:
|
case 0x01:
|
||||||
|
@ -702,10 +677,8 @@ uint32_t NativeRegisterContextLinux_arm::GetWatchpointSize(uint32_t wp_index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool NativeRegisterContextLinux_arm::WatchpointIsEnabled(uint32_t wp_index) {
|
bool NativeRegisterContextLinux_arm::WatchpointIsEnabled(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
if ((m_hwp_regs[wp_index].control & 0x1) == 0x1)
|
if ((m_hwp_regs[wp_index].control & 0x1) == 0x1)
|
||||||
return true;
|
return true;
|
||||||
|
@ -715,10 +688,8 @@ bool NativeRegisterContextLinux_arm::WatchpointIsEnabled(uint32_t wp_index) {
|
||||||
|
|
||||||
Error NativeRegisterContextLinux_arm::GetWatchpointHitIndex(
|
Error NativeRegisterContextLinux_arm::GetWatchpointHitIndex(
|
||||||
uint32_t &wp_index, lldb::addr_t trap_addr) {
|
uint32_t &wp_index, lldb::addr_t trap_addr) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
uint32_t watch_size;
|
uint32_t watch_size;
|
||||||
lldb::addr_t watch_addr;
|
lldb::addr_t watch_addr;
|
||||||
|
@ -740,10 +711,8 @@ Error NativeRegisterContextLinux_arm::GetWatchpointHitIndex(
|
||||||
|
|
||||||
lldb::addr_t
|
lldb::addr_t
|
||||||
NativeRegisterContextLinux_arm::GetWatchpointAddress(uint32_t wp_index) {
|
NativeRegisterContextLinux_arm::GetWatchpointAddress(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
if (wp_index >= m_max_hwp_supported)
|
if (wp_index >= m_max_hwp_supported)
|
||||||
return LLDB_INVALID_ADDRESS;
|
return LLDB_INVALID_ADDRESS;
|
||||||
|
@ -756,10 +725,8 @@ NativeRegisterContextLinux_arm::GetWatchpointAddress(uint32_t wp_index) {
|
||||||
|
|
||||||
lldb::addr_t
|
lldb::addr_t
|
||||||
NativeRegisterContextLinux_arm::GetWatchpointHitAddress(uint32_t wp_index) {
|
NativeRegisterContextLinux_arm::GetWatchpointHitAddress(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
if (wp_index >= m_max_hwp_supported)
|
if (wp_index >= m_max_hwp_supported)
|
||||||
return LLDB_INVALID_ADDRESS;
|
return LLDB_INVALID_ADDRESS;
|
||||||
|
|
|
@ -116,7 +116,6 @@ NativeRegisterContextLinux *
|
||||||
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
|
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
|
||||||
const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
|
const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
|
||||||
uint32_t concrete_frame_idx) {
|
uint32_t concrete_frame_idx) {
|
||||||
Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS);
|
|
||||||
switch (target_arch.GetMachine()) {
|
switch (target_arch.GetMachine()) {
|
||||||
case llvm::Triple::arm:
|
case llvm::Triple::arm:
|
||||||
return new NativeRegisterContextLinux_arm(target_arch, native_thread,
|
return new NativeRegisterContextLinux_arm(target_arch, native_thread,
|
||||||
|
@ -125,12 +124,7 @@ NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
|
||||||
return new NativeRegisterContextLinux_arm64(target_arch, native_thread,
|
return new NativeRegisterContextLinux_arm64(target_arch, native_thread,
|
||||||
concrete_frame_idx);
|
concrete_frame_idx);
|
||||||
default:
|
default:
|
||||||
if (log)
|
llvm_unreachable("have no register context for architecture");
|
||||||
log->Printf("NativeRegisterContextLinux::%s() have no register context "
|
|
||||||
"for architecture: %s\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
target_arch.GetTriple().getArchName().str().c_str());
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +146,7 @@ NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
|
||||||
m_reg_info.gpr_flags = gpr_cpsr_arm64;
|
m_reg_info.gpr_flags = gpr_cpsr_arm64;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false && "Unhandled target architecture.");
|
llvm_unreachable("Unhandled target architecture.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,15 +363,11 @@ bool NativeRegisterContextLinux_arm64::IsFPR(unsigned reg) const {
|
||||||
uint32_t
|
uint32_t
|
||||||
NativeRegisterContextLinux_arm64::SetHardwareBreakpoint(lldb::addr_t addr,
|
NativeRegisterContextLinux_arm64::SetHardwareBreakpoint(lldb::addr_t addr,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return LLDB_INVALID_INDEX32;
|
return LLDB_INVALID_INDEX32;
|
||||||
|
@ -438,15 +428,11 @@ NativeRegisterContextLinux_arm64::SetHardwareBreakpoint(lldb::addr_t addr,
|
||||||
|
|
||||||
bool NativeRegisterContextLinux_arm64::ClearHardwareBreakpoint(
|
bool NativeRegisterContextLinux_arm64::ClearHardwareBreakpoint(
|
||||||
uint32_t hw_idx) {
|
uint32_t hw_idx) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "hw_idx: {0}", hw_idx);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return false;
|
return false;
|
||||||
|
@ -486,33 +472,26 @@ bool NativeRegisterContextLinux_arm64::ClearHardwareBreakpoint(
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t NativeRegisterContextLinux_arm64::NumSupportedHardwareWatchpoints() {
|
uint32_t NativeRegisterContextLinux_arm64::NumSupportedHardwareWatchpoints() {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
LLDB_LOG(log, "{0}", m_max_hwp_supported);
|
||||||
return m_max_hwp_supported;
|
return m_max_hwp_supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t NativeRegisterContextLinux_arm64::SetHardwareWatchpoint(
|
uint32_t NativeRegisterContextLinux_arm64::SetHardwareWatchpoint(
|
||||||
lldb::addr_t addr, size_t size, uint32_t watch_flags) {
|
lldb::addr_t addr, size_t size, uint32_t watch_flags) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size,
|
||||||
if (log)
|
watch_flags);
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return LLDB_INVALID_INDEX32;
|
return LLDB_INVALID_INDEX32;
|
||||||
|
@ -595,15 +574,11 @@ uint32_t NativeRegisterContextLinux_arm64::SetHardwareWatchpoint(
|
||||||
|
|
||||||
bool NativeRegisterContextLinux_arm64::ClearHardwareWatchpoint(
|
bool NativeRegisterContextLinux_arm64::ClearHardwareWatchpoint(
|
||||||
uint32_t wp_index) {
|
uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return false;
|
return false;
|
||||||
|
@ -633,15 +608,8 @@ bool NativeRegisterContextLinux_arm64::ClearHardwareWatchpoint(
|
||||||
}
|
}
|
||||||
|
|
||||||
Error NativeRegisterContextLinux_arm64::ClearAllHardwareWatchpoints() {
|
Error NativeRegisterContextLinux_arm64::ClearAllHardwareWatchpoints() {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
|
||||||
|
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
Error error;
|
|
||||||
|
|
||||||
// Read hardware breakpoint and watchpoint information.
|
// Read hardware breakpoint and watchpoint information.
|
||||||
error = ReadHardwareDebugInfo();
|
Error error = ReadHardwareDebugInfo();
|
||||||
|
|
||||||
if (error.Fail())
|
if (error.Fail())
|
||||||
return error;
|
return error;
|
||||||
|
@ -676,10 +644,9 @@ Error NativeRegisterContextLinux_arm64::ClearAllHardwareWatchpoints() {
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
NativeRegisterContextLinux_arm64::GetWatchpointSize(uint32_t wp_index) {
|
NativeRegisterContextLinux_arm64::GetWatchpointSize(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
|
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
switch ((m_hwp_regs[wp_index].control >> 5) & 0xff) {
|
switch ((m_hwp_regs[wp_index].control >> 5) & 0xff) {
|
||||||
case 0x01:
|
case 0x01:
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -694,10 +661,8 @@ NativeRegisterContextLinux_arm64::GetWatchpointSize(uint32_t wp_index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool NativeRegisterContextLinux_arm64::WatchpointIsEnabled(uint32_t wp_index) {
|
bool NativeRegisterContextLinux_arm64::WatchpointIsEnabled(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
if ((m_hwp_regs[wp_index].control & 0x1) == 0x1)
|
if ((m_hwp_regs[wp_index].control & 0x1) == 0x1)
|
||||||
return true;
|
return true;
|
||||||
|
@ -707,10 +672,8 @@ bool NativeRegisterContextLinux_arm64::WatchpointIsEnabled(uint32_t wp_index) {
|
||||||
|
|
||||||
Error NativeRegisterContextLinux_arm64::GetWatchpointHitIndex(
|
Error NativeRegisterContextLinux_arm64::GetWatchpointHitIndex(
|
||||||
uint32_t &wp_index, lldb::addr_t trap_addr) {
|
uint32_t &wp_index, lldb::addr_t trap_addr) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
uint32_t watch_size;
|
uint32_t watch_size;
|
||||||
lldb::addr_t watch_addr;
|
lldb::addr_t watch_addr;
|
||||||
|
@ -732,10 +695,8 @@ Error NativeRegisterContextLinux_arm64::GetWatchpointHitIndex(
|
||||||
|
|
||||||
lldb::addr_t
|
lldb::addr_t
|
||||||
NativeRegisterContextLinux_arm64::GetWatchpointAddress(uint32_t wp_index) {
|
NativeRegisterContextLinux_arm64::GetWatchpointAddress(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
if (wp_index >= m_max_hwp_supported)
|
if (wp_index >= m_max_hwp_supported)
|
||||||
return LLDB_INVALID_ADDRESS;
|
return LLDB_INVALID_ADDRESS;
|
||||||
|
@ -748,10 +709,8 @@ NativeRegisterContextLinux_arm64::GetWatchpointAddress(uint32_t wp_index) {
|
||||||
|
|
||||||
lldb::addr_t
|
lldb::addr_t
|
||||||
NativeRegisterContextLinux_arm64::GetWatchpointHitAddress(uint32_t wp_index) {
|
NativeRegisterContextLinux_arm64::GetWatchpointHitAddress(uint32_t wp_index) {
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
|
LLDB_LOG(log, "wp_index: {0}", wp_index);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
|
|
||||||
|
|
||||||
if (wp_index >= m_max_hwp_supported)
|
if (wp_index >= m_max_hwp_supported)
|
||||||
return LLDB_INVALID_ADDRESS;
|
return LLDB_INVALID_ADDRESS;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
// Other libraries and framework includes
|
// Other libraries and framework includes
|
||||||
#include "Plugins/Process/Linux/NativeProcessLinux.h"
|
#include "Plugins/Process/Linux/NativeProcessLinux.h"
|
||||||
#include "Plugins/Process/Linux/Procfs.h"
|
#include "Plugins/Process/Linux/Procfs.h"
|
||||||
|
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
|
||||||
#include "Plugins/Process/Utility/RegisterContextLinux_mips.h"
|
#include "Plugins/Process/Utility/RegisterContextLinux_mips.h"
|
||||||
#include "Plugins/Process/Utility/RegisterContextLinux_mips64.h"
|
#include "Plugins/Process/Utility/RegisterContextLinux_mips64.h"
|
||||||
#include "lldb/Core/DataBufferHeap.h"
|
#include "lldb/Core/DataBufferHeap.h"
|
||||||
|
@ -314,12 +315,8 @@ lldb::addr_t NativeRegisterContextLinux_mips64::GetPCfromBreakpointLocation(
|
||||||
Error error;
|
Error error;
|
||||||
RegisterValue pc_value;
|
RegisterValue pc_value;
|
||||||
lldb::addr_t pc = fail_value;
|
lldb::addr_t pc = fail_value;
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
|
||||||
|
LLDB_LOG(log, "Reading PC from breakpoint location");
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_mips64::%s Reading PC from "
|
|
||||||
"breakpoint location",
|
|
||||||
__FUNCTION__);
|
|
||||||
|
|
||||||
// PC register is at index 34 of the register array
|
// PC register is at index 34 of the register array
|
||||||
const RegisterInfo *const pc_info_p = GetRegisterInfoAtIndex(gpr_pc_mips64);
|
const RegisterInfo *const pc_info_p = GetRegisterInfoAtIndex(gpr_pc_mips64);
|
||||||
|
@ -336,11 +333,7 @@ lldb::addr_t NativeRegisterContextLinux_mips64::GetPCfromBreakpointLocation(
|
||||||
ReadRegister(cause_info_p, cause_value);
|
ReadRegister(cause_info_p, cause_value);
|
||||||
|
|
||||||
uint64_t cause = cause_value.GetAsUInt64();
|
uint64_t cause = cause_value.GetAsUInt64();
|
||||||
|
LLDB_LOG(log, "PC {0:x} cause {1:x}", pc, cause);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_mips64::%s PC 0x%" PRIx64
|
|
||||||
" Cause 0x%" PRIx64,
|
|
||||||
__FUNCTION__, pc, cause);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The breakpoint might be in a delay slot. In this case PC points
|
* The breakpoint might be in a delay slot. In this case PC points
|
||||||
|
@ -355,10 +348,7 @@ lldb::addr_t NativeRegisterContextLinux_mips64::GetPCfromBreakpointLocation(
|
||||||
pc = pc + branch_delay;
|
pc = pc + branch_delay;
|
||||||
pc_value.SetUInt64(pc);
|
pc_value.SetUInt64(pc);
|
||||||
WriteRegister(pc_info_p, pc_value);
|
WriteRegister(pc_info_p, pc_value);
|
||||||
|
LLDB_LOG(log, "New PC {0:x}", pc);
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_mips64::%s New PC 0x%" PRIx64,
|
|
||||||
__FUNCTION__, pc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,11 +368,8 @@ NativeRegisterContextLinux_mips64::GetRegisterSet(uint32_t set_index) const {
|
||||||
case llvm::Triple::mipsel:
|
case llvm::Triple::mipsel:
|
||||||
return &g_reg_sets_mips[set_index];
|
return &g_reg_sets_mips[set_index];
|
||||||
default:
|
default:
|
||||||
assert(false && "Unhandled target architecture.");
|
llvm_unreachable("Unhandled target architecture.");
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lldb_private::Error
|
lldb_private::Error
|
||||||
|
@ -730,70 +717,64 @@ bool NativeRegisterContextLinux_mips64::IsFPR(uint32_t reg_index) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t GetWatchHi(struct pt_watch_regs *regs, uint32_t index) {
|
static uint32_t GetWatchHi(struct pt_watch_regs *regs, uint32_t index) {
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
if (regs->style == pt_watch_style_mips32)
|
if (regs->style == pt_watch_style_mips32)
|
||||||
return regs->mips32.watchhi[index];
|
return regs->mips32.watchhi[index];
|
||||||
else if (regs->style == pt_watch_style_mips64)
|
else if (regs->style == pt_watch_style_mips64)
|
||||||
return regs->mips64.watchhi[index];
|
return regs->mips64.watchhi[index];
|
||||||
if (log)
|
LLDB_LOG(log, "Invalid watch register style");
|
||||||
log->Printf("Invalid watch register style");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetWatchHi(struct pt_watch_regs *regs, uint32_t index,
|
static void SetWatchHi(struct pt_watch_regs *regs, uint32_t index,
|
||||||
uint16_t value) {
|
uint16_t value) {
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
if (regs->style == pt_watch_style_mips32)
|
if (regs->style == pt_watch_style_mips32)
|
||||||
regs->mips32.watchhi[index] = value;
|
regs->mips32.watchhi[index] = value;
|
||||||
else if (regs->style == pt_watch_style_mips64)
|
else if (regs->style == pt_watch_style_mips64)
|
||||||
regs->mips64.watchhi[index] = value;
|
regs->mips64.watchhi[index] = value;
|
||||||
if (log)
|
LLDB_LOG(log, "Invalid watch register style");
|
||||||
log->Printf("Invalid watch register style");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lldb::addr_t GetWatchLo(struct pt_watch_regs *regs, uint32_t index) {
|
static lldb::addr_t GetWatchLo(struct pt_watch_regs *regs, uint32_t index) {
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
if (regs->style == pt_watch_style_mips32)
|
if (regs->style == pt_watch_style_mips32)
|
||||||
return regs->mips32.watchlo[index];
|
return regs->mips32.watchlo[index];
|
||||||
else if (regs->style == pt_watch_style_mips64)
|
else if (regs->style == pt_watch_style_mips64)
|
||||||
return regs->mips64.watchlo[index];
|
return regs->mips64.watchlo[index];
|
||||||
if (log)
|
LLDB_LOG(log, "Invalid watch register style");
|
||||||
log->Printf("Invalid watch register style");
|
|
||||||
return LLDB_INVALID_ADDRESS;
|
return LLDB_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetWatchLo(struct pt_watch_regs *regs, uint32_t index,
|
static void SetWatchLo(struct pt_watch_regs *regs, uint32_t index,
|
||||||
uint64_t value) {
|
uint64_t value) {
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
if (regs->style == pt_watch_style_mips32)
|
if (regs->style == pt_watch_style_mips32)
|
||||||
regs->mips32.watchlo[index] = (uint32_t)value;
|
regs->mips32.watchlo[index] = (uint32_t)value;
|
||||||
else if (regs->style == pt_watch_style_mips64)
|
else if (regs->style == pt_watch_style_mips64)
|
||||||
regs->mips64.watchlo[index] = value;
|
regs->mips64.watchlo[index] = value;
|
||||||
if (log)
|
else
|
||||||
log->Printf("Invalid watch register style");
|
LLDB_LOG(log, "Invalid watch register style");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t GetIRWMask(struct pt_watch_regs *regs, uint32_t index) {
|
static uint32_t GetIRWMask(struct pt_watch_regs *regs, uint32_t index) {
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
if (regs->style == pt_watch_style_mips32)
|
if (regs->style == pt_watch_style_mips32)
|
||||||
return regs->mips32.watch_masks[index] & IRW;
|
return regs->mips32.watch_masks[index] & IRW;
|
||||||
else if (regs->style == pt_watch_style_mips64)
|
else if (regs->style == pt_watch_style_mips64)
|
||||||
return regs->mips64.watch_masks[index] & IRW;
|
return regs->mips64.watch_masks[index] & IRW;
|
||||||
if (log)
|
LLDB_LOG(log, "Invalid watch register style");
|
||||||
log->Printf("Invalid watch register style");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t GetRegMask(struct pt_watch_regs *regs, uint32_t index) {
|
static uint32_t GetRegMask(struct pt_watch_regs *regs, uint32_t index) {
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
if (regs->style == pt_watch_style_mips32)
|
if (regs->style == pt_watch_style_mips32)
|
||||||
return regs->mips32.watch_masks[index] & ~IRW;
|
return regs->mips32.watch_masks[index] & ~IRW;
|
||||||
else if (regs->style == pt_watch_style_mips64)
|
else if (regs->style == pt_watch_style_mips64)
|
||||||
return regs->mips64.watch_masks[index] & ~IRW;
|
return regs->mips64.watch_masks[index] & ~IRW;
|
||||||
if (log)
|
LLDB_LOG(log, "Invalid watch register style");
|
||||||
log->Printf("Invalid watch register style");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,7 +1098,7 @@ NativeRegisterContextLinux_mips64::GetWatchpointHitAddress(uint32_t wp_index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t NativeRegisterContextLinux_mips64::NumSupportedHardwareWatchpoints() {
|
uint32_t NativeRegisterContextLinux_mips64::NumSupportedHardwareWatchpoints() {
|
||||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
|
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
|
||||||
struct pt_watch_regs regs;
|
struct pt_watch_regs regs;
|
||||||
static int num_valid = 0;
|
static int num_valid = 0;
|
||||||
if (!num_valid) {
|
if (!num_valid) {
|
||||||
|
@ -1131,12 +1112,8 @@ uint32_t NativeRegisterContextLinux_mips64::NumSupportedHardwareWatchpoints() {
|
||||||
case pt_watch_style_mips64:
|
case pt_watch_style_mips64:
|
||||||
num_valid = regs.mips64.num_valid;
|
num_valid = regs.mips64.num_valid;
|
||||||
return num_valid;
|
return num_valid;
|
||||||
default:
|
|
||||||
if (log)
|
|
||||||
log->Printf("NativeRegisterContextLinux_mips64::%s Error: Unrecognized "
|
|
||||||
"watch register style",
|
|
||||||
__FUNCTION__);
|
|
||||||
}
|
}
|
||||||
|
LLDB_LOG(log, "Invalid watch register style");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return num_valid;
|
return num_valid;
|
||||||
|
|
Loading…
Reference in New Issue