blob: 253190991ce830cdcd673063262534000c5a8f95 [file] [log] [blame]
Jim Inghamb66cd072010-09-28 01:25:32 +00001//===-- AppleThreadPlanStepThroughObjCTrampoline.h --------------------------*- C++ -*-===//
Chris Lattner24943d22010-06-08 16:52:24 +00002//
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
Jim Inghamb66cd072010-09-28 01:25:32 +000010#ifndef lldb_AppleThreadPlanStepThroughObjCTrampoline_h_
11#define lldb_AppleThreadPlanStepThroughObjCTrampoline_h_
Chris Lattner24943d22010-06-08 16:52:24 +000012
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
Greg Clayton54e7afa2010-07-09 20:39:50 +000017#include "lldb/lldb-types.h"
18#include "lldb/lldb-enumerations.h"
Jim Ingham1831e782012-04-07 00:00:41 +000019#include "lldb/Core/Value.h"
Chris Lattner24943d22010-06-08 16:52:24 +000020#include "lldb/Target/ThreadPlan.h"
Jim Inghamb66cd072010-09-28 01:25:32 +000021#include "AppleObjCTrampolineHandler.h"
Chris Lattner24943d22010-06-08 16:52:24 +000022
23namespace lldb_private
24{
25
Jim Inghamb66cd072010-09-28 01:25:32 +000026class AppleThreadPlanStepThroughObjCTrampoline : public ThreadPlan
Chris Lattner24943d22010-06-08 16:52:24 +000027{
28public:
29 //------------------------------------------------------------------
30 // Constructors and Destructors
31 //------------------------------------------------------------------
Jim Inghamb66cd072010-09-28 01:25:32 +000032 AppleThreadPlanStepThroughObjCTrampoline(Thread &thread,
Jim Ingham6507dd92010-12-10 00:26:25 +000033 AppleObjCTrampolineHandler *trampoline_handler,
Jim Ingham1831e782012-04-07 00:00:41 +000034 ValueList &values,
Jim Ingham6507dd92010-12-10 00:26:25 +000035 lldb::addr_t isa_addr,
36 lldb::addr_t sel_addr,
37 bool stop_others);
Chris Lattner24943d22010-06-08 16:52:24 +000038
Jim Inghamb66cd072010-09-28 01:25:32 +000039 virtual ~AppleThreadPlanStepThroughObjCTrampoline();
Chris Lattner24943d22010-06-08 16:52:24 +000040
41 virtual void
42 GetDescription (Stream *s,
43 lldb::DescriptionLevel level);
44
45 virtual bool
46 ValidatePlan (Stream *error);
47
Chris Lattner24943d22010-06-08 16:52:24 +000048 virtual lldb::StateType
Jim Ingham745ac7a2010-11-11 19:26:09 +000049 GetPlanRunState ();
Chris Lattner24943d22010-06-08 16:52:24 +000050
51 virtual bool
52 ShouldStop (Event *event_ptr);
Jim Inghamb6b7f3e2013-03-22 01:28:17 +000053
54 virtual bool
55 StopOthers()
56 {
57 return m_stop_others;
58 }
Chris Lattner24943d22010-06-08 16:52:24 +000059
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
Jim Ingham1831e782012-04-07 00:00:41 +000068 static bool
69 PreResumeInitializeClangFunction(void *myself);
70
Chris Lattner24943d22010-06-08 16:52:24 +000071 virtual bool
72 WillStop();
73
74
75
76protected:
77 //------------------------------------------------------------------
Jim Inghamb66cd072010-09-28 01:25:32 +000078 // Classes that inherit from AppleThreadPlanStepThroughObjCTrampoline can see and modify these
Chris Lattner24943d22010-06-08 16:52:24 +000079 //------------------------------------------------------------------
Jim Ingham7c79a272013-05-08 00:35:16 +000080 virtual bool
81 DoPlanExplainsStop (Event *event_ptr);
Chris Lattner24943d22010-06-08 16:52:24 +000082
83private:
Jim Ingham1831e782012-04-07 00:00:41 +000084 bool
85 InitializeClangFunction ();
86
Chris Lattner24943d22010-06-08 16:52:24 +000087 //------------------------------------------------------------------
Jim Inghamb66cd072010-09-28 01:25:32 +000088 // For AppleThreadPlanStepThroughObjCTrampoline only
Chris Lattner24943d22010-06-08 16:52:24 +000089 //------------------------------------------------------------------
Jim Ingham6507dd92010-12-10 00:26:25 +000090 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.
Jim Ingham1831e782012-04-07 00:00:41 +000092 //lldb::addr_t m_object_addr; // This is only for Description.
93 ValueList m_input_values;
Jim Ingham6507dd92010-12-10 00:26:25 +000094 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;
Greg Clayton6e0101c2011-09-17 06:21:20 +000096 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.
Chris Lattner24943d22010-06-08 16:52:24 +000099 ClangFunction *m_impl_function; // This is a pointer to a impl function that
100 // is owned by the client that pushes this plan.
Jim Ingham6507dd92010-12-10 00:26:25 +0000101 bool m_stop_others;
Chris Lattner24943d22010-06-08 16:52:24 +0000102};
103
Greg Clayton54e7afa2010-07-09 20:39:50 +0000104} // namespace lldb_private
105
Jim Inghamb66cd072010-09-28 01:25:32 +0000106#endif // lldb_AppleThreadPlanStepThroughObjCTrampoline_h_