1 //===-- AppleThreadPlanStepThroughObjCTrampoline.h --------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef lldb_AppleThreadPlanStepThroughObjCTrampoline_h_
11 #define lldb_AppleThreadPlanStepThroughObjCTrampoline_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/lldb-types.h"
18 #include "lldb/lldb-enumerations.h"
19 #include "lldb/Core/Value.h"
20 #include "lldb/Target/ThreadPlan.h"
21 #include "AppleObjCTrampolineHandler.h"
22 
23 namespace lldb_private
24 {
25 
26 class AppleThreadPlanStepThroughObjCTrampoline : public ThreadPlan
27 {
28 public:
29 	//------------------------------------------------------------------
30 	// Constructors and Destructors
31 	//------------------------------------------------------------------
32 	AppleThreadPlanStepThroughObjCTrampoline(Thread &thread,
33                                              AppleObjCTrampolineHandler *trampoline_handler,
34                                              ValueList &values,
35                                              lldb::addr_t isa_addr,
36                                              lldb::addr_t sel_addr,
37                                              bool stop_others);
38 
39 	virtual ~AppleThreadPlanStepThroughObjCTrampoline();
40 
41     virtual void
42     GetDescription (Stream *s,
43                     lldb::DescriptionLevel level);
44 
45     virtual bool
46     ValidatePlan (Stream *error);
47 
48     virtual lldb::StateType
49     GetPlanRunState ();
50 
51     virtual bool
52     ShouldStop (Event *event_ptr);
53 
54     virtual bool
StopOthers()55     StopOthers()
56     {
57         return m_stop_others;
58     }
59 
60     // The base class MischiefManaged does some cleanup - so you have to call it
61     // in your MischiefManaged derived class.
62     virtual bool
63     MischiefManaged ();
64 
65     virtual void
66     DidPush();
67 
68     static bool
69     PreResumeInitializeClangFunction(void *myself);
70 
71     virtual bool
72     WillStop();
73 
74 
75 
76 protected:
77 	//------------------------------------------------------------------
78 	// Classes that inherit from AppleThreadPlanStepThroughObjCTrampoline can see and modify these
79 	//------------------------------------------------------------------
80     virtual bool
81     DoPlanExplainsStop (Event *event_ptr);
82 
83 private:
84     bool
85     InitializeClangFunction ();
86 
87 	//------------------------------------------------------------------
88 	// For AppleThreadPlanStepThroughObjCTrampoline only
89 	//------------------------------------------------------------------
90     AppleObjCTrampolineHandler *m_trampoline_handler; // FIXME - ensure this doesn't go away on us?  SP maybe?
91     lldb::addr_t m_args_addr;     // Stores the address for our step through function result structure.
92     //lldb::addr_t m_object_addr;  // This is only for Description.
93     ValueList    m_input_values;
94     lldb::addr_t m_isa_addr;     // isa_addr and sel_addr are the keys we will use to cache the implementation.
95     lldb::addr_t m_sel_addr;
96     lldb::ThreadPlanSP m_func_sp;       // This is the function call plan.  We fill it at start, then set it
97                                         // to NULL when this plan is done.  That way we know to go to:
98     lldb::ThreadPlanSP m_run_to_sp;     // The plan that runs to the target.
99     ClangFunction *m_impl_function;  // This is a pointer to a impl function that
100                                      // is owned by the client that pushes this plan.
101     bool m_stop_others;
102 };
103 
104 } // namespace lldb_private
105 
106 #endif	// lldb_AppleThreadPlanStepThroughObjCTrampoline_h_
107