File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -825,12 +825,26 @@ impl Qemu {
825825 }
826826
827827 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+
828835 unsafe {
829836 libafl_qemu_set_breakpoint ( addr. into ( ) ) ;
830837 }
831838 }
832839
833840 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+
834848 unsafe {
835849 libafl_qemu_remove_breakpoint ( addr. into ( ) ) ;
836850 }
You can’t perform that action at this time.
0 commit comments