LLDB mainline
AppleThreadPlanStepThroughObjCTrampoline.h
Go to the documentation of this file.
1//===-- AppleThreadPlanStepThroughObjCTrampoline.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_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLETHREADPLANSTEPTHROUGHOBJCTRAMPOLINE_H
10#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLETHREADPLANSTEPTHROUGHOBJCTRAMPOLINE_H
11
13#include "lldb/Core/Value.h"
19#include "lldb/lldb-types.h"
20
21namespace lldb_private {
22
24public:
26 Thread &thread, AppleObjCTrampolineHandler &trampoline_handler,
27 ValueList &values, lldb::addr_t isa_addr, lldb::addr_t sel_addr,
28 lldb::addr_t sel_str_addr, llvm::StringRef sel_str);
29
31
32 static bool PreResumeInitializeFunctionCaller(void *myself);
33
34 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
35
36 bool ValidatePlan(Stream *error) override;
37
39
40 bool ShouldStop(Event *event_ptr) override;
41
42 // The step through code might have to fill in the cache, so it is not safe
43 // to run only one thread.
44 bool StopOthers() override { return false; }
45
46 // The base class MischiefManaged does some cleanup - so you have to call it
47 // in your MischiefManaged derived class.
48 bool MischiefManaged() override;
49
50 void DidPush() override;
51
52 bool WillStop() override;
53
54protected:
55 bool DoPlanExplainsStop(Event *event_ptr) override;
56
57private:
59
61 lldb::addr_t m_args_addr; /// Stores the address for our step through function
62 /// result structure.
64 lldb::addr_t m_isa_addr; /// isa_addr and sel_addr are the keys we will use to
65 /// cache the implementation.
67 lldb::ThreadPlanSP m_func_sp; /// This is the function call plan. We fill it
68 /// at start, then set it to NULL when this plan
69 /// is done. That way we know to go on to:
70 lldb::ThreadPlanSP m_run_to_sp; /// The plan that runs to the target.
71 FunctionCaller *m_impl_function; /// This is a pointer to a impl function that
72 /// is owned by the client that pushes this
73 /// plan.
74 lldb::addr_t m_sel_str_addr; /// If this is not LLDB_INVALID_ADDRESS then it
75 /// is the address we wrote the selector string
76 /// to. We need to deallocate it when the
77 /// function call is done.
78 std::string m_sel_str; /// This is the string we wrote to memory - we
79 /// use it for caching, but only if
80 /// m_sel_str_addr is non-null.
81};
82
84public:
87 llvm::StringRef dispatch_func_name);
88
90
91 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
92
93 bool ShouldStop(Event *event_ptr) override;
94
95 bool StopOthers() override { return false; }
96
97 bool MischiefManaged() override;
98
99 bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
100
101 void SetFlagsToDefault() override {
103 }
104
105protected:
106 bool DoPlanExplainsStop(Event *event_ptr) override;
107
109 std::string m_dispatch_func_name; /// Which dispatch function we're stepping
110 /// through.
111 lldb::ThreadPlanSP m_objc_step_through_sp; /// When we hit an objc_msgSend,
112 /// we'll use this plan to get to
113 /// its target.
114 std::vector<lldb::BreakpointSP> m_msgSend_bkpts; /// Breakpoints on the objc
115 /// dispatch functions.
116 bool m_at_msg_send; /// Are we currently handling an msg_send
117
118};
119
120} // namespace lldb_private
121
122#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLETHREADPLANSTEPTHROUGHOBJCTRAMPOLINE_H
static llvm::raw_ostream & error(Stream &strm)
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
lldb::ThreadPlanSP m_objc_step_through_sp
Which dispatch function we're stepping through.
std::vector< lldb::BreakpointSP > m_msgSend_bkpts
When we hit an objc_msgSend, we'll use this plan to get to its target.
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
lldb::addr_t m_sel_addr
isa_addr and sel_addr are the keys we will use to cache the implementation.
ValueList m_input_values
Stores the address for our step through function result structure.
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
lldb::addr_t m_sel_str_addr
This is a pointer to a impl function that is owned by the client that pushes this plan.
std::string m_sel_str
If this is not LLDB_INVALID_ADDRESS then it is the address we wrote the selector string to.
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Definition: Flags.h:73
Encapsulates a function that can be called.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
StateType
Process and Thread States.
uint64_t addr_t
Definition: lldb-types.h:79