1 //===-- ThreadPlanCallUserExpression.h --------------------------------*- C++ 2 //-*-===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H 11 #define LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H 12 13 #include "lldb/Target/Thread.h" 14 #include "lldb/Target/ThreadPlan.h" 15 #include "lldb/Target/ThreadPlanCallFunction.h" 16 #include "lldb/lldb-private.h" 17 18 #include "llvm/ADT/ArrayRef.h" 19 20 namespace lldb_private { 21 22 class ThreadPlanCallUserExpression : public ThreadPlanCallFunction { 23 public: 24 ThreadPlanCallUserExpression(Thread &thread, Address &function, 25 llvm::ArrayRef<lldb::addr_t> args, 26 const EvaluateExpressionOptions &options, 27 lldb::UserExpressionSP &user_expression_sp); 28 29 ~ThreadPlanCallUserExpression() override; 30 31 void GetDescription(Stream *s, lldb::DescriptionLevel level) override; 32 33 void DidPush() override; 34 35 void WillPop() override; 36 37 lldb::StopInfoSP GetRealStopInfo() override; 38 39 bool MischiefManaged() override; 40 TransferExpressionOwnership()41 void TransferExpressionOwnership() { m_manage_materialization = true; } 42 GetExpressionVariable()43 lldb::ExpressionVariableSP GetExpressionVariable() override { 44 return m_result_var_sp; 45 } 46 47 protected: 48 void DoTakedown(bool success) override; 49 private: 50 lldb::UserExpressionSP 51 m_user_expression_sp; // This is currently just used to ensure the 52 // User expression the initiated this ThreadPlan 53 // lives as long as the thread plan does. 54 bool m_manage_materialization = false; 55 lldb::ExpressionVariableSP 56 m_result_var_sp; // If we are left to manage the materialization, 57 // then stuff the result expression variable here. 58 59 ThreadPlanCallUserExpression(const ThreadPlanCallUserExpression &) = delete; 60 const ThreadPlanCallUserExpression & 61 operator=(const ThreadPlanCallUserExpression &) = delete; 62 }; 63 64 } // namespace lldb_private 65 66 #endif // LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H 67