================
@@ -141,3 +143,18 @@ bool
ArchitectureAArch64::ReconfigureRegisterInfo(DynamicRegisterInfo ®_info,
return true;
}
+
+bool ArchitectureAArch64::IsValidBreakpointInstruction(
+ llvm::ArrayRef<uint8_t> reference, llvm::ArrayRef<uint8_t> observed) const
{
+ if (reference.size() < 4 || observed.size() < 4)
+ return false;
+ auto ref_bytes = llvm::support::endian::read32le(reference.data());
+ auto bytes = llvm::support::endian::read32le(observed.data());
+ // Only the 11 highest bits define the breakpoint, the others include an
+ // immediate which is stored to a CPU register.
+ uint32_t mask = 0xFFE00000;
+ // Check that the masked bytes match the reference, but also check that the
+ // immediate in the instruction is the default output by llvm.debugtrap
+ // The reference has the immediate set as all-zero, so mask and check here
+ return (ref_bytes == (bytes & mask)) && ((bytes & ~mask) >> 5 == 0xF000);
----------------
DuncanMcBain wrote:
Yes, that was what I found. I previously was more greedy and matched regardless
of the immediate but this breaks a lot of the sanitzer tools (which was a
surprise to me, but actually just makes sense).
https://github.com/llvm/llvm-project/pull/174348
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits