SBModuleSpec.h revision f9215bae3f7f76ad98bace0097821a12415690c5
15d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines//===-- SBModuleSpec.h ------------------------------------------*- C++ -*-===//
22d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines//
32d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines//                     The LLVM Compiler Infrastructure
42d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines//
52d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines// This file is distributed under the University of Illinois Open Source
62d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines// License. See LICENSE.TXT for details.
72d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines//
82d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines//===----------------------------------------------------------------------===//
92d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines
102d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines#ifndef LLDB_SBModuleSpec_h_
112d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines#define LLDB_SBModuleSpec_h_
122d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines
132d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines#include "lldb/API/SBDefines.h"
142d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines#include "lldb/API/SBFileSpec.h"
152d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines
162d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hinesnamespace lldb {
172d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines
182d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hinesclass SBModuleSpec
192d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines{
202d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hinespublic:
212d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines
222d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines    SBModuleSpec ();
232d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines
242d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines    SBModuleSpec (const SBModuleSpec &rhs);
25
26    ~SBModuleSpec ();
27
28    const SBModuleSpec &
29    operator = (const SBModuleSpec &rhs);
30
31    bool
32    IsValid () const;
33
34    void
35    Clear();
36
37    //------------------------------------------------------------------
38    /// Get const accessor for the module file.
39    ///
40    /// This function returns the file for the module on the host system
41    /// that is running LLDB. This can differ from the path on the
42    /// platform since we might be doing remote debugging.
43    ///
44    /// @return
45    ///     A const reference to the file specification object.
46    //------------------------------------------------------------------
47    lldb::SBFileSpec
48    GetFileSpec ();
49
50    void
51    SetFileSpec (const lldb::SBFileSpec &fspec);
52
53    //------------------------------------------------------------------
54    /// Get accessor for the module platform file.
55    ///
56    /// Platform file refers to the path of the module as it is known on
57    /// the remote system on which it is being debugged. For local
58    /// debugging this is always the same as Module::GetFileSpec(). But
59    /// remote debugging might mention a file '/usr/lib/liba.dylib'
60    /// which might be locally downloaded and cached. In this case the
61    /// platform file could be something like:
62    /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
63    /// The file could also be cached in a local developer kit directory.
64    ///
65    /// @return
66    ///     A const reference to the file specification object.
67    //------------------------------------------------------------------
68    lldb::SBFileSpec
69    GetPlatformFileSpec ();
70
71    void
72    SetPlatformFileSpec (const lldb::SBFileSpec &fspec);
73
74    lldb::SBFileSpec
75    GetSymbolFileSpec ();
76
77    void
78    SetSymbolFileSpec (const lldb::SBFileSpec &fspec);
79
80    const char *
81    GetObjectName ();
82
83    void
84    SetObjectName (const char *name);
85
86    const char *
87    GetTriple ();
88
89    void
90    SetTriple (const char *triple);
91
92    const uint8_t *
93    GetUUIDBytes ();
94
95    size_t
96    GetUUIDLength ();
97
98    bool
99    SetUUIDBytes (const uint8_t *uuid, size_t uuid_len);
100
101    bool
102    GetDescription (lldb::SBStream &description);
103
104private:
105    friend class SBModuleSpecList;
106    friend class SBModule;
107    friend class SBTarget;
108
109    std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap;
110};
111
112class SBModuleSpecList
113{
114public:
115    SBModuleSpecList();
116
117    SBModuleSpecList (const SBModuleSpecList &rhs);
118
119    ~SBModuleSpecList();
120
121    SBModuleSpecList &
122    operator = (const SBModuleSpecList &rhs);
123
124    static SBModuleSpecList
125    GetModuleSpecifications (const char *path);
126
127    void
128    Append (const SBModuleSpec &spec);
129
130    void
131    Append (const SBModuleSpecList &spec_list);
132
133    SBModuleSpec
134    FindFirstMatchingSpec (const SBModuleSpec &match_spec);
135
136    SBModuleSpecList
137    FindMatchingSpecs (const SBModuleSpec &match_spec);
138
139    size_t
140    GetSize();
141
142    SBModuleSpec
143    GetSpecAtIndex (size_t i);
144
145    bool
146    GetDescription (lldb::SBStream &description);
147
148private:
149    std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap;
150};
151
152} // namespace lldb
153
154#endif // LLDB_SBModuleSpec_h_
155