xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBSymbolContextDocstrings.i (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 %feature("docstring",
2 "A context object that provides access to core debugger entities.
3 
4 Many debugger functions require a context when doing lookups. This class
5 provides a common structure that can be used as the result of a query that
6 can contain a single result.
7 
8 For example, ::
9 
10         exe = os.path.join(os.getcwd(), 'a.out')
11 
12         # Create a target for the debugger.
13         target = self.dbg.CreateTarget(exe)
14 
15         # Now create a breakpoint on main.c by name 'c'.
16         breakpoint = target.BreakpointCreateByName('c', 'a.out')
17 
18         # Now launch the process, and do not stop at entry point.
19         process = target.LaunchSimple(None, None, os.getcwd())
20 
21         # The inferior should stop on 'c'.
22         from lldbutil import get_stopped_thread
23         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
24         frame0 = thread.GetFrameAtIndex(0)
25 
26         # Now get the SBSymbolContext from this frame.  We want everything. :-)
27         context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
28 
29         # Get the module.
30         module = context.GetModule()
31         ...
32 
33         # And the compile unit associated with the frame.
34         compileUnit = context.GetCompileUnit()
35         ...
36 "
37 ) lldb::SBSymbolContext;
38