Home | History | Annotate | Download | only in interface
      1 //===-- SWIG Interface for SBCompileUnit ------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 namespace lldb {
     11 
     12 %feature("docstring",
     13 "Represents a compilation unit, or compiled source file.
     14 
     15 SBCompileUnit supports line entry iteration. For example,
     16 
     17     # Now get the SBSymbolContext from this frame.  We want everything. :-)
     18     context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
     19     ...
     20 
     21     compileUnit = context.GetCompileUnit()
     22 
     23     for lineEntry in compileUnit:
     24         print 'line entry: %s:%d' % (str(lineEntry.GetFileSpec()),
     25                                     lineEntry.GetLine())
     26         print 'start addr: %s' % str(lineEntry.GetStartAddress())
     27         print 'end   addr: %s' % str(lineEntry.GetEndAddress())
     28 
     29 produces:
     30 
     31 line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:20
     32 start addr: a.out[0x100000d98]
     33 end   addr: a.out[0x100000da3]
     34 line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:21
     35 start addr: a.out[0x100000da3]
     36 end   addr: a.out[0x100000da9]
     37 line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:22
     38 start addr: a.out[0x100000da9]
     39 end   addr: a.out[0x100000db6]
     40 line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:23
     41 start addr: a.out[0x100000db6]
     42 end   addr: a.out[0x100000dbc]
     43 ...
     44 
     45 See also SBSymbolContext and SBLineEntry"
     46 ) SBCompileUnit;
     47 class SBCompileUnit
     48 {
     49 public:
     50 
     51     SBCompileUnit ();
     52 
     53     SBCompileUnit (const lldb::SBCompileUnit &rhs);
     54 
     55     ~SBCompileUnit ();
     56 
     57     bool
     58     IsValid () const;
     59 
     60     lldb::SBFileSpec
     61     GetFileSpec () const;
     62 
     63     uint32_t
     64     GetNumLineEntries () const;
     65 
     66     lldb::SBLineEntry
     67     GetLineEntryAtIndex (uint32_t idx) const;
     68 
     69     uint32_t
     70     FindLineEntryIndex (uint32_t start_idx,
     71                         uint32_t line,
     72                         lldb::SBFileSpec *inline_file_spec) const;
     73 
     74     uint32_t
     75     FindLineEntryIndex (uint32_t start_idx,
     76                         uint32_t line,
     77                         lldb::SBFileSpec *inline_file_spec,
     78 			bool exact) const;
     79 
     80     SBFileSpec
     81     GetSupportFileAtIndex (uint32_t idx) const;
     82 
     83     uint32_t
     84     GetNumSupportFiles () const;
     85 
     86     uint32_t
     87     FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
     88 
     89     %feature("docstring", "
     90      //------------------------------------------------------------------
     91      /// Get all types matching \a type_mask from debug info in this
     92      /// compile unit.
     93      ///
     94      /// @param[in] type_mask
     95      ///    A bitfield that consists of one or more bits logically OR'ed
     96      ///    together from the lldb::TypeClass enumeration. This allows
     97      ///    you to request only structure types, or only class, struct
     98      ///    and union types. Passing in lldb::eTypeClassAny will return
     99      ///    all types found in the debug information for this compile
    100      ///    unit.
    101      ///
    102      /// @return
    103      ///    A list of types in this compile unit that match \a type_mask
    104      //------------------------------------------------------------------
    105      ") GetTypes;
    106     lldb::SBTypeList
    107     GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
    108 
    109     bool
    110     GetDescription (lldb::SBStream &description);
    111 
    112     bool
    113     operator == (const lldb::SBCompileUnit &rhs) const;
    114 
    115     bool
    116     operator != (const lldb::SBCompileUnit &rhs) const;
    117 
    118     %pythoncode %{
    119         __swig_getmethods__["file"] = GetFileSpec
    120         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.''')
    121 
    122         __swig_getmethods__["num_line_entries"] = GetNumLineEntries
    123         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.''')
    124     %}
    125 };
    126 
    127 } // namespace lldb
    128