Johnny Chen | 6d91e0a | 2011-07-19 01:07:06 +0000 | [diff] [blame^] | 1 | //===-- 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 | |
| 10 | namespace lldb { |
| 11 | |
| 12 | %feature("docstring", |
| 13 | "A context object that provides access to core debugger entities. |
| 14 | |
| 15 | Manay debugger functions require a context when doing lookups. This class |
| 16 | provides a common structure that can be used as the result of a query that |
| 17 | can contain a single result. |
| 18 | |
| 19 | For 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; |
| 49 | class SBSymbolContext |
| 50 | { |
| 51 | public: |
| 52 | SBSymbolContext (); |
| 53 | |
| 54 | SBSymbolContext (const lldb::SBSymbolContext& rhs); |
| 55 | |
| 56 | ~SBSymbolContext (); |
| 57 | |
| 58 | bool |
| 59 | IsValid () const; |
| 60 | |
| 61 | SBModule GetModule (); |
| 62 | SBCompileUnit GetCompileUnit (); |
| 63 | SBFunction GetFunction (); |
| 64 | SBBlock GetBlock (); |
| 65 | SBLineEntry GetLineEntry (); |
| 66 | SBSymbol GetSymbol (); |
| 67 | |
| 68 | bool |
| 69 | GetDescription (lldb::SBStream &description); |
| 70 | }; |
| 71 | |
| 72 | } // namespace lldb |