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
15namespace lldb {
16
17class LLDB_API SBModuleSpec {
18public:
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  bool GetDescription(lldb::SBStream &description);
81
82private:
83  friend class SBModuleSpecList;
84  friend class SBModule;
85  friend class SBTarget;
86
87  std::unique_ptr<lldb_private::ModuleSpec> m_opaque_up;
88};
89
90class SBModuleSpecList {
91public:
92  SBModuleSpecList();
93
94  SBModuleSpecList(const SBModuleSpecList &rhs);
95
96  ~SBModuleSpecList();
97
98  SBModuleSpecList &operator=(const SBModuleSpecList &rhs);
99
100  static SBModuleSpecList GetModuleSpecifications(const char *path);
101
102  void Append(const SBModuleSpec &spec);
103
104  void Append(const SBModuleSpecList &spec_list);
105
106  SBModuleSpec FindFirstMatchingSpec(const SBModuleSpec &match_spec);
107
108  SBModuleSpecList FindMatchingSpecs(const SBModuleSpec &match_spec);
109
110  size_t GetSize();
111
112  SBModuleSpec GetSpecAtIndex(size_t i);
113
114  bool GetDescription(lldb::SBStream &description);
115
116private:
117  std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_up;
118};
119
120} // namespace lldb
121
122#endif // LLDB_API_SBMODULESPEC_H
123