Skip to content

[LLDB][LoongArch] Extend the maximum number of watchpoints #126204

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
merged 1 commit into from
Feb 8, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@
#define REG_CONTEXT_SIZE \
(GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx))

// ptrace has a struct type user_watch_state, which was replaced by
// user_watch_state_v2 when more watchpoints were added, so this file
// may be built on systems with one or both in the system headers.
// The type below has the same layout as user_watch_state_v2 but will
// not clash with that name if it exists. We can use the v2 layout even
// on old kernels as we will only see 8 watchpoints and the kernel will
// truncate any extra data we send to it.
struct loongarch_user_watch_state {
uint64_t dbg_info;
struct {
uint64_t addr;
uint64_t mask;
uint32_t ctrl;
uint32_t pad;
} dbg_regs[14];
};

using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::process_linux;
Expand Down Expand Up @@ -539,7 +556,7 @@ llvm::Error NativeRegisterContextLinux_loongarch64::ReadHardwareDebugInfo() {

int regset = NT_LOONGARCH_HW_WATCH;
struct iovec ioVec;
struct user_watch_state dreg_state;
struct loongarch_user_watch_state dreg_state;
Status error;

ioVec.iov_base = &dreg_state;
Expand Down Expand Up @@ -567,7 +584,7 @@ llvm::Error NativeRegisterContextLinux_loongarch64::ReadHardwareDebugInfo() {
llvm::Error NativeRegisterContextLinux_loongarch64::WriteHardwareDebugRegs(
DREGType hwbType) {
struct iovec ioVec;
struct user_watch_state dreg_state;
struct loongarch_user_watch_state dreg_state;
int regset;

memset(&dreg_state, 0, sizeof(dreg_state));
Expand Down