Johnny Chen | 9a5b16b | 2011-07-18 19:15:22 +0000 | [diff] [blame] | 1 | //===-- SWIG Interface for SBValueList --------------------------*- C++ -*-===// |
Johnny Chen | 67ae7bd | 2011-07-18 19:08:30 +0000 | [diff] [blame] | 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 a collection of SBValues. Both SBFrame's GetVariables() and |
| 14 | GetRegisters() return a SBValueList. |
| 15 | |
| 16 | SBValueList supports SBValue iteration. For example (from test/lldbutil.py), |
| 17 | |
| 18 | def get_registers(frame, kind): |
| 19 | '''Returns the registers given the frame and the kind of registers desired. |
| 20 | |
| 21 | Returns None if there's no such kind. |
| 22 | ''' |
| 23 | registerSet = frame.GetRegisters() # Return type of SBValueList. |
| 24 | for value in registerSet: |
| 25 | if kind.lower() in value.GetName().lower(): |
| 26 | return value |
| 27 | |
| 28 | return None |
| 29 | |
| 30 | def get_GPRs(frame): |
| 31 | '''Returns the general purpose registers of the frame as an SBValue. |
| 32 | |
| 33 | The returned SBValue object is iterable. An example: |
| 34 | ... |
| 35 | from lldbutil import get_GPRs |
| 36 | regs = get_GPRs(frame) |
| 37 | for reg in regs: |
| 38 | print '%s => %s' % (reg.GetName(), reg.GetValue()) |
| 39 | ... |
| 40 | ''' |
| 41 | return get_registers(frame, 'general purpose') |
| 42 | |
| 43 | def get_FPRs(frame): |
| 44 | '''Returns the floating point registers of the frame as an SBValue. |
| 45 | |
| 46 | The returned SBValue object is iterable. An example: |
| 47 | ... |
| 48 | from lldbutil import get_FPRs |
| 49 | regs = get_FPRs(frame) |
| 50 | for reg in regs: |
| 51 | print '%s => %s' % (reg.GetName(), reg.GetValue()) |
| 52 | ... |
| 53 | ''' |
| 54 | return get_registers(frame, 'floating point') |
| 55 | |
| 56 | def get_ESRs(frame): |
| 57 | '''Returns the exception state registers of the frame as an SBValue. |
| 58 | |
| 59 | The returned SBValue object is iterable. An example: |
| 60 | ... |
| 61 | from lldbutil import get_ESRs |
| 62 | regs = get_ESRs(frame) |
| 63 | for reg in regs: |
| 64 | print '%s => %s' % (reg.GetName(), reg.GetValue()) |
| 65 | ... |
| 66 | ''' |
Johnny Chen | 357033b | 2011-07-18 20:13:38 +0000 | [diff] [blame] | 67 | return get_registers(frame, 'exception state')" |
| 68 | ) SBValueList; |
Johnny Chen | 67ae7bd | 2011-07-18 19:08:30 +0000 | [diff] [blame] | 69 | class SBValueList |
| 70 | { |
| 71 | public: |
| 72 | |
| 73 | SBValueList (); |
| 74 | |
| 75 | SBValueList (const lldb::SBValueList &rhs); |
| 76 | |
| 77 | ~SBValueList(); |
| 78 | |
| 79 | bool |
| 80 | IsValid() const; |
| 81 | |
| 82 | void |
| 83 | Append (const lldb::SBValue &val_obj); |
| 84 | |
| 85 | void |
| 86 | Append (const lldb::SBValueList& value_list); |
| 87 | |
| 88 | uint32_t |
| 89 | GetSize() const; |
| 90 | |
| 91 | lldb::SBValue |
| 92 | GetValueAtIndex (uint32_t idx) const; |
| 93 | |
| 94 | lldb::SBValue |
| 95 | FindValueObjectByUID (lldb::user_id_t uid); |
| 96 | }; |
| 97 | |
| 98 | } // namespace lldb |