LLDB  mainline
ThreadPlanCallOnFunctionExit.h
Go to the documentation of this file.
1 //===-- ThreadPlanCallOnFunctionExit.h --------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef ThreadPlanCallOnFunctionExit_h
10 #define ThreadPlanCallOnFunctionExit_h
11 
12 #include "lldb/Target/ThreadPlan.h"
13 
14 #include <functional>
15 
16 namespace lldb_private {
17 
18 // =============================================================================
19 /// This thread plan calls a function object when the current function exits.
20 // =============================================================================
21 
23 public:
24  /// Definition for the callback made when the currently executing thread
25  /// finishes executing its function.
26  using Callback = std::function<void()>;
27 
28  ThreadPlanCallOnFunctionExit(Thread &thread, const Callback &callback);
29 
30  void DidPush() override;
31 
32  // ThreadPlan API
33 
34  void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
35 
36  bool ValidatePlan(Stream *error) override;
37 
38  bool ShouldStop(Event *event_ptr) override;
39 
40  bool WillStop() override;
41 
42 protected:
43  bool DoPlanExplainsStop(Event *event_ptr) override;
44 
46 
47 private:
48  Callback m_callback;
49  lldb::ThreadPlanSP m_step_out_threadplan_sp;
50 };
51 }
52 
53 #endif /* ThreadPlanCallOnFunctionExit_h */
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
std::function< void()> Callback
Definition for the callback made when the currently executing thread finishes executing its function...
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
This thread plan calls a function object when the current function exits.
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
ThreadPlanCallOnFunctionExit(Thread &thread, const Callback &callback)