<div dir="ltr">Hey everyone, I'm having some trouble using ThreadPlanCallFunction, I tried the following, but for some reason the reference that the thread stores in m_completed_plan_stack does not increment the use count of the shared ptr.<div>I have tried debugging this, but gotten nowhere, so I figured I must be missing something. Does this code look ok? (Ignore the debug print statements, though for completeness, the output is</div><div><br></div><div><div>1</div><div>1</div><div>0xf5f1290</div><div>1</div><div>0xf5f1290</div><div>1</div></div><div><br></div><div><div>        if (!ctx.HasThreadScope())</div><div>        {</div><div>            error_stream.Printf("ClangUserExpression::Execute called with no thread selected.");</div><div>            return lldb::eExpressionSetupError;</div><div>        }</div><div><br></div><div>        lldb_private::EvaluateExpressionOptions options;</div><div>        llvm::ArrayRef <lldb::addr_t> args;</div><div><br></div><div>        lldb::ThreadPlanSP call_plan_sp(new lldb_private::ThreadPlanCallFunction(ctx.GetThreadRef(), address, $(ClangASTType(C,rt)), args, options));</div><div>        std::cout << call_plan_sp.use_count() << "\n";</div><div><br></div><div>        if (!call_plan_sp || !call_plan_sp->ValidatePlan (&error_stream))</div><div>            return lldb::eExpressionSetupError;</div><div><br></div><div>        std::cout << call_plan_sp.use_count() << "\n";</div><div><br></div><div>        lldb::ExpressionResults execution_result = ctx.GetProcessRef().RunThreadPlan (ctx,</div><div>                                                                                   call_plan_sp,</div><div>                                                                                   options,</div><div>                                                                                   error_stream);</div><div><br></div><div>        std::cout << ctx.GetThreadRef().m_completed_plan_stack[1].get() << "\n";</div><div>        std::cout << ctx.GetThreadRef().m_completed_plan_stack[1].use_count() << "\n";</div><div><br></div><div>        std::cout << call_plan_sp.get() << "\n";</div><div>        std::cout << call_plan_sp.use_count() << "\n";</div><div><br></div><div>        return lldb::eExpressionCompleted;</div></div></div>