1 //===-- ProcessMachCore.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 liblldb_ProcessMachCore_h_ 11 #define liblldb_ProcessMachCore_h_ 12 13 // C Includes 14 15 // C++ Includes 16 #include <list> 17 #include <vector> 18 19 // Other libraries and framework includes 20 #include "lldb/Core/ConstString.h" 21 #include "lldb/Core/Error.h" 22 #include "lldb/Target/Process.h" 23 24 class ThreadKDP; 25 26 class ProcessMachCore : public lldb_private::Process 27 { 28 public: 29 //------------------------------------------------------------------ 30 // Constructors and Destructors 31 //------------------------------------------------------------------ 32 static lldb::ProcessSP 33 CreateInstance (lldb_private::Target& target, 34 lldb_private::Listener &listener, 35 const lldb_private::FileSpec *crash_file_path); 36 37 static void 38 Initialize(); 39 40 static void 41 Terminate(); 42 43 static lldb_private::ConstString 44 GetPluginNameStatic(); 45 46 static const char * 47 GetPluginDescriptionStatic(); 48 49 //------------------------------------------------------------------ 50 // Constructors and Destructors 51 //------------------------------------------------------------------ 52 ProcessMachCore(lldb_private::Target& target, 53 lldb_private::Listener &listener, 54 const lldb_private::FileSpec &core_file); 55 56 virtual 57 ~ProcessMachCore(); 58 59 //------------------------------------------------------------------ 60 // Check if a given Process 61 //------------------------------------------------------------------ 62 virtual bool 63 CanDebug (lldb_private::Target &target, 64 bool plugin_specified_by_name); 65 66 //------------------------------------------------------------------ 67 // Creating a new process, or attaching to an existing one 68 //------------------------------------------------------------------ 69 virtual lldb_private::Error 70 DoLoadCore (); 71 72 virtual lldb_private::DynamicLoader * 73 GetDynamicLoader (); 74 75 //------------------------------------------------------------------ 76 // PluginInterface protocol 77 //------------------------------------------------------------------ 78 virtual lldb_private::ConstString 79 GetPluginName(); 80 81 virtual uint32_t 82 GetPluginVersion(); 83 84 //------------------------------------------------------------------ 85 // Process Control 86 //------------------------------------------------------------------ 87 virtual lldb_private::Error 88 DoDestroy (); 89 90 virtual void 91 RefreshStateAfterStop(); 92 93 //------------------------------------------------------------------ 94 // Process Queries 95 //------------------------------------------------------------------ 96 virtual bool 97 IsAlive (); 98 99 virtual bool 100 WarnBeforeDetach () const; 101 102 //------------------------------------------------------------------ 103 // Process Memory 104 //------------------------------------------------------------------ 105 virtual size_t 106 ReadMemory (lldb::addr_t addr, void *buf, size_t size, lldb_private::Error &error); 107 108 virtual size_t 109 DoReadMemory (lldb::addr_t addr, void *buf, size_t size, lldb_private::Error &error); 110 111 virtual lldb::addr_t 112 GetImageInfoAddress (); 113 114 protected: 115 friend class ThreadMachCore; 116 117 void 118 Clear ( ); 119 120 virtual bool 121 UpdateThreadList (lldb_private::ThreadList &old_thread_list, 122 lldb_private::ThreadList &new_thread_list); 123 124 lldb_private::ObjectFile * 125 GetCoreObjectFile (); 126 private: 127 bool 128 GetDynamicLoaderAddress (lldb::addr_t addr); 129 130 //------------------------------------------------------------------ 131 // For ProcessMachCore only 132 //------------------------------------------------------------------ 133 typedef lldb_private::Range<lldb::addr_t, lldb::addr_t> FileRange; 134 typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, FileRange> VMRangeToFileOffset; 135 136 VMRangeToFileOffset m_core_aranges; 137 lldb::ModuleSP m_core_module_sp; 138 lldb_private::FileSpec m_core_file; 139 lldb::addr_t m_dyld_addr; 140 lldb_private::ConstString m_dyld_plugin_name; 141 DISALLOW_COPY_AND_ASSIGN (ProcessMachCore); 142 143 }; 144 145 #endif // liblldb_ProcessMachCore_h_ 146