================
@@ -141,3 +143,18 @@ bool 
ArchitectureAArch64::ReconfigureRegisterInfo(DynamicRegisterInfo &reg_info,
 
   return true;
 }
+
+bool ArchitectureAArch64::IsValidTrapInstruction(
+    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 instruction, the others
+  // include an immediate value that we will explicitly check against.
+  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
----------------
DavidSpickett wrote:

I mentioned earlier the gettrapbytes whatever it was called, needs to document 
this part. 

I agree with the way you've implemented it, just needs to be made obvious.

https://github.com/llvm/llvm-project/pull/174348
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to