================
@@ -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())
----------------
DavidSpickett wrote:

And we have to assume that all break encodings smaller than the usual encoding 
size are not themselves subsets of the larger encodings. For example if we had 
a compressed encoding AB, there should not be a larger instruction encoding 
ABCD.

This is probably the case because it would make decoding easier. And I think 
RSICV has a way in the first byte to indicate compressed, as an example of that.

Even if it isn't the case on some architecture, we could say if the observed is 
not the same size as the reference, it cannot be a breakpoint. That would skip 
anything like the ABCD.

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