Skip to content

Commit a82695c

Browse files
committed
Update debuginfo dexter stepping for new lldb behavior
dexter sets breakpoints on every source line in the file. Then it step-in's to every source line, and tests are written to expect that one step will move between lines, hitting the breakpoints that are set there. With this new algorithm, lldb will now step to the next source line, and be stopped at a breakpoint, but it has not yet hit the breakpoint. The stop reason will be "step-in completed". When you do "step-in" again, we will hit the breakpoint instruction, stop with a "breakpoint-hit" stop reason -- but the pc has not advanced. Then when you "step-in" again, we will move to the next source line. In short, lldb needs to step twice in a situation with breakpoints on every source line and stepping across them. This patch detects when lldb is behaving this way, and preserves the behavior the tests expect. It will step-in, and if we stop with a step-in stop reason and we are stopped at a breakpoint site, we will step once again to hit the breakpoint.
1 parent 48a0fc1 commit a82695c

File tree

1 file changed

+22
-0
lines changed
  • cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb

1 file changed

+22
-0
lines changed

cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,28 @@ def launch(self, cmdline):
206206

207207
def step(self):
208208
self._thread.StepInto()
209+
stop_reason = self._thread.GetStopReason()
210+
# If lldb has stepped to a breakpoint, but not
211+
# executed it yet, lldb used to report eStopReasonBreakpoint
212+
# even though the breakpoint hadn't been hit.
213+
# Now lldb will report eStopReasonPlanComplete for
214+
# the step completing, and when you step again, you will
215+
# hit the breakpoint at this location -- because you have
216+
# now actually executed the breakpoint instruction. This
217+
# means that stepping past a source line with a breakpoint
218+
# on the first instruction requires stepping twice. All of
219+
# the debuginfo tests assume that it will succed with a single
220+
# step. So we silently step again to hit the breakpoint, when
221+
# we've stopped at a breakpoint location but haven't hit it yet.
222+
if stop_reason == self._interface.eStopReasonPlanComplete:
223+
stepped_to_breakpoint = False
224+
pc = self._thread.GetFrameAtIndex(0).GetPC()
225+
for bp in self._target.breakpoints:
226+
for bploc in bp.locations:
227+
if bploc.GetAddress().GetLoadAddress(self._target) == pc:
228+
stepped_to_breakpoint = True
229+
if stepped_to_breakpoint:
230+
self._thread.StepInto()
209231

210232
def go(self) -> ReturnCode:
211233
self._process.Continue()

0 commit comments

Comments
 (0)