Skip to content

Stop hooks initial stop #10608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: swift/release/6.2
Choose a base branch
from

Conversation

jimingham
Copy link

This change makes stop-hooks fire when lldb initially gains control of a process. Previously they would only fire at the first stop after the user "continues" a process they have gained control of. The patch also adds a flag to turn off this behavior if that is desired.

rdar://148351688
rdar://148351055

jimingham added 2 commits May 1, 2025 16:17
…m#137410)

stop-hooks are supposed to trigger every time the process stops, but as
initially implemented they would only fire when control was returned to
the user. So for instance when a process was launched the stop hook
would only trigger when the process hit a breakpoint or crashed.

However, it would be really useful to be able to trigger a stop hook
when lldb first gains control over the process. One way to do that would
be to implement general "target lifecycle events" and then send process
created events that users could bind actions to.

OTOH, extending the stop hooks to fire when lldb first gains control
over the process is a pretty natural extension to the notion of a stop
hook. So this patch takes the shorter route to that ability by making
stop-hooks fire when lldb first gains control over the process.

I also added the ability to specify whether to trigger the stop hook "on
gaining control". I'm on the fence about whether to set the default to
be "trigger on gaining control" or "don't trigger on gaining control".
Since I think it's a generally useful feature, I've set the default to
"trigger on gaining control".

(cherry picked from commit 4fdb8cb)
I changed the option name from at-first-stop (-F) to at-initial-stop
(-I) but missed one place in the testsuite.

(cherry picked from commit 471fe9c)
@jimingham jimingham requested a review from a team as a code owner May 1, 2025 23:21
@jimingham jimingham requested a review from JDevlieghere May 1, 2025 23:22
@jimingham
Copy link
Author

@swift-ci please test

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.

1 participant