-
Notifications
You must be signed in to change notification settings - Fork 341
Handle stepping through language thunks that call other functions than the target #10145
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
Handle stepping through language thunks that call other functions than the target #10145
Conversation
…read plans (llvm#129301) Jonas recently added a trampoline handling strategy for simple language thunks that does: "step through language thunks stepping in one level deep and stopping if you hit user code". That was actually pulled over from the swift implementation. However, this strategy and the strategy we have to "step out past language thunks" when stepping out come into conflict if the thunk you are stepping through calls some other function before dispatching to the intended method. When you step out of the called function back into the thunk, should you keep stepping out past the thunk or not? In most cases, you want to step out past the thunk, but in this particular case you don't. This patch adds a way to inform the thread plan (or really it's ShouldStopHere behavior) of which behavior it should have, and passes the don't step through thunks to the step through plan it uses to step through thunks. I didn't add a test for this because I couldn't find a C++ thunk that calls another function before getting to the target function. I asked the clang folks here if they could think of a case where clang would do this, and they couldn't. If anyone can think of such a construct, it will be easy to write the step through test for it... This does happen in swift, however, so when I cherry-pick this to the swift fork I'll test it there. (cherry picked from commit ddbce2f)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one question, but this LGTM either way
self.assertEqual(var.GetSummary(), '"foo"') | ||
|
||
# Now make sure that stepping out steps past the thunk: | ||
thread.StepOut() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any benefit in also branching on use_api
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I changed the test to use use_api consistently for all the steps.
@swift-ci please test |
We have a general feature of "stepping out past language thunks". But we also have a strategy for resolving the target of a thunk which involves stepping through it, stepping in one level deep, and if we get somewhere interesting we stop. If we try to do the latter maneuver, we need to turn off the stepping out past thunks or the first time we step out of something "not interesting" we'll also step past the thunk, defeating the strategy.
The fixes that by adding a way to say "this plan should or should not do the step out past thunk, then setting that for the step through plan.
Also added tests for this.