================
@@ -138,6 +138,17 @@ class Architecture : public PluginInterface {
       std::shared_ptr<const UnwindPlan> current_unwindplan) {
     return lldb::UnwindPlanSP();
   }
+
+  /// Returns whether a given byte sequence is a valid breakpoint for the
+  /// architecture. Some architectures have breakpoint instructions that
+  /// have immediates that can take on any value, resulting in a family
+  /// of valid byte sequences. Bases the size comparison on the reference.
+  virtual bool IsValidBreakpointInstruction(llvm::ArrayRef<uint8_t> reference,
+                                            llvm::ArrayRef<uint8_t> observed) 
const {
+    if (reference.size() > observed.size())
----------------
DuncanMcBain wrote:

The intent here is to make sure that one way or another, I don't run off the 
end of either array. Logically in my head I expect that if we have matched the 
correct instruction, the size check doesn't matter, and if we are unable to 
read as many bytes as are in the reference sequence then they don't match.

I think in general the handling around this is a little bit unsatisfying - the 
code as it exists seems to expect that if the small encoding is available for a 
platform, it *will* be used. It is possible that, where different encodings are 
possible for an architecture, we should just check all of them in turn.

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