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