ProcessMachCore.h revision 37b416669bb9316d73081403e6e26ed0e09526ba
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 23class ThreadKDP; 24 25class ProcessMachCore : public lldb_private::Process 26{ 27public: 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 //------------------------------------------------------------------ 72 // PluginInterface protocol 73 //------------------------------------------------------------------ 74 virtual const char * 75 GetPluginName(); 76 77 virtual const char * 78 GetShortPluginName(); 79 80 virtual uint32_t 81 GetPluginVersion(); 82 83 //------------------------------------------------------------------ 84 // Process Control 85 //------------------------------------------------------------------ 86 virtual lldb_private::Error 87 DoDestroy (); 88 89 virtual void 90 RefreshStateAfterStop(); 91 92 //------------------------------------------------------------------ 93 // Process Queries 94 //------------------------------------------------------------------ 95 virtual bool 96 IsAlive (); 97 98 //------------------------------------------------------------------ 99 // Process Memory 100 //------------------------------------------------------------------ 101 virtual size_t 102 DoReadMemory (lldb::addr_t addr, void *buf, size_t size, lldb_private::Error &error); 103 104 virtual lldb::addr_t 105 GetImageInfoAddress (); 106 107protected: 108 friend class ThreadMachCore; 109 110 void 111 Clear ( ); 112 113 uint32_t 114 UpdateThreadList (lldb_private::ThreadList &old_thread_list, 115 lldb_private::ThreadList &new_thread_list); 116 117 lldb_private::ObjectFile * 118 GetCoreObjectFile () 119 { 120 return m_core_module_sp->GetObjectFile(); 121 } 122private: 123 //------------------------------------------------------------------ 124 // For ProcessMachCore only 125 //------------------------------------------------------------------ 126 typedef lldb_private::Range<uint32_t, uint32_t> FileRange; 127 typedef lldb_private::RangeDataArray<lldb::addr_t, lldb::addr_t, FileRange, 1> VMRangeToFileOffset; 128 129 VMRangeToFileOffset m_core_aranges; 130 lldb::ModuleSP m_core_module_sp; 131 lldb_private::FileSpec m_core_file; 132 lldb::addr_t m_shlib_addr; 133 DISALLOW_COPY_AND_ASSIGN (ProcessMachCore); 134 135}; 136 137#endif // liblldb_ProcessMachCore_h_ 138