blob: 4bf7fe34788238c76241e42d073fee4a214aeed3 [file] [log] [blame]
Johnny Chen6d91e0a2011-07-19 01:07:06 +00001//===-- SWIG Interface for SBSymbolContext ----------------------*- 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"A context object that provides access to core debugger entities.
14
15Manay debugger functions require a context when doing lookups. This class
16provides a common structure that can be used as the result of a query that
17can contain a single result.
18
19For example,
20
21 exe = os.path.join(os.getcwd(), 'a.out')
22
23 # Create a target for the debugger.
24 target = self.dbg.CreateTarget(exe)
25
26 # Now create a breakpoint on main.c by name 'c'.
27 breakpoint = target.BreakpointCreateByName('c', 'a.out')
28
29 # Now launch the process, and do not stop at entry point.
30 process = target.LaunchSimple(None, None, os.getcwd())
31
32 # The inferior should stop on 'c'.
33 from lldbutil import get_stopped_thread
34 thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
35 frame0 = thread.GetFrameAtIndex(0)
36
37 # Now get the SBSymbolContext from this frame. We want everything. :-)
38 context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
39
40 # Get the module.
41 module = context.GetModule()
42 ...
43
44 # And the compile unit associated with the frame.
45 compileUnit = context.GetCompileUnit()
46 ...
47"
48) SBSymbolContext;
49class SBSymbolContext
50{
51public:
52 SBSymbolContext ();
53
54 SBSymbolContext (const lldb::SBSymbolContext& rhs);
55
56 ~SBSymbolContext ();
57
58 bool
59 IsValid () const;
60
Greg Clayton23b8abb2011-09-26 07:11:27 +000061 lldb::SBModule GetModule ();
62 lldb::SBCompileUnit GetCompileUnit ();
63 lldb::SBFunction GetFunction ();
64 lldb::SBBlock GetBlock ();
65 lldb::SBLineEntry GetLineEntry ();
66 lldb::SBSymbol GetSymbol ();
67
68 void SetModule (lldb::SBModule module);
69 void SetCompileUnit (lldb::SBCompileUnit compile_unit);
70 void SetFunction (lldb::SBFunction function);
71 void SetBlock (lldb::SBBlock block);
72 void SetLineEntry (lldb::SBLineEntry line_entry);
73 void SetSymbol (lldb::SBSymbol symbol);
74
75 lldb::SBSymbolContext
Greg Clayton2f57db02011-10-01 00:45:15 +000076 GetParentOfInlinedScope (const lldb::SBAddress &curr_frame_pc,
77 lldb::SBAddress &parent_frame_addr) const;
Greg Clayton23b8abb2011-09-26 07:11:27 +000078
Johnny Chen6d91e0a2011-07-19 01:07:06 +000079
80 bool
81 GetDescription (lldb::SBStream &description);
Greg Clayton7dd5c512012-02-06 01:44:54 +000082
83
84 %pythoncode %{
85 __swig_getmethods__["module"] = GetModule
86 __swig_setmethods__["module"] = SetModule
87 if _newclass: x = property(GetModule, SetModule)
88
89 __swig_getmethods__["compile_unit"] = GetCompileUnit
90 __swig_setmethods__["compile_unit"] = SetCompileUnit
91 if _newclass: x = property(GetCompileUnit, SetCompileUnit)
92
93 __swig_getmethods__["function"] = GetFunction
94 __swig_setmethods__["function"] = SetFunction
95 if _newclass: x = property(GetFunction, SetFunction)
96
97 __swig_getmethods__["block"] = GetBlock
98 __swig_setmethods__["block"] = SetBlock
99 if _newclass: x = property(GetBlock, SetBlock)
100
101 __swig_getmethods__["symbol"] = GetSymbol
102 __swig_setmethods__["symbol"] = SetSymbol
103 if _newclass: x = property(GetSymbol, SetSymbol)
104
105 __swig_getmethods__["line_entry"] = GetLineEntry
106 __swig_setmethods__["line_entry"] = SetLineEntry
107 if _newclass: x = property(GetLineEntry, SetLineEntry)
108 %}
109
Johnny Chen6d91e0a2011-07-19 01:07:06 +0000110};
111
112} // namespace lldb