This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use a weak pointer to hold on to the underlying thread plan in SBThreadPlan
ClosedPublic

Authored by JDevlieghere on Jul 20 2020, 4:32 PM.

Details

Summary

Use a weak pointer to hold on to the the underlying thread plan in SBThreadPlan. When the process continues, all the popped ThreadPlans get discarded, and you can’t reuse them, so you have to create them anew. Therefore the SBThreadPlan doesn’t need to keep the ThreadPlan alive. This fixes the cleanup error in TestThreadPlanCommands.py and TestStepScripted.py caused by the thread plans never being deleted.

Diff Detail

Event Timeline

JDevlieghere created this revision.Jul 20 2020, 4:32 PM

s/thread_plan/thread_plan_sp/g

Yes, the only way you can get your hands on an SBThreadPlan is in the process of queueing one, so the ThreadPlan stack will always be the one to manage the lifecycle of a plan. And if an SBThreadPlan represents a ThreadPlan that has been discarded, it should convert back to an empty SBThreadPlan rather than keeping the underlying plan alive. So this is correct.

jingham accepted this revision.Jul 20 2020, 4:40 PM

LGTM

This revision is now accepted and ready to land.Jul 20 2020, 4:40 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2020, 9:19 PM