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 const char *
32     GetPluginNameStatic();
33 
34     static const char *
35     GetPluginDescriptionStatic();
36 
37     static lldb_private::ObjectContainer *
38     CreateInstance (lldb_private::Module* module,
39                     lldb::DataBufferSP& dataSP,
40                     const lldb_private::FileSpec *file,
41                     lldb::addr_t offset,
42                     lldb::addr_t length);
43 
44     static bool
45     MagicBytesMatch (lldb::DataBufferSP& dataSP);
46 
47     //------------------------------------------------------------------
48     // Member Functions
49     //------------------------------------------------------------------
50     ObjectContainerUniversalMachO (lldb_private::Module* module,
51                                    lldb::DataBufferSP& dataSP,
52                                    const lldb_private::FileSpec *file,
53                                    lldb::addr_t offset,
54                                    lldb::addr_t length);
55 
56     virtual
57     ~ObjectContainerUniversalMachO();
58 
59     virtual bool
60     ParseHeader ();
61 
62     virtual void
63     Dump (lldb_private::Stream *s) const;
64 
65     virtual size_t
66     GetNumArchitectures () const;
67 
68     virtual bool
69     GetArchitectureAtIndex (uint32_t cpu_idx, lldb_private::ArchSpec& arch) const;
70 
71     virtual lldb::ObjectFileSP
72     GetObjectFile (const lldb_private::FileSpec *file);
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 protected:
87     llvm::MachO::fat_header m_header;
88     std::vector<llvm::MachO::fat_arch> m_fat_archs;
89 };
90 
91 #endif  // liblldb_ObjectContainerUniversalMachO_h_
92