Remove a breakpoint in the given module at the given PC in that module. No effect if the breakpoint was not set.
(&mut self, module: &Module, pc: ModulePC)
| 1116 | /// |
| 1117 | /// No effect if the breakpoint was not set. |
| 1118 | pub fn remove_breakpoint(&mut self, module: &Module, pc: ModulePC) -> Result<()> { |
| 1119 | let requested_key = BreakpointKey::from_raw(module, pc); |
| 1120 | let actual_key = self |
| 1121 | .state |
| 1122 | .breakpoint_redirects |
| 1123 | .remove(&requested_key) |
| 1124 | .unwrap_or(requested_key); |
| 1125 | let actual_pc = actual_key.1; |
| 1126 | |
| 1127 | if let Some(refcount) = self.state.breakpoints.get_mut(&actual_key) { |
| 1128 | *refcount -= 1; |
| 1129 | if *refcount == 0 { |
| 1130 | self.state.breakpoints.remove(&actual_key); |
| 1131 | if !self.state.single_step { |
| 1132 | let mem = Self::get_code_memory( |
| 1133 | self.state, |
| 1134 | self.registry, |
| 1135 | &mut self.dirty_modules, |
| 1136 | module, |
| 1137 | )?; |
| 1138 | let frame_table = module |
| 1139 | .frame_table() |
| 1140 | .expect("Frame table must be present when guest-debug is enabled"); |
| 1141 | let patches = frame_table.lookup_breakpoint_patches_by_pc(actual_pc); |
| 1142 | Self::patch(patches, mem, false); |
| 1143 | } |
| 1144 | } |
| 1145 | } |
| 1146 | Ok(()) |
| 1147 | } |
| 1148 | |
| 1149 | fn apply_single_step<F: Fn(&BreakpointKey) -> bool>( |
| 1150 | mem: &mut CodeMemory, |
no test coverage detected