SBValueList.h revision edeaef152b894b3bb50490882bc1ff6967be4a75
1//===-- SBValueList.h -------------------------------------------*- 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#ifndef LLDB_SBValueList_h_
11#define LLDB_SBValueList_h_
12
13#include "lldb/API/SBDefines.h"
14
15namespace lldb {
16
17#ifdef SWIG
18%feature("docstring",
19"Represents a collection of SBValues.  Both SBFrame's GetVariables() and
20GetRegisters() return a SBValueList.
21
22For example (from test/lldbutil.py),
23
24def get_registers(frame, kind):
25    '''Returns the registers given the frame and the kind of registers desired.
26
27    Returns None if there's no such kind.
28    '''
29    registerSet = frame.GetRegisters() # Return type of SBValueList.
30    for value in registerSet:
31        if kind.lower() in value.GetName().lower():
32            return value
33
34    return None
35
36def get_GPRs(frame):
37    '''Returns the general purpose registers of the frame as an SBValue.
38
39    The returned SBValue object is iterable.  An example:
40        ...
41        from lldbutil import get_GPRs
42        regs = get_GPRs(frame)
43        for reg in regs:
44            print '%s => %s' % (reg.GetName(), reg.GetValue())
45        ...
46    '''
47    return get_registers(frame, 'general purpose')
48
49def get_FPRs(frame):
50    '''Returns the floating point registers of the frame as an SBValue.
51
52    The returned SBValue object is iterable.  An example:
53        ...
54        from lldbutil import get_FPRs
55        regs = get_FPRs(frame)
56        for reg in regs:
57            print '%s => %s' % (reg.GetName(), reg.GetValue())
58        ...
59    '''
60    return get_registers(frame, 'floating point')
61
62def get_ESRs(frame):
63    '''Returns the exception state registers of the frame as an SBValue.
64
65    The returned SBValue object is iterable.  An example:
66        ...
67        from lldbutil import get_ESRs
68        regs = get_ESRs(frame)
69        for reg in regs:
70            print '%s => %s' % (reg.GetName(), reg.GetValue())
71        ...
72    '''
73    return get_registers(frame, 'exception state')
74"
75         ) SBValueList;
76#endif
77class SBValueList
78{
79#ifdef SWIG
80    %feature("autodoc", "1");
81#endif
82public:
83
84    SBValueList ();
85
86    SBValueList (const lldb::SBValueList &rhs);
87
88    ~SBValueList();
89
90    bool
91    IsValid() const;
92
93    void
94    Append (const lldb::SBValue &val_obj);
95
96    void
97    Append (const lldb::SBValueList& value_list);
98
99    uint32_t
100    GetSize() const;
101
102    lldb::SBValue
103    GetValueAtIndex (uint32_t idx) const;
104
105    lldb::SBValue
106    FindValueObjectByUID (lldb::user_id_t uid);
107
108
109#ifndef SWIG
110    const lldb::SBValueList &
111    operator = (const lldb::SBValueList &rhs);
112
113    lldb_private::ValueObjectList *
114    operator -> ();
115
116    lldb_private::ValueObjectList &
117    operator* ();
118
119    const lldb_private::ValueObjectList *
120    operator -> () const;
121
122    const lldb_private::ValueObjectList &
123    operator* () const;
124
125    lldb_private::ValueObjectList *
126    get ();
127
128    lldb_private::ValueObjectList &
129    ref ();
130
131#endif
132
133private:
134    friend class SBFrame;
135
136    SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr);
137
138    void
139    Append (lldb::ValueObjectSP& val_obj_sp);
140
141    void
142    CreateIfNeeded ();
143
144    std::auto_ptr<lldb_private::ValueObjectList> m_opaque_ap;
145};
146
147
148} // namespace lldb
149
150#endif  // LLDB_SBValueList_h_
151