summaryrefslogtreecommitdiffstats
path: root/lldb/examples/python/sbvalue.py
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/examples/python/sbvalue.py
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/examples/python/sbvalue.py')
-rwxr-xr-xlldb/examples/python/sbvalue.py165
1 files changed, 89 insertions, 76 deletions
diff --git a/lldb/examples/python/sbvalue.py b/lldb/examples/python/sbvalue.py
index 59c0b61e552..6e512998da2 100755
--- a/lldb/examples/python/sbvalue.py
+++ b/lldb/examples/python/sbvalue.py
@@ -2,6 +2,7 @@
import lldb
+
class value(object):
'''A class that wraps an lldb.SBValue object and returns an object that
can be used as an object with attribytes:\n
@@ -24,6 +25,7 @@ class value(object):
argv.num_children - return the number of children this value has
argv.children - return a list of sbvalue objects that represents all of the children of this value
'''
+
def __init__(self, sbvalue):
self.sbvalue = sbvalue
@@ -37,10 +39,12 @@ class value(object):
return self.sbvalue.__str__()
def __getitem__(self, key):
- if type(key) is int:
- return value(self.sbvalue.GetChildAtIndex(key, lldb.eNoDynamicValues, True))
+ if isinstance(key, int):
+ return value(
+ self.sbvalue.GetChildAtIndex(
+ key, lldb.eNoDynamicValues, True))
raise TypeError
-
+
def __getattr__(self, name):
if name == 'name':
return self.sbvalue.GetName()
@@ -55,15 +59,15 @@ class value(object):
if name == 'is_pointer':
return self.sbvalue.TypeIsPointerType()
if name == 'format':
- return self.sbvalue.GetFormat ()
+ return self.sbvalue.GetFormat()
if name == 'value':
- return self.sbvalue.GetValue ()
+ return self.sbvalue.GetValue()
if name == 'summary':
- return self.sbvalue.GetSummary ()
+ return self.sbvalue.GetSummary()
if name == 'description':
- return self.sbvalue.GetObjectDescription ()
+ return self.sbvalue.GetObjectDescription()
if name == 'location':
- return self.sbvalue.GetLocation ()
+ return self.sbvalue.GetLocation()
if name == 'target':
return self.sbvalue.GetTarget()
if name == 'process':
@@ -75,18 +79,25 @@ class value(object):
if name == 'num_children':
return self.sbvalue.GetNumChildren()
if name == 'children':
- # Returns an array of sbvalue objects, one for each child of
+ # Returns an array of sbvalue objects, one for each child of
# the value for the lldb.SBValue
children = []
- for i in range (self.sbvalue.GetNumChildren()):
- children.append(value(self.sbvalue.GetChildAtIndex(i, lldb.eNoDynamicValues, True)))
+ for i in range(self.sbvalue.GetNumChildren()):
+ children.append(
+ value(
+ self.sbvalue.GetChildAtIndex(
+ i,
+ lldb.eNoDynamicValues,
+ True)))
return children
raise AttributeError
-
+
+
class variable(object):
'''A class that treats a lldb.SBValue and allows it to be used just as
- a variable would be in code. So if you have a Point structure variable
+ a variable would be in code. So if you have a Point structure variable
in your code, you would be able to do: "pt.x + pt.y"'''
+
def __init__(self, sbvalue):
self.sbvalue = sbvalue
@@ -101,155 +112,157 @@ class variable(object):
def __getitem__(self, key):
# Allow array access if this value has children...
- if type(key) is int:
- return variable(self.sbvalue.GetValueForExpressionPath("[%i]" % key))
+ if isinstance(key, int):
+ return variable(
+ self.sbvalue.GetValueForExpressionPath(
+ "[%i]" %
+ key))
raise TypeError
def __getattr__(self, name):
- child_sbvalue = self.sbvalue.GetChildMemberWithName (name)
+ child_sbvalue = self.sbvalue.GetChildMemberWithName(name)
if child_sbvalue:
return variable(child_sbvalue)
raise AttributeError
def __add__(self, other):
return int(self) + int(other)
-
+
def __sub__(self, other):
return int(self) - int(other)
-
+
def __mul__(self, other):
return int(self) * int(other)
-
+
def __floordiv__(self, other):
return int(self) // int(other)
-
+
def __mod__(self, other):
return int(self) % int(other)
-
+
def __divmod__(self, other):
return int(self) % int(other)
-
+
def __pow__(self, other):
return int(self) ** int(other)
-
+
def __lshift__(self, other):
return int(self) << int(other)
-
+
def __rshift__(self, other):
return int(self) >> int(other)
-
+
def __and__(self, other):
return int(self) & int(other)
-
+
def __xor__(self, other):
return int(self) ^ int(other)
-
+
def __or__(self, other):
return int(self) | int(other)
-
+
def __div__(self, other):
return int(self) / int(other)
-
+
def __truediv__(self, other):
return int(self) / int(other)
-
+
def __iadd__(self, other):
result = self.__add__(other)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __isub__(self, other):
result = self.__sub__(other)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __imul__(self, other):
result = self.__mul__(other)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __idiv__(self, other):
result = self.__div__(other)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __itruediv__(self, other):
result = self.__truediv__(other)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __ifloordiv__(self, other):
- result = self.__floordiv__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ result = self.__floordiv__(self, other)
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __imod__(self, other):
- result = self.__and__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ result = self.__and__(self, other)
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __ipow__(self, other):
result = self.__pow__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __ipow__(self, other, modulo):
result = self.__pow__(self, other, modulo)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __ilshift__(self, other):
result = self.__lshift__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __irshift__(self, other):
- result = self.__rshift__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ result = self.__rshift__(self, other)
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __iand__(self, other):
- result = self.__and__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ result = self.__and__(self, other)
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __ixor__(self, other):
- result = self.__xor__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ result = self.__xor__(self, other)
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __ior__(self, other):
- result = self.__ior__(self, other)
- self.sbvalue.SetValueFromCString (str(result))
+ result = self.__ior__(self, other)
+ self.sbvalue.SetValueFromCString(str(result))
return result
-
+
def __neg__(self):
return -int(self)
-
+
def __pos__(self):
return +int(self)
-
+
def __abs__(self):
return abs(int(self))
-
+
def __invert__(self):
return ~int(self)
-
+
def __complex__(self):
- return complex (int(self))
-
+ return complex(int(self))
+
def __int__(self):
return self.sbvalue.GetValueAsSigned()
-
+
def __long__(self):
return self.sbvalue.GetValueAsSigned()
-
+
def __float__(self):
- return float (self.sbvalue.GetValueAsSigned())
-
+ return float(self.sbvalue.GetValueAsSigned())
+
def __oct__(self):
return '0%o' % self.sbvalue.GetValueAsSigned()
-
+
def __hex__(self):
return '0x%x' % self.sbvalue.GetValueAsSigned()
- \ No newline at end of file
OpenPOWER on IntegriCloud