Johnny Chen | 6cf1bc3 | 2011-07-18 22:11:53 +0000 | [diff] [blame] | 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 | |
Johnny Chen | 19334f4 | 2011-07-27 18:28:07 +0000 | [diff] [blame] | 17 | # Now get the SBSymbolContext from this frame. We want everything. :-) |
| 18 | context = frame0.GetSymbolContext(lldb.eSymbolContextEverything) |
| 19 | ... |
| 20 | |
| 21 | compileUnit = context.GetCompileUnit() |
| 22 | |
Johnny Chen | 6cf1bc3 | 2011-07-18 22:11:53 +0000 | [diff] [blame] | 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 | ... |
Johnny Chen | 19334f4 | 2011-07-27 18:28:07 +0000 | [diff] [blame] | 44 | |
| 45 | See also SBSymbolContext and SBLineEntry" |
| 46 | ) SBCompileUnit; |
Johnny Chen | 6cf1bc3 | 2011-07-18 22:11:53 +0000 | [diff] [blame] | 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 | bool |
| 75 | GetDescription (lldb::SBStream &description); |
| 76 | }; |
| 77 | |
| 78 | } // namespace lldb |