1 //===-- ObjectContainerUniversalMachO.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_ObjectContainerUniversalMachO_h_ 11 #define liblldb_ObjectContainerUniversalMachO_h_ 12 13 #include "lldb/Symbol/ObjectContainer.h" 14 #include "lldb/Host/FileSpec.h" 15 16 #include "llvm/Support/MachO.h" 17 18 class ObjectContainerUniversalMachO : 19 public lldb_private::ObjectContainer 20 { 21 public: 22 //------------------------------------------------------------------ 23 // Static Functions 24 //------------------------------------------------------------------ 25 static void 26 Initialize(); 27 28 static void 29 Terminate(); 30 31 static lldb_private::ConstString 32 GetPluginNameStatic(); 33 34 static const char * 35 GetPluginDescriptionStatic(); 36 37 static lldb_private::ObjectContainer * 38 CreateInstance (const lldb::ModuleSP &module_sp, 39 lldb::DataBufferSP& data_sp, 40 lldb::offset_t data_offset, 41 const lldb_private::FileSpec *file, 42 lldb::offset_t offset, 43 lldb::offset_t length); 44 45 static size_t 46 GetModuleSpecifications (const lldb_private::FileSpec& file, 47 lldb::DataBufferSP& data_sp, 48 lldb::offset_t data_offset, 49 lldb::offset_t file_offset, 50 lldb::offset_t length, 51 lldb_private::ModuleSpecList &specs); 52 53 static bool 54 MagicBytesMatch (const lldb_private::DataExtractor &data); 55 56 //------------------------------------------------------------------ 57 // Member Functions 58 //------------------------------------------------------------------ 59 ObjectContainerUniversalMachO (const lldb::ModuleSP &module_sp, 60 lldb::DataBufferSP& data_sp, 61 lldb::offset_t data_offset, 62 const lldb_private::FileSpec *file, 63 lldb::offset_t offset, 64 lldb::offset_t length); 65 66 virtual 67 ~ObjectContainerUniversalMachO(); 68 69 virtual bool 70 ParseHeader (); 71 72 virtual void 73 Dump (lldb_private::Stream *s) const; 74 75 virtual size_t 76 GetNumArchitectures () const; 77 78 virtual bool 79 GetArchitectureAtIndex (uint32_t cpu_idx, lldb_private::ArchSpec& arch) const; 80 81 virtual lldb::ObjectFileSP 82 GetObjectFile (const lldb_private::FileSpec *file); 83 84 //------------------------------------------------------------------ 85 // PluginInterface protocol 86 //------------------------------------------------------------------ 87 virtual lldb_private::ConstString 88 GetPluginName(); 89 90 virtual uint32_t 91 GetPluginVersion(); 92 93 protected: 94 llvm::MachO::fat_header m_header; 95 std::vector<llvm::MachO::fat_arch> m_fat_archs; 96 97 static bool 98 ParseHeader (lldb_private::DataExtractor &data, 99 llvm::MachO::fat_header &header, 100 std::vector<llvm::MachO::fat_arch> &fat_archs); 101 102 }; 103 104 #endif // liblldb_ObjectContainerUniversalMachO_h_ 105