1 //===-- SBModuleSpec.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 LLDB_SBModuleSpec_h_
11 #define LLDB_SBModuleSpec_h_
12 
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBFileSpec.h"
15 
16 namespace lldb {
17 
18 class LLDB_API SBModuleSpec {
19 public:
20   SBModuleSpec();
21 
22   SBModuleSpec(const SBModuleSpec &rhs);
23 
24   ~SBModuleSpec();
25 
26   const SBModuleSpec &operator=(const SBModuleSpec &rhs);
27 
28   bool IsValid() const;
29 
30   void Clear();
31 
32   //------------------------------------------------------------------
33   /// Get const accessor for the module file.
34   ///
35   /// This function returns the file for the module on the host system
36   /// that is running LLDB. This can differ from the path on the
37   /// platform since we might be doing remote debugging.
38   ///
39   /// @return
40   ///     A const reference to the file specification object.
41   //------------------------------------------------------------------
42   lldb::SBFileSpec GetFileSpec();
43 
44   void SetFileSpec(const lldb::SBFileSpec &fspec);
45 
46   //------------------------------------------------------------------
47   /// Get accessor for the module platform file.
48   ///
49   /// Platform file refers to the path of the module as it is known on
50   /// the remote system on which it is being debugged. For local
51   /// debugging this is always the same as Module::GetFileSpec(). But
52   /// remote debugging might mention a file '/usr/lib/liba.dylib'
53   /// which might be locally downloaded and cached. In this case the
54   /// platform file could be something like:
55   /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
56   /// The file could also be cached in a local developer kit directory.
57   ///
58   /// @return
59   ///     A const reference to the file specification object.
60   //------------------------------------------------------------------
61   lldb::SBFileSpec GetPlatformFileSpec();
62 
63   void SetPlatformFileSpec(const lldb::SBFileSpec &fspec);
64 
65   lldb::SBFileSpec GetSymbolFileSpec();
66 
67   void SetSymbolFileSpec(const lldb::SBFileSpec &fspec);
68 
69   const char *GetObjectName();
70 
71   void SetObjectName(const char *name);
72 
73   const char *GetTriple();
74 
75   void SetTriple(const char *triple);
76 
77   const uint8_t *GetUUIDBytes();
78 
79   size_t GetUUIDLength();
80 
81   bool SetUUIDBytes(const uint8_t *uuid, size_t uuid_len);
82 
83   bool GetDescription(lldb::SBStream &description);
84 
85 private:
86   friend class SBModuleSpecList;
87   friend class SBModule;
88   friend class SBTarget;
89 
90   std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap;
91 };
92 
93 class SBModuleSpecList {
94 public:
95   SBModuleSpecList();
96 
97   SBModuleSpecList(const SBModuleSpecList &rhs);
98 
99   ~SBModuleSpecList();
100 
101   SBModuleSpecList &operator=(const SBModuleSpecList &rhs);
102 
103   static SBModuleSpecList GetModuleSpecifications(const char *path);
104 
105   void Append(const SBModuleSpec &spec);
106 
107   void Append(const SBModuleSpecList &spec_list);
108 
109   SBModuleSpec FindFirstMatchingSpec(const SBModuleSpec &match_spec);
110 
111   SBModuleSpecList FindMatchingSpecs(const SBModuleSpec &match_spec);
112 
113   size_t GetSize();
114 
115   SBModuleSpec GetSpecAtIndex(size_t i);
116 
117   bool GetDescription(lldb::SBStream &description);
118 
119 private:
120   std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap;
121 };
122 
123 } // namespace lldb
124 
125 #endif // LLDB_SBModuleSpec_h_
126