[llvm] [Dexter] Implement DexStepFunction and DexContinue (PR #152721)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 29 05:02:18 PDT 2025
================
@@ -208,17 +294,96 @@ def _run_debugger_custom(self, cmdline):
exit_desired = True
bp_to_delete.append(bp_id)
del self._leading_bp_handles[bp_id]
- # Add a range of trailing breakpoints covering the lines
- # requested in the DexLimitSteps command. Ignore first line as
- # that's covered by the leading bp we just hit and include the
- # final line.
- for line in range(bpr.range_from + 1, bpr.range_to + 1):
- self.debugger.add_breakpoint(bpr.path, line)
+
+ if bpr.function is not None:
+ if step_info.frames:
+ # Add this backtrace to the stack. While the current
+ # backtrace matches the top of the stack we'll step,
+ # and while there's a backtrace in the stack that
+ # is a subset of the current backtrace we'll step-out.
+ if (
+ len(step_function_backtraces) == 0
+ or backtrace != step_function_backtraces[-1]
+ ):
+ step_function_backtraces.append(backtrace)
+
+ # Add an address breakpoint so we don't fall out
+ # the end of nested DexStepFunctions with a DexContinue.
+ addr = self.debugger.get_pc(frame_idx=1)
+ instr_id = self.debugger.add_instruction_breakpoint(addr)
+ # Note the breakpoint so we don't log the source location
+ # it in the trace later.
+ self.instr_bp_ids.add(instr_id)
+
+ elif bpr.is_continue:
+ debugger_continue = True
+ if bpr.range_to is not None:
+ self.debugger.add_breakpoint(bpr.path, bpr.range_to)
+
+ else:
+ # Add a range of trailing breakpoints covering the lines
+ # requested in the DexLimitSteps command. Ignore first line as
+ # that's covered by the leading bp we just hit and include the
+ # final line.
+ for line in range(bpr.range_from + 1, bpr.range_to + 1):
+ id = self.debugger.add_breakpoint(bpr.path, line)
+ self.context.logger.warning(
+ f"Set trailing breakpoint {id} at {line}"
+ )
----------------
OCHyams wrote:
```suggestion
for line in range(bpr.range_from + 1, bpr.range_to + 1):
id = self.debugger.add_breakpoint(bpr.path, line)
```
https://github.com/llvm/llvm-project/pull/152721
More information about the llvm-commits
mailing list