Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:56

0001 //===-- ThreadPlanCallOnFunctionExit.h --------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H
0010 #define LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H
0011 
0012 #include "lldb/Target/ThreadPlan.h"
0013 
0014 #include <functional>
0015 
0016 namespace lldb_private {
0017 
0018 // =============================================================================
0019 /// This thread plan calls a function object when the current function exits.
0020 // =============================================================================
0021 
0022 class ThreadPlanCallOnFunctionExit : public ThreadPlan {
0023 public:
0024   /// Definition for the callback made when the currently executing thread
0025   /// finishes executing its function.
0026   using Callback = std::function<void()>;
0027 
0028   ThreadPlanCallOnFunctionExit(Thread &thread, const Callback &callback);
0029 
0030   void DidPush() override;
0031 
0032   // ThreadPlan API
0033 
0034   void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
0035 
0036   bool ValidatePlan(Stream *error) override;
0037 
0038   bool ShouldStop(Event *event_ptr) override;
0039 
0040   bool WillStop() override;
0041 
0042 protected:
0043   bool DoPlanExplainsStop(Event *event_ptr) override;
0044 
0045   lldb::StateType GetPlanRunState() override;
0046 
0047 private:
0048   Callback m_callback;
0049   lldb::ThreadPlanSP m_step_out_threadplan_sp;
0050 };
0051 }
0052 
0053 #endif // LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H