ThreadPlanCallUserExpression.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #ifndef LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H
  10. #define LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H
  11. #include "lldb/Target/Thread.h"
  12. #include "lldb/Target/ThreadPlan.h"
  13. #include "lldb/Target/ThreadPlanCallFunction.h"
  14. #include "lldb/lldb-private.h"
  15. #include "llvm/ADT/ArrayRef.h"
  16. namespace lldb_private {
  17. class ThreadPlanCallUserExpression : public ThreadPlanCallFunction {
  18. public:
  19. ThreadPlanCallUserExpression(Thread &thread, Address &function,
  20. llvm::ArrayRef<lldb::addr_t> args,
  21. const EvaluateExpressionOptions &options,
  22. lldb::UserExpressionSP &user_expression_sp);
  23. ~ThreadPlanCallUserExpression() override;
  24. void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
  25. void DidPush() override;
  26. void WillPop() override;
  27. lldb::StopInfoSP GetRealStopInfo() override;
  28. bool MischiefManaged() override;
  29. void TransferExpressionOwnership() { m_manage_materialization = true; }
  30. lldb::ExpressionVariableSP GetExpressionVariable() override {
  31. return m_result_var_sp;
  32. }
  33. protected:
  34. void DoTakedown(bool success) override;
  35. private:
  36. lldb::UserExpressionSP
  37. m_user_expression_sp; // This is currently just used to ensure the
  38. // User expression the initiated this ThreadPlan
  39. // lives as long as the thread plan does.
  40. bool m_manage_materialization = false;
  41. lldb::ExpressionVariableSP
  42. m_result_var_sp; // If we are left to manage the materialization,
  43. // then stuff the result expression variable here.
  44. ThreadPlanCallUserExpression(const ThreadPlanCallUserExpression &) = delete;
  45. const ThreadPlanCallUserExpression &
  46. operator=(const ThreadPlanCallUserExpression &) = delete;
  47. };
  48. } // namespace lldb_private
  49. #endif // LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H