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 LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H
10 #define LLDB_TARGET_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:
49  lldb::ThreadPlanSP m_step_out_threadplan_sp;
50 };
51 }
52 
53 #endif // LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H
lldb_private::ThreadPlanCallOnFunctionExit::GetPlanRunState
lldb::StateType GetPlanRunState() override
Definition: ThreadPlanCallOnFunctionExit.cpp:93
lldb_private::ThreadPlanCallOnFunctionExit::DoPlanExplainsStop
bool DoPlanExplainsStop(Event *event_ptr) override
Definition: ThreadPlanCallOnFunctionExit.cpp:86
lldb_private::ThreadPlanCallOnFunctionExit
This thread plan calls a function object when the current function exits.
Definition: ThreadPlanCallOnFunctionExit.h:22
lldb_private::Event
Definition: Event.h:180
lldb_private::ThreadPlanCallOnFunctionExit::m_callback
Callback m_callback
Definition: ThreadPlanCallOnFunctionExit.h:48
lldb_private::Stream
Definition: Stream.h:28
lldb_private::ThreadPlanCallOnFunctionExit::ValidatePlan
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
Definition: ThreadPlanCallOnFunctionExit.cpp:53
lldb_private::ThreadPlanCallOnFunctionExit::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
Definition: ThreadPlanCallOnFunctionExit.cpp:45
lldb_private::ThreadPlanCallOnFunctionExit::WillStop
bool WillStop() override
Definition: ThreadPlanCallOnFunctionExit.cpp:79
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ThreadPlan
Definition: ThreadPlan.h:282
lldb_private::Thread
Definition: Thread.h:62
lldb_private::ThreadPlanCallOnFunctionExit::m_step_out_threadplan_sp
lldb::ThreadPlanSP m_step_out_threadplan_sp
Definition: ThreadPlanCallOnFunctionExit.h:49
lldb_private::ThreadPlanCallOnFunctionExit::ShouldStop
bool ShouldStop(Event *event_ptr) override
Definition: ThreadPlanCallOnFunctionExit.cpp:59
ThreadPlan.h
lldb_private::ThreadPlanCallOnFunctionExit::Callback
std::function< void()> Callback
Definition for the callback made when the currently executing thread finishes executing its function.
Definition: ThreadPlanCallOnFunctionExit.h:26
lldb_private::ThreadPlanCallOnFunctionExit::DidPush
void DidPush() override
Definition: ThreadPlanCallOnFunctionExit.cpp:24
lldb_private::ThreadPlanCallOnFunctionExit::ThreadPlanCallOnFunctionExit
ThreadPlanCallOnFunctionExit(Thread &thread, const Callback &callback)
Definition: ThreadPlanCallOnFunctionExit.cpp:14
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207