Skip to content

Conversation

SLTozer
Copy link
Contributor

@SLTozer SLTozer commented Sep 2, 2025

Currently, Dexter's interface for lldb and lldb-dap has a post-step hook that checks to see whether lldb reports that we stopped because we completed a step, and if so checks to see whether the current $pc address also matches a known breakpoint whose conditions (if any) are met, and if so it requests to "step in", so that we "resume" execution, stopping again at the current address, such that lldb now reports that we have hit a breakpoint and provides the list of breakpoints that were hit.

This logic has a flaw however: the call to "step in" sets an implicit breakpoint on the next line. In Dexter's default stepping mode this is not an issue, as we intend to step there eventually. When we use DexContinue, however, we set a breakpoint from which we wish to continue to the next user-specified breakpoint, rather than stepping. Currently, there is a bug where Dexter sets a DexContinue breakpoint, arrives at that bp from a step, requests "step in" so that LLDB gives us the hit breakpoint ID, requests "continue" to hit the next user breakpoint, and then arrives at the next line after the continue due to the earlier "step in" request. This effectively negates the DexContinue command.

This patch fixes this behaviour by using "continue" instead of "step in" in the post-step hook, ensuring that no implicit breakpoint is set so that we do not incorrectly stop at the next line.

Likely fixes the issue reported at: #152721 (comment)

Currently, Dexter's interface for lldb and lldb-dap has a post-step hook
that checks to see whether lldb reports that we stopped because we
completed a step, and if so checks to see whether the current $pc address
also matches a known breakpoint whose conditions (if any) are met, and if
so it requests to "step in", so that we "resume" execution, stopping again
at the current address, such that lldb now reports that we have hit a
breakpoint and provides the list of breakpoints that were hit.

This logic has a flaw however: the call to "step in" sets an implicit
breakpoint on the next line. In Dexter's default stepping mode this is not
an issue, as we intend to step there eventually. When we use DexContinue,
however, we set a breakpoint from which we wish to continue to the next
user-specified breakpoint, rather than stepping. Currently, there is a bug
where Dexter sets a DexContinue breakpoint, arrives at that bp from a step,
requests "step in" so that LLDB gives us the hit breakpoint ID, requests
"continue" to hit the next user breakpoint, and then arrives at the next
line after the continue due to the earlier "step in" request. This
effectively negates the DexContinue command.

This patch fixes this behaviour by using "continue" instead of "step in" in
the post-step hook, ensuring that no implicit breakpoint is set so that we
do not incorrectly stop at the next line.
@SLTozer SLTozer self-assigned this Sep 2, 2025
Copy link
Contributor

@OCHyams OCHyams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me whether LLDB's behaviour here is really desirable from an API/DAP-user perspective, but working around this behaviour in dexter is still needed either way. LGTM, ty!

@SLTozer SLTozer merged commit dc05c5d into llvm:main Sep 3, 2025
9 checks passed
@adrian-prantl
Copy link
Collaborator

@OCHyams
Copy link
Contributor

OCHyams commented Sep 4, 2025

Looking at the new output, Stephen's patch did fix the issue we were seeing at first. With that fixed, the bot has run into a new failure mode, which is much simpler. The "step index" numbers are different on that bot than on x86 / locally for some reason. Should be fixed in #156832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants