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