16cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen//===-- SWIG Interface for SBCompileUnit ------------------------*- C++ -*-===//
26cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen//
36cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen//                     The LLVM Compiler Infrastructure
46cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen//
56cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen// This file is distributed under the University of Illinois Open Source
66cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen// License. See LICENSE.TXT for details.
76cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen//
86cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen//===----------------------------------------------------------------------===//
96cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
106cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chennamespace lldb {
116cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
126cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen%feature("docstring",
136cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen"Represents a compilation unit, or compiled source file.
146cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
156cf1bc333301e95ad5c96481d63b270eac7a7266Johnny ChenSBCompileUnit supports line entry iteration. For example,
166cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
1719334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen    # Now get the SBSymbolContext from this frame.  We want everything. :-)
1819334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen    context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
1919334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen    ...
2019334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen
2119334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen    compileUnit = context.GetCompileUnit()
2219334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen
236cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    for lineEntry in compileUnit:
246cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen        print 'line entry: %s:%d' % (str(lineEntry.GetFileSpec()),
256cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen                                    lineEntry.GetLine())
266cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen        print 'start addr: %s' % str(lineEntry.GetStartAddress())
276cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen        print 'end   addr: %s' % str(lineEntry.GetEndAddress())
286cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
296cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenproduces:
306cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
316cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenline entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:20
326cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenstart addr: a.out[0x100000d98]
336cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenend   addr: a.out[0x100000da3]
346cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenline entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:21
356cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenstart addr: a.out[0x100000da3]
366cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenend   addr: a.out[0x100000da9]
376cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenline entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:22
386cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenstart addr: a.out[0x100000da9]
396cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenend   addr: a.out[0x100000db6]
406cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenline entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:23
416cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenstart addr: a.out[0x100000db6]
426cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenend   addr: a.out[0x100000dbc]
436cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen...
4419334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen
4519334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny ChenSee also SBSymbolContext and SBLineEntry"
4619334f4fcb86e0005f9f7ba9ff03b5c9d795ff9dJohnny Chen) SBCompileUnit;
476cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenclass SBCompileUnit
486cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen{
496cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chenpublic:
506cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
516cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    SBCompileUnit ();
526cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
536cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    SBCompileUnit (const lldb::SBCompileUnit &rhs);
546cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
556cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    ~SBCompileUnit ();
566cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
576cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    bool
586cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    IsValid () const;
596cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
606cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    lldb::SBFileSpec
616cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    GetFileSpec () const;
626cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
636cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    uint32_t
646cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    GetNumLineEntries () const;
656cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
666cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    lldb::SBLineEntry
676cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    GetLineEntryAtIndex (uint32_t idx) const;
686cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
696cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    uint32_t
706cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    FindLineEntryIndex (uint32_t start_idx,
716cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen                        uint32_t line,
726cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen                        lldb::SBFileSpec *inline_file_spec) const;
736cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
74d6d47976b71187907c1cdeea86fabf7d5534314fJim Ingham    uint32_t
75d6d47976b71187907c1cdeea86fabf7d5534314fJim Ingham    FindLineEntryIndex (uint32_t start_idx,
76d6d47976b71187907c1cdeea86fabf7d5534314fJim Ingham                        uint32_t line,
77d6d47976b71187907c1cdeea86fabf7d5534314fJim Ingham                        lldb::SBFileSpec *inline_file_spec,
78d6d47976b71187907c1cdeea86fabf7d5534314fJim Ingham			bool exact) const;
79d6d47976b71187907c1cdeea86fabf7d5534314fJim Ingham
801dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen    SBFileSpec
811dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen    GetSupportFileAtIndex (uint32_t idx) const;
821dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen
831dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen    uint32_t
841dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen    GetNumSupportFiles () const;
851dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen
861dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen    uint32_t
871dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen    FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
881dbf2a82654bebe365eb882b2cad9af413418222Johnny Chen
89a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton    %feature("docstring", "
90a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     //------------------------------------------------------------------
91a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     /// Get all types matching \a type_mask from debug info in this
92a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     /// compile unit.
93a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///
94a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     /// @param[in] type_mask
95a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///    A bitfield that consists of one or more bits logically OR'ed
96a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///    together from the lldb::TypeClass enumeration. This allows
97a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///    you to request only structure types, or only class, struct
98a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///    and union types. Passing in lldb::eTypeClassAny will return
99a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///    all types found in the debug information for this compile
100a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///    unit.
101a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///
102a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     /// @return
103a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ///    A list of types in this compile unit that match \a type_mask
104a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     //------------------------------------------------------------------
105a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton     ") GetTypes;
106a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton    lldb::SBTypeList
107a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton    GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
108a8b56238ce138e70433a0ce0b4218c9257beae38Greg Clayton
1096cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    bool
1106cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen    GetDescription (lldb::SBStream &description);
1111b925206e3c4867fea9eb55a4c6460962cf32564Greg Clayton
1120765e3274aab0551fea7678bee565c7d68e0b786Enrico Granata    bool
1130765e3274aab0551fea7678bee565c7d68e0b786Enrico Granata    operator == (const lldb::SBCompileUnit &rhs) const;
1140765e3274aab0551fea7678bee565c7d68e0b786Enrico Granata
1150765e3274aab0551fea7678bee565c7d68e0b786Enrico Granata    bool
1160765e3274aab0551fea7678bee565c7d68e0b786Enrico Granata    operator != (const lldb::SBCompileUnit &rhs) const;
1170765e3274aab0551fea7678bee565c7d68e0b786Enrico Granata
1181b925206e3c4867fea9eb55a4c6460962cf32564Greg Clayton    %pythoncode %{
1191b925206e3c4867fea9eb55a4c6460962cf32564Greg Clayton        __swig_getmethods__["file"] = GetFileSpec
1202a94be1aa46c90d6749d8c96ed396d5ebde452cdGreg Clayton        if _newclass: file = property(GetFileSpec, None, doc='''A read only property that returns the same result an lldb object that represents the source file (lldb.SBFileSpec) for the compile unit.''')
1211b925206e3c4867fea9eb55a4c6460962cf32564Greg Clayton
1221b925206e3c4867fea9eb55a4c6460962cf32564Greg Clayton        __swig_getmethods__["num_line_entries"] = GetNumLineEntries
1232a94be1aa46c90d6749d8c96ed396d5ebde452cdGreg Clayton        if _newclass: num_line_entries = property(GetNumLineEntries, None, doc='''A read only property that returns the number of line entries in a compile unit as an integer.''')
1241b925206e3c4867fea9eb55a4c6460962cf32564Greg Clayton    %}
1256cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen};
1266cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen
1276cf1bc333301e95ad5c96481d63b270eac7a7266Johnny Chen} // namespace lldb
128