|
50 | 50 | #define REG_CONTEXT_SIZE \ |
51 | 51 | (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx)) |
52 | 52 |
|
| 53 | +// ptrace has a struct type user_watch_state, which was replaced by |
| 54 | +// user_watch_state_v2 when more watchpoints were added, so this file |
| 55 | +// may be built on systems with one or both in the system headers. |
| 56 | +// The type below has the same layout as user_watch_state_v2 but will |
| 57 | +// not clash with that name if it exists. We can use the v2 layout even |
| 58 | +// on old kernels as we will only see 8 watchpoints and the kernel will |
| 59 | +// truncate any extra data we send to it. |
| 60 | +struct loongarch_user_watch_state { |
| 61 | + uint64_t dbg_info; |
| 62 | + struct { |
| 63 | + uint64_t addr; |
| 64 | + uint64_t mask; |
| 65 | + uint32_t ctrl; |
| 66 | + uint32_t pad; |
| 67 | + } dbg_regs[14]; |
| 68 | +}; |
| 69 | + |
53 | 70 | using namespace lldb; |
54 | 71 | using namespace lldb_private; |
55 | 72 | using namespace lldb_private::process_linux; |
@@ -539,7 +556,7 @@ llvm::Error NativeRegisterContextLinux_loongarch64::ReadHardwareDebugInfo() { |
539 | 556 |
|
540 | 557 | int regset = NT_LOONGARCH_HW_WATCH; |
541 | 558 | struct iovec ioVec; |
542 | | - struct user_watch_state dreg_state; |
| 559 | + struct loongarch_user_watch_state dreg_state; |
543 | 560 | Status error; |
544 | 561 |
|
545 | 562 | ioVec.iov_base = &dreg_state; |
@@ -567,7 +584,7 @@ llvm::Error NativeRegisterContextLinux_loongarch64::ReadHardwareDebugInfo() { |
567 | 584 | llvm::Error NativeRegisterContextLinux_loongarch64::WriteHardwareDebugRegs( |
568 | 585 | DREGType hwbType) { |
569 | 586 | struct iovec ioVec; |
570 | | - struct user_watch_state dreg_state; |
| 587 | + struct loongarch_user_watch_state dreg_state; |
571 | 588 | int regset; |
572 | 589 |
|
573 | 590 | memset(&dreg_state, 0, sizeof(dreg_state)); |
|
0 commit comments