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_AppleThreadPlanStepThroughObjCTrampoline_h_ 10 #define lldb_AppleThreadPlanStepThroughObjCTrampoline_h_ 11 12 #include "AppleObjCTrampolineHandler.h" 13 #include "lldb/Core/Value.h" 14 #include "lldb/Target/ThreadPlan.h" 15 #include "lldb/lldb-enumerations.h" 16 #include "lldb/lldb-types.h" 17 18 namespace lldb_private { 19 20 class AppleThreadPlanStepThroughObjCTrampoline : public ThreadPlan { 21 public: 22 AppleThreadPlanStepThroughObjCTrampoline( 23 Thread &thread, AppleObjCTrampolineHandler *trampoline_handler, 24 ValueList &values, lldb::addr_t isa_addr, lldb::addr_t sel_addr, 25 bool stop_others); 26 27 ~AppleThreadPlanStepThroughObjCTrampoline() override; 28 29 static bool PreResumeInitializeFunctionCaller(void *myself); 30 31 void GetDescription(Stream *s, lldb::DescriptionLevel level) override; 32 33 bool ValidatePlan(Stream *error) override; 34 35 lldb::StateType GetPlanRunState() override; 36 37 bool ShouldStop(Event *event_ptr) override; 38 39 bool StopOthers() override { return m_stop_others; } 40 41 // The base class MischiefManaged does some cleanup - so you have to call it 42 // in your MischiefManaged derived class. 43 bool MischiefManaged() override; 44 45 void DidPush() override; 46 47 bool WillStop() override; 48 49 protected: 50 bool DoPlanExplainsStop(Event *event_ptr) override; 51 52 private: 53 bool InitializeFunctionCaller(); 54 55 AppleObjCTrampolineHandler *m_trampoline_handler; // FIXME - ensure this 56 // doesn't go away on us? 57 // SP maybe? 58 lldb::addr_t m_args_addr; // Stores the address for our step through function 59 // result structure. 60 // lldb::addr_t m_object_addr; // This is only for Description. 61 ValueList m_input_values; 62 lldb::addr_t m_isa_addr; // isa_addr and sel_addr are the keys we will use to 63 // cache the implementation. 64 lldb::addr_t m_sel_addr; 65 lldb::ThreadPlanSP m_func_sp; // This is the function call plan. We fill it 66 // at start, then set it 67 // to NULL when this plan is done. That way we know to go to: 68 lldb::ThreadPlanSP m_run_to_sp; // The plan that runs to the target. 69 FunctionCaller *m_impl_function; // This is a pointer to a impl function that 70 // is owned by the client that pushes this plan. 71 bool m_stop_others; 72 }; 73 74 } // namespace lldb_private 75 76 #endif // lldb_AppleThreadPlanStepThroughObjCTrampoline_h_ 77