This repository was archived by the owner on Nov 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
src/agent/coverage/src/record Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -43,17 +43,22 @@ impl<'data> LinuxRecorder<'data> {
4343 tracee : & mut Tracee ,
4444 ) -> Result < ( ) > {
4545 let regs = tracee. registers ( ) ?;
46- let addr = Address ( regs. rip ) ;
4746
48- if let Some ( image) = context. find_image_for_addr ( addr) {
47+ #[ cfg( target_arch = "x86_64" ) ]
48+ let instruction_pointer = Address ( regs. rip ) ;
49+
50+ #[ cfg( target_arch = "aarch64" ) ]
51+ let instruction_pointer = Address ( regs. pc ) ;
52+
53+ if let Some ( image) = context. find_image_for_addr ( instruction_pointer) {
4954 if let Some ( coverage) = self . coverage . modules . get_mut ( image. path ( ) ) {
50- let offset = addr . offset_from ( image. base ( ) ) ?;
55+ let offset = instruction_pointer . offset_from ( image. base ( ) ) ?;
5156 coverage. increment ( offset) ;
5257 } else {
5358 bail ! ( "coverage not initialized for module {}" , image. path( ) ) ;
5459 }
5560 } else {
56- bail ! ( "no image for addr: {addr :x}" ) ;
61+ bail ! ( "no image for addr: {instruction_pointer :x}" ) ;
5762 }
5863
5964 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -131,16 +131,22 @@ impl<'eh> Debugger<'eh> {
131131 fn restore_and_call_if_breakpoint ( & mut self , tracee : & mut Tracee ) -> Result < ( ) > {
132132 let mut regs = tracee. registers ( ) ?;
133133
134+ #[ cfg( target_arch = "x86_64" ) ]
135+ let instruction_pointer = & mut regs. rip ;
136+
137+ #[ cfg( target_arch = "aarch64" ) ]
138+ let instruction_pointer = & mut regs. pc ;
139+
134140 // Compute what the last PC would have been _if_ we stopped due to a soft breakpoint.
135141 //
136142 // If we don't have a registered breakpoint, then we will not use this value.
137- let pc = Address ( regs . rip . saturating_sub ( 1 ) ) ;
143+ let pc = Address ( instruction_pointer . saturating_sub ( 1 ) ) ;
138144
139145 if self . context . breakpoints . clear ( tracee, pc) ? {
140146 // We restored the original, `int3`-clobbered instruction in `clear()`. Now
141147 // set the tracee's registers to execute it on restart. Do this _before_ the
142148 // callback to simulate a hardware breakpoint.
143- regs . rip = pc. 0 ;
149+ * instruction_pointer = pc. 0 ;
144150 tracee. set_registers ( regs) ?;
145151
146152 self . event_handler
You can’t perform that action at this time.
0 commit comments