1 //===-- ThreadPlanCallOnFunctionExit.h --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef ThreadPlanCallOnFunctionExit_h
11 #define ThreadPlanCallOnFunctionExit_h
13 #include "lldb/Target/ThreadPlan.h"
17 namespace lldb_private {
19 // =============================================================================
20 /// This thread plan calls a function object when the current function exits.
21 // =============================================================================
23 class ThreadPlanCallOnFunctionExit : public ThreadPlan {
25 /// Definition for the callback made when the currently executing thread
26 /// finishes executing its function.
27 using Callback = std::function<void()>;
29 ThreadPlanCallOnFunctionExit(Thread &thread, const Callback &callback);
31 void DidPush() override;
33 // -------------------------------------------------------------------------
35 // -------------------------------------------------------------------------
37 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
39 bool ValidatePlan(Stream *error) override;
41 bool ShouldStop(Event *event_ptr) override;
43 bool WillStop() override;
46 bool DoPlanExplainsStop(Event *event_ptr) override;
48 lldb::StateType GetPlanRunState() override;
52 lldb::ThreadPlanSP m_step_out_threadplan_sp;
56 #endif /* ThreadPlanCallOnFunctionExit_h */