xref: /llvm-project/lldb/bindings/interface/SBValueListDocstrings.i (revision 662548c82683bd8657a3179afee693c4965a3dfd)
1*662548c8SAlex Langford %feature("docstring",
2*662548c8SAlex Langford "Represents a collection of SBValues.  Both :py:class:`SBFrame.GetVariables()` and
3*662548c8SAlex Langford :py:class:`SBFrame.GetRegisters()` return a SBValueList.
4*662548c8SAlex Langford 
5*662548c8SAlex Langford SBValueList supports :py:class:`SBValue` iteration. For example (from test/lldbutil.py),::
6*662548c8SAlex Langford 
7*662548c8SAlex Langford     def get_registers(frame, kind):
8*662548c8SAlex Langford         '''Returns the registers given the frame and the kind of registers desired.
9*662548c8SAlex Langford 
10*662548c8SAlex Langford         Returns None if there's no such kind.
11*662548c8SAlex Langford         '''
12*662548c8SAlex Langford         registerSet = frame.GetRegisters() # Return type of SBValueList.
13*662548c8SAlex Langford         for value in registerSet:
14*662548c8SAlex Langford             if kind.lower() in value.GetName().lower():
15*662548c8SAlex Langford                 return value
16*662548c8SAlex Langford 
17*662548c8SAlex Langford         return None
18*662548c8SAlex Langford 
19*662548c8SAlex Langford     def get_GPRs(frame):
20*662548c8SAlex Langford         '''Returns the general purpose registers of the frame as an SBValue.
21*662548c8SAlex Langford 
22*662548c8SAlex Langford         The returned SBValue object is iterable.  An example:
23*662548c8SAlex Langford             ...
24*662548c8SAlex Langford             from lldbutil import get_GPRs
25*662548c8SAlex Langford             regs = get_GPRs(frame)
26*662548c8SAlex Langford             for reg in regs:
27*662548c8SAlex Langford                 print('%s => %s' % (reg.GetName(), reg.GetValue()))
28*662548c8SAlex Langford             ...
29*662548c8SAlex Langford         '''
30*662548c8SAlex Langford         return get_registers(frame, 'general purpose')
31*662548c8SAlex Langford 
32*662548c8SAlex Langford     def get_FPRs(frame):
33*662548c8SAlex Langford         '''Returns the floating point registers of the frame as an SBValue.
34*662548c8SAlex Langford 
35*662548c8SAlex Langford         The returned SBValue object is iterable.  An example:
36*662548c8SAlex Langford             ...
37*662548c8SAlex Langford             from lldbutil import get_FPRs
38*662548c8SAlex Langford             regs = get_FPRs(frame)
39*662548c8SAlex Langford             for reg in regs:
40*662548c8SAlex Langford                 print('%s => %s' % (reg.GetName(), reg.GetValue()))
41*662548c8SAlex Langford             ...
42*662548c8SAlex Langford         '''
43*662548c8SAlex Langford         return get_registers(frame, 'floating point')
44*662548c8SAlex Langford 
45*662548c8SAlex Langford     def get_ESRs(frame):
46*662548c8SAlex Langford         '''Returns the exception state registers of the frame as an SBValue.
47*662548c8SAlex Langford 
48*662548c8SAlex Langford         The returned SBValue object is iterable.  An example:
49*662548c8SAlex Langford             ...
50*662548c8SAlex Langford             from lldbutil import get_ESRs
51*662548c8SAlex Langford             regs = get_ESRs(frame)
52*662548c8SAlex Langford             for reg in regs:
53*662548c8SAlex Langford                 print('%s => %s' % (reg.GetName(), reg.GetValue()))
54*662548c8SAlex Langford             ...
55*662548c8SAlex Langford         '''
56*662548c8SAlex Langford         return get_registers(frame, 'exception state')
57*662548c8SAlex Langford "
58*662548c8SAlex Langford ) lldb::SBValueList;
59