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