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