Johnny Chen | c3fba81 | 2011-07-18 20:13:38 +0000 | [diff] [blame] | 1 | //===-- SWIG Interface for SBFrame ------------------------------*- 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 | "Represents one of the stack frames associated with a thread. |
Johnny Chen | 6d91e0a | 2011-07-19 01:07:06 +0000 | [diff] [blame] | 14 | SBThread contains SBFrame(s). For example (from test/lldbutil.py), |
| 15 | |
| 16 | def print_stacktrace(thread, string_buffer = False): |
| 17 | '''Prints a simple stack trace of this thread.''' |
| 18 | |
| 19 | ... |
| 20 | |
| 21 | for i in range(depth): |
| 22 | frame = thread.GetFrameAtIndex(i) |
| 23 | function = frame.GetFunction() |
| 24 | |
| 25 | load_addr = addrs[i].GetLoadAddress(target) |
| 26 | if not function: |
| 27 | file_addr = addrs[i].GetFileAddress() |
| 28 | start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress() |
| 29 | symbol_offset = file_addr - start_addr |
| 30 | print >> output, ' frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format( |
| 31 | num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset) |
| 32 | else: |
| 33 | print >> output, ' frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format( |
| 34 | num=i, addr=load_addr, mod=mods[i], |
| 35 | func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i], |
| 36 | file=files[i], line=lines[i], |
| 37 | args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()') |
| 38 | |
| 39 | ... |
| 40 | " |
Johnny Chen | c3fba81 | 2011-07-18 20:13:38 +0000 | [diff] [blame] | 41 | ) SBFrame; |
| 42 | class SBFrame |
| 43 | { |
| 44 | public: |
| 45 | SBFrame (); |
| 46 | |
| 47 | SBFrame (const lldb::SBFrame &rhs); |
| 48 | |
| 49 | ~SBFrame(); |
| 50 | |
| 51 | bool |
| 52 | IsValid() const; |
| 53 | |
| 54 | uint32_t |
| 55 | GetFrameID () const; |
| 56 | |
| 57 | lldb::addr_t |
| 58 | GetPC () const; |
| 59 | |
| 60 | bool |
| 61 | SetPC (lldb::addr_t new_pc); |
| 62 | |
| 63 | lldb::addr_t |
| 64 | GetSP () const; |
| 65 | |
| 66 | lldb::addr_t |
| 67 | GetFP () const; |
| 68 | |
| 69 | lldb::SBAddress |
| 70 | GetPCAddress () const; |
| 71 | |
| 72 | lldb::SBSymbolContext |
| 73 | GetSymbolContext (uint32_t resolve_scope) const; |
| 74 | |
| 75 | lldb::SBModule |
| 76 | GetModule () const; |
| 77 | |
| 78 | lldb::SBCompileUnit |
| 79 | GetCompileUnit () const; |
| 80 | |
| 81 | lldb::SBFunction |
| 82 | GetFunction () const; |
| 83 | |
| 84 | lldb::SBSymbol |
| 85 | GetSymbol () const; |
| 86 | |
| 87 | %feature("docstring", " |
| 88 | /// Gets the deepest block that contains the frame PC. |
| 89 | /// |
| 90 | /// See also GetFrameBlock(). |
| 91 | ") GetBlock; |
| 92 | lldb::SBBlock |
| 93 | GetBlock () const; |
| 94 | |
| 95 | %feature("docstring", " |
| 96 | /// Get the appropriate function name for this frame. Inlined functions in |
| 97 | /// LLDB are represented by Blocks that have inlined function information, so |
| 98 | /// just looking at the SBFunction or SBSymbol for a frame isn't enough. |
| 99 | /// This function will return the appriopriate function, symbol or inlined |
| 100 | /// function name for the frame. |
| 101 | /// |
| 102 | /// This function returns: |
| 103 | /// - the name of the inlined function (if there is one) |
| 104 | /// - the name of the concrete function (if there is one) |
| 105 | /// - the name of the symbol (if there is one) |
| 106 | /// - NULL |
| 107 | /// |
| 108 | /// See also IsInlined(). |
| 109 | ") GetFunctionName; |
| 110 | const char * |
| 111 | GetFunctionName(); |
| 112 | |
| 113 | %feature("docstring", " |
| 114 | /// Return true if this frame represents an inlined function. |
| 115 | /// |
| 116 | /// See also GetFunctionName(). |
| 117 | ") IsInlined; |
| 118 | bool |
| 119 | IsInlined(); |
| 120 | |
| 121 | %feature("docstring", " |
| 122 | /// The version that doesn't supply a 'use_dynamic' value will use the |
| 123 | /// target's default. |
| 124 | ") EvaluateExpression; |
| 125 | lldb::SBValue |
| 126 | EvaluateExpression (const char *expr); |
| 127 | |
| 128 | lldb::SBValue |
| 129 | EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic); |
| 130 | |
| 131 | %feature("docstring", " |
| 132 | /// Gets the lexical block that defines the stack frame. Another way to think |
| 133 | /// of this is it will return the block that contains all of the variables |
| 134 | /// for a stack frame. Inlined functions are represented as SBBlock objects |
| 135 | /// that have inlined function information: the name of the inlined function, |
| 136 | /// where it was called from. The block that is returned will be the first |
| 137 | /// block at or above the block for the PC (SBFrame::GetBlock()) that defines |
| 138 | /// the scope of the frame. When a function contains no inlined functions, |
| 139 | /// this will be the top most lexical block that defines the function. |
| 140 | /// When a function has inlined functions and the PC is currently |
| 141 | /// in one of those inlined functions, this method will return the inlined |
| 142 | /// block that defines this frame. If the PC isn't currently in an inlined |
| 143 | /// function, the lexical block that defines the function is returned. |
| 144 | ") GetFrameBlock; |
| 145 | lldb::SBBlock |
| 146 | GetFrameBlock () const; |
| 147 | |
| 148 | lldb::SBLineEntry |
| 149 | GetLineEntry () const; |
| 150 | |
| 151 | lldb::SBThread |
| 152 | GetThread () const; |
| 153 | |
| 154 | const char * |
| 155 | Disassemble () const; |
| 156 | |
| 157 | void |
| 158 | Clear(); |
| 159 | |
| 160 | #ifndef SWIG |
| 161 | bool |
| 162 | operator == (const lldb::SBFrame &rhs) const; |
| 163 | |
| 164 | bool |
| 165 | operator != (const lldb::SBFrame &rhs) const; |
| 166 | |
| 167 | #endif |
| 168 | |
| 169 | %feature("docstring", " |
| 170 | /// The version that doesn't supply a 'use_dynamic' value will use the |
| 171 | /// target's default. |
| 172 | ") GetVariables; |
| 173 | lldb::SBValueList |
| 174 | GetVariables (bool arguments, |
| 175 | bool locals, |
| 176 | bool statics, |
| 177 | bool in_scope_only); |
| 178 | |
| 179 | lldb::SBValueList |
| 180 | GetVariables (bool arguments, |
| 181 | bool locals, |
| 182 | bool statics, |
| 183 | bool in_scope_only, |
| 184 | lldb::DynamicValueType use_dynamic); |
| 185 | |
| 186 | lldb::SBValueList |
| 187 | GetRegisters (); |
| 188 | |
| 189 | %feature("docstring", " |
| 190 | /// The version that doesn't supply a 'use_dynamic' value will use the |
| 191 | /// target's default. |
| 192 | ") FindVariable; |
| 193 | lldb::SBValue |
| 194 | FindVariable (const char *var_name); |
| 195 | |
| 196 | lldb::SBValue |
| 197 | FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic); |
| 198 | |
| 199 | %feature("docstring", " |
| 200 | /// Find variables, register sets, registers, or persistent variables using |
| 201 | /// the frame as the scope. |
| 202 | /// |
| 203 | /// The version that doesn't supply a 'use_dynamic' value will use the |
| 204 | /// target's default. |
| 205 | ") FindValue; |
| 206 | lldb::SBValue |
| 207 | FindValue (const char *name, ValueType value_type); |
| 208 | |
| 209 | lldb::SBValue |
| 210 | FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic); |
| 211 | |
| 212 | bool |
| 213 | GetDescription (lldb::SBStream &description); |
| 214 | |
| 215 | }; |
| 216 | |
| 217 | } // namespace lldb |