File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -825,12 +825,26 @@ impl Qemu {
825
825
}
826
826
827
827
pub fn set_breakpoint ( & self , addr : GuestAddr ) {
828
+ // Remove thumb bit encoded in addresses.
829
+ // Since ARMv7, instructions are (half-)word aligned, so this is safe.
830
+ // For ARMv6 and before, this could be wrong since SCTLR.U could be 0.
831
+ // TODO: check precisely for architecture before doing this.
832
+ #[ cfg( target_arch = "arm" ) ]
833
+ let addr = { addr & !1 } ;
834
+
828
835
unsafe {
829
836
libafl_qemu_set_breakpoint ( addr. into ( ) ) ;
830
837
}
831
838
}
832
839
833
840
pub fn remove_breakpoint ( & self , addr : GuestAddr ) {
841
+ // Remove thumb bit encoded in addresses.
842
+ // Since ARMv7, instructions are (half-)word aligned, so this is safe.
843
+ // For ARMv6 and before, this could be wrong since SCTLR.U could be 0.
844
+ // TODO: check precisely for architecture before doing this.
845
+ #[ cfg( target_arch = "arm" ) ]
846
+ let addr = { addr & !1 } ;
847
+
834
848
unsafe {
835
849
libafl_qemu_remove_breakpoint ( addr. into ( ) ) ;
836
850
}
You can’t perform that action at this time.
0 commit comments