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