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_API_SBMODULESPEC_H 10 #define LLDB_API_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 explicit operator bool() const; 28 29 bool IsValid() const; 30 31 void Clear(); 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 lldb::SBFileSpec GetFileSpec(); 42 43 void SetFileSpec(const lldb::SBFileSpec &fspec); 44 45 /// Get accessor for the module platform file. 46 /// 47 /// Platform file refers to the path of the module as it is known on 48 /// the remote system on which it is being debugged. For local 49 /// debugging this is always the same as Module::GetFileSpec(). But 50 /// remote debugging might mention a file '/usr/lib/liba.dylib' 51 /// which might be locally downloaded and cached. In this case the 52 /// platform file could be something like: 53 /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib' 54 /// The file could also be cached in a local developer kit directory. 55 /// 56 /// \return 57 /// A const reference to the file specification object. 58 lldb::SBFileSpec GetPlatformFileSpec(); 59 60 void SetPlatformFileSpec(const lldb::SBFileSpec &fspec); 61 62 lldb::SBFileSpec GetSymbolFileSpec(); 63 64 void SetSymbolFileSpec(const lldb::SBFileSpec &fspec); 65 66 const char *GetObjectName(); 67 68 void SetObjectName(const char *name); 69 70 const char *GetTriple(); 71 72 void SetTriple(const char *triple); 73 74 const uint8_t *GetUUIDBytes(); 75 76 size_t GetUUIDLength(); 77 78 bool SetUUIDBytes(const uint8_t *uuid, size_t uuid_len); 79 80 uint64_t GetObjectOffset(); 81 82 void SetObjectOffset(uint64_t object_offset); 83 84 uint64_t GetObjectSize(); 85 86 void SetObjectSize(uint64_t object_size); 87 88 bool GetDescription(lldb::SBStream &description); 89 90 private: 91 friend class SBModuleSpecList; 92 friend class SBModule; 93 friend class SBPlatform; 94 friend class SBTarget; 95 96 SBModuleSpec(const lldb_private::ModuleSpec &module_spec); 97 98 std::unique_ptr<lldb_private::ModuleSpec> m_opaque_up; 99 }; 100 101 class SBModuleSpecList { 102 public: 103 SBModuleSpecList(); 104 105 SBModuleSpecList(const SBModuleSpecList &rhs); 106 107 ~SBModuleSpecList(); 108 109 SBModuleSpecList &operator=(const SBModuleSpecList &rhs); 110 111 static SBModuleSpecList GetModuleSpecifications(const char *path); 112 113 void Append(const SBModuleSpec &spec); 114 115 void Append(const SBModuleSpecList &spec_list); 116 117 SBModuleSpec FindFirstMatchingSpec(const SBModuleSpec &match_spec); 118 119 SBModuleSpecList FindMatchingSpecs(const SBModuleSpec &match_spec); 120 121 size_t GetSize(); 122 123 SBModuleSpec GetSpecAtIndex(size_t i); 124 125 bool GetDescription(lldb::SBStream &description); 126 127 private: 128 std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_up; 129 }; 130 131 } // namespace lldb 132 133 #endif // LLDB_API_SBMODULESPEC_H 134