================ @@ -208,17 +297,92 @@ 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 backtrack 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 + 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}" + ) # Remove any trailing or expired leading breakpoints we just hit. self.debugger.delete_breakpoints(bp_to_delete) + debugger_next = False + debugger_out = False + if not debugger_continue and step_info.current_frame and step_info.frames: + while len(step_function_backtraces) > 0: + match_subtrace = False # Backtrace contains a target trace. + match_trace = False # Backtrace matches top of target stack. + if len(backtrace) >= len(step_function_backtraces[-1]): + match_subtrace = True + match_trace = len(backtrace) == len( + step_function_backtraces[-1] + ) + for i, f in enumerate(reversed(step_function_backtraces[-1])): + if backtrace[-1 - i] != f: + match_subtrace = False + match_trace = False + break ---------------- OCHyams wrote:
👍 also added a comment to hopefully make it clearer https://github.com/llvm/llvm-project/pull/152721 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits