blob: a9294ec5d97675a5d06048a41a54b0cea90b9364 [file] [log] [blame]
Johnny Chen6cf1bc32011-07-18 22:11:53 +00001//===-- 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
10namespace lldb {
11
12%feature("docstring",
13"Represents a compilation unit, or compiled source file.
14
15SBCompileUnit supports line entry iteration. For example,
16
Johnny Chen19334f42011-07-27 18:28:07 +000017 # Now get the SBSymbolContext from this frame. We want everything. :-)
18 context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
19 ...
20
21 compileUnit = context.GetCompileUnit()
22
Johnny Chen6cf1bc32011-07-18 22:11:53 +000023 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
29produces:
30
31line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:20
32start addr: a.out[0x100000d98]
33end addr: a.out[0x100000da3]
34line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:21
35start addr: a.out[0x100000da3]
36end addr: a.out[0x100000da9]
37line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:22
38start addr: a.out[0x100000da9]
39end addr: a.out[0x100000db6]
40line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:23
41start addr: a.out[0x100000db6]
42end addr: a.out[0x100000dbc]
43...
Johnny Chen19334f42011-07-27 18:28:07 +000044
45See also SBSymbolContext and SBLineEntry"
46) SBCompileUnit;
Johnny Chen6cf1bc32011-07-18 22:11:53 +000047class SBCompileUnit
48{
49public:
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