1061da546Spatrick%extend lldb::SBBreakpoint { 2061da546Spatrick %pythoncode %{ 3061da546Spatrick def __eq__(self, rhs): 4061da546Spatrick if not isinstance(rhs, type(self)): 5061da546Spatrick return False 6061da546Spatrick 7061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 8061da546Spatrick 9061da546Spatrick def __ne__(self, rhs): 10061da546Spatrick if not isinstance(rhs, type(self)): 11061da546Spatrick return True 12061da546Spatrick 13061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 14061da546Spatrick %} 15061da546Spatrick} 16061da546Spatrick 17061da546Spatrick%extend lldb::SBBroadcaster { 18061da546Spatrick %pythoncode %{ 19061da546Spatrick def __eq__(self, rhs): 20061da546Spatrick if not isinstance(rhs, type(self)): 21061da546Spatrick return False 22061da546Spatrick 23061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 24061da546Spatrick 25061da546Spatrick def __ne__(self, rhs): 26061da546Spatrick if not isinstance(rhs, type(self)): 27061da546Spatrick return True 28061da546Spatrick 29061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 30061da546Spatrick %} 31061da546Spatrick} 32061da546Spatrick 33061da546Spatrick%extend lldb::SBCommandReturnObject { 34061da546Spatrick /* the write() and flush() calls are not part of the SB API proper, and are solely for Python usage 35061da546Spatrick they are meant to make an SBCommandReturnObject into a file-like object so that instructions of the sort 36061da546Spatrick print >>sb_command_return_object, "something" 37061da546Spatrick will work correctly */ 38061da546Spatrick 39061da546Spatrick void lldb::SBCommandReturnObject::write (const char* str) 40061da546Spatrick { 41061da546Spatrick if (str) 42061da546Spatrick $self->Printf("%s",str); 43061da546Spatrick } 44061da546Spatrick void lldb::SBCommandReturnObject::flush () 45061da546Spatrick {} 46061da546Spatrick} 47061da546Spatrick 48061da546Spatrick%extend lldb::SBCompileUnit { 49061da546Spatrick %pythoncode %{ 50061da546Spatrick def __eq__(self, rhs): 51061da546Spatrick if not isinstance(rhs, type(self)): 52061da546Spatrick return False 53061da546Spatrick 54061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 55061da546Spatrick 56061da546Spatrick def __ne__(self, rhs): 57061da546Spatrick if not isinstance(rhs, type(self)): 58061da546Spatrick return True 59061da546Spatrick 60061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 61061da546Spatrick %} 62061da546Spatrick} 63061da546Spatrick 64061da546Spatrick%extend lldb::SBDeclaration { 65061da546Spatrick %pythoncode %{ 66061da546Spatrick def __eq__(self, rhs): 67061da546Spatrick if not isinstance(rhs, type(self)): 68061da546Spatrick return False 69061da546Spatrick 70061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 71061da546Spatrick 72061da546Spatrick def __ne__(self, rhs): 73061da546Spatrick if not isinstance(rhs, type(self)): 74061da546Spatrick return True 75061da546Spatrick 76061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 77061da546Spatrick %} 78061da546Spatrick} 79061da546Spatrick 80061da546Spatrick%extend lldb::SBFunction { 81061da546Spatrick %pythoncode %{ 82061da546Spatrick def __eq__(self, rhs): 83061da546Spatrick if not isinstance(rhs, type(self)): 84061da546Spatrick return False 85061da546Spatrick 86061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 87061da546Spatrick 88061da546Spatrick def __ne__(self, rhs): 89061da546Spatrick if not isinstance(rhs, type(self)): 90061da546Spatrick return True 91061da546Spatrick 92061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 93061da546Spatrick %} 94061da546Spatrick} 95061da546Spatrick 96061da546Spatrick%extend lldb::SBLineEntry { 97061da546Spatrick %pythoncode %{ 98061da546Spatrick def __eq__(self, rhs): 99061da546Spatrick if not isinstance(rhs, type(self)): 100061da546Spatrick return False 101061da546Spatrick 102061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 103061da546Spatrick 104061da546Spatrick def __ne__(self, rhs): 105061da546Spatrick if not isinstance(rhs, type(self)): 106061da546Spatrick return True 107061da546Spatrick 108061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 109061da546Spatrick %} 110061da546Spatrick} 111061da546Spatrick 112061da546Spatrick%extend lldb::SBModule { 113061da546Spatrick %pythoncode %{ 114061da546Spatrick def __eq__(self, rhs): 115061da546Spatrick if not isinstance(rhs, type(self)): 116061da546Spatrick return False 117061da546Spatrick 118061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 119061da546Spatrick 120061da546Spatrick def __ne__(self, rhs): 121061da546Spatrick if not isinstance(rhs, type(self)): 122061da546Spatrick return True 123061da546Spatrick 124061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 125061da546Spatrick %} 126061da546Spatrick} 127061da546Spatrick 128061da546Spatrick%extend lldb::SBSection { 129061da546Spatrick %pythoncode %{ 130061da546Spatrick def __eq__(self, rhs): 131061da546Spatrick if not isinstance(rhs, type(self)): 132061da546Spatrick return False 133061da546Spatrick 134061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 135061da546Spatrick 136061da546Spatrick def __ne__(self, rhs): 137061da546Spatrick if not isinstance(rhs, type(self)): 138061da546Spatrick return True 139061da546Spatrick 140061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 141061da546Spatrick %} 142061da546Spatrick} 143061da546Spatrick%extend lldb::SBStream { 144061da546Spatrick /* the write() and flush() calls are not part of the SB API proper, and are solely for Python usage 145061da546Spatrick they are meant to make an SBStream into a file-like object so that instructions of the sort 146061da546Spatrick print >>sb_stream, "something" 147061da546Spatrick will work correctly */ 148061da546Spatrick 149061da546Spatrick void lldb::SBStream::write (const char* str) 150061da546Spatrick { 151061da546Spatrick if (str) 152061da546Spatrick $self->Printf("%s",str); 153061da546Spatrick } 154061da546Spatrick void lldb::SBStream::flush () 155061da546Spatrick {} 156061da546Spatrick} 157061da546Spatrick%extend lldb::SBSymbol { 158061da546Spatrick %pythoncode %{ 159061da546Spatrick def __eq__(self, rhs): 160061da546Spatrick if not isinstance(rhs, type(self)): 161061da546Spatrick return False 162061da546Spatrick 163061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 164061da546Spatrick 165061da546Spatrick def __ne__(self, rhs): 166061da546Spatrick if not isinstance(rhs, type(self)): 167061da546Spatrick return True 168061da546Spatrick 169061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 170061da546Spatrick %} 171061da546Spatrick} 172061da546Spatrick 173061da546Spatrick%extend lldb::SBTarget { 174061da546Spatrick %pythoncode %{ 175061da546Spatrick def __eq__(self, rhs): 176061da546Spatrick if not isinstance(rhs, type(self)): 177061da546Spatrick return False 178061da546Spatrick 179061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 180061da546Spatrick 181061da546Spatrick def __ne__(self, rhs): 182061da546Spatrick if not isinstance(rhs, type(self)): 183061da546Spatrick return True 184061da546Spatrick 185061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 186061da546Spatrick %} 187061da546Spatrick} 188061da546Spatrick 189061da546Spatrick%extend lldb::SBTypeFilter { 190061da546Spatrick %pythoncode %{ 191061da546Spatrick def __eq__(self, rhs): 192061da546Spatrick if not isinstance(rhs, type(self)): 193061da546Spatrick return False 194061da546Spatrick 195061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 196061da546Spatrick 197061da546Spatrick def __ne__(self, rhs): 198061da546Spatrick if not isinstance(rhs, type(self)): 199061da546Spatrick return True 200061da546Spatrick 201061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 202061da546Spatrick %} 203061da546Spatrick} 204061da546Spatrick 205061da546Spatrick%extend lldb::SBTypeNameSpecifier { 206061da546Spatrick %pythoncode %{ 207061da546Spatrick def __eq__(self, rhs): 208061da546Spatrick if not isinstance(rhs, type(self)): 209061da546Spatrick return False 210061da546Spatrick 211061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 212061da546Spatrick 213061da546Spatrick def __ne__(self, rhs): 214061da546Spatrick if not isinstance(rhs, type(self)): 215061da546Spatrick return True 216061da546Spatrick 217061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 218061da546Spatrick %} 219061da546Spatrick} 220061da546Spatrick 221061da546Spatrick%extend lldb::SBTypeSummary { 222061da546Spatrick %pythoncode %{ 223061da546Spatrick def __eq__(self, rhs): 224061da546Spatrick if not isinstance(rhs, type(self)): 225061da546Spatrick return False 226061da546Spatrick 227061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 228061da546Spatrick 229061da546Spatrick def __ne__(self, rhs): 230061da546Spatrick if not isinstance(rhs, type(self)): 231061da546Spatrick return True 232061da546Spatrick 233061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 234061da546Spatrick %} 235061da546Spatrick} 236061da546Spatrick 237061da546Spatrick%extend lldb::SBTypeSynthetic { 238061da546Spatrick %pythoncode %{ 239061da546Spatrick def __eq__(self, rhs): 240061da546Spatrick if not isinstance(rhs, type(self)): 241061da546Spatrick return False 242061da546Spatrick 243061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 244061da546Spatrick 245061da546Spatrick def __ne__(self, rhs): 246061da546Spatrick if not isinstance(rhs, type(self)): 247061da546Spatrick return True 248061da546Spatrick 249061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 250061da546Spatrick %} 251061da546Spatrick} 252061da546Spatrick 253061da546Spatrick%extend lldb::SBThread { 254061da546Spatrick %pythoncode %{ 255061da546Spatrick def __eq__(self, rhs): 256061da546Spatrick if not isinstance(rhs, type(self)): 257061da546Spatrick return False 258061da546Spatrick 259061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs) 260061da546Spatrick 261061da546Spatrick def __ne__(self, rhs): 262061da546Spatrick if not isinstance(rhs, type(self)): 263061da546Spatrick return True 264061da546Spatrick 265061da546Spatrick return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) 266061da546Spatrick %} 267061da546Spatrick} 268061da546Spatrick 269061da546Spatrick%pythoncode %{ 270061da546Spatrick 271061da546Spatrickdef command(command_name=None, doc=None): 272061da546Spatrick import lldb 273061da546Spatrick """A decorator function that registers an LLDB command line 274061da546Spatrick command that is bound to the function it is attached to.""" 275061da546Spatrick def callable(function): 276061da546Spatrick """Registers an lldb command for the decorated function.""" 277061da546Spatrick command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name or function.__name__) 278061da546Spatrick lldb.debugger.HandleCommand(command) 279061da546Spatrick if doc: 280061da546Spatrick function.__doc__ = doc 281061da546Spatrick return function 282061da546Spatrick 283061da546Spatrick return callable 284061da546Spatrick 285061da546Spatrickclass declaration(object): 286061da546Spatrick '''A class that represents a source declaration location with file, line and column.''' 287061da546Spatrick def __init__(self, file, line, col): 288061da546Spatrick self.file = file 289061da546Spatrick self.line = line 290061da546Spatrick self.col = col 291061da546Spatrick 292061da546Spatrickclass value_iter(object): 293be691f3bSpatrick '''Allows iterating over the children of an :py:class:`SBValue`.''' 294061da546Spatrick def __iter__(self): 295061da546Spatrick return self 296061da546Spatrick 297061da546Spatrick def __next__(self): 298061da546Spatrick if self.index >= self.length: 299061da546Spatrick raise StopIteration() 300061da546Spatrick child_sbvalue = self.sbvalue.GetChildAtIndex(self.index) 301061da546Spatrick self.index += 1 302061da546Spatrick return value(child_sbvalue) 303061da546Spatrick 304061da546Spatrick def next(self): 305061da546Spatrick return self.__next__() 306061da546Spatrick 307061da546Spatrick def __init__(self,value): 308061da546Spatrick self.index = 0 309061da546Spatrick self.sbvalue = value 310061da546Spatrick if type(self.sbvalue) is value: 311061da546Spatrick self.sbvalue = self.sbvalue.sbvalue 312061da546Spatrick self.length = self.sbvalue.GetNumChildren() 313061da546Spatrick 314061da546Spatrickclass value(object): 315be691f3bSpatrick '''Wraps :py:class:`SBValue` objects so the resulting object can be used as a variable would be in code. 316be691f3bSpatrick 317be691f3bSpatrick So if you have a Point structure variable in your code in the current frame named "pt", 318be691f3bSpatrick you can initialize an instance of this class with it: :: 319061da546Spatrick 320061da546Spatrick pt = lldb.value(lldb.frame.FindVariable("pt")) 321061da546Spatrick print pt 322061da546Spatrick print pt.x 323061da546Spatrick print pt.y 324061da546Spatrick 325061da546Spatrick pt = lldb.value(lldb.frame.FindVariable("rectangle_array")) 326061da546Spatrick print rectangle_array[12] 327061da546Spatrick print rectangle_array[5].origin.x''' 328061da546Spatrick def __init__(self, sbvalue): 329061da546Spatrick self.sbvalue = sbvalue 330061da546Spatrick 331061da546Spatrick def __nonzero__(self): 332061da546Spatrick return self.sbvalue.__nonzero__() 333061da546Spatrick 334061da546Spatrick def __bool__(self): 335061da546Spatrick return self.sbvalue.__bool__() 336061da546Spatrick 337061da546Spatrick def __str__(self): 338061da546Spatrick return self.sbvalue.__str__() 339061da546Spatrick 340061da546Spatrick def __getitem__(self, key): 341061da546Spatrick # Allow array access if this value has children... 342061da546Spatrick if type(key) is value: 343061da546Spatrick key = int(key) 344061da546Spatrick if type(key) is int: 345061da546Spatrick child_sbvalue = (self.sbvalue.GetValueForExpressionPath("[%i]" % key)) 346061da546Spatrick if child_sbvalue and child_sbvalue.IsValid(): 347061da546Spatrick return value(child_sbvalue) 348061da546Spatrick raise IndexError("Index '%d' is out of range" % key) 349061da546Spatrick raise TypeError("No array item of type %s" % str(type(key))) 350061da546Spatrick 351061da546Spatrick def __iter__(self): 352061da546Spatrick return value_iter(self.sbvalue) 353061da546Spatrick 354061da546Spatrick def __getattr__(self, name): 355061da546Spatrick child_sbvalue = self.sbvalue.GetChildMemberWithName (name) 356061da546Spatrick if child_sbvalue and child_sbvalue.IsValid(): 357061da546Spatrick return value(child_sbvalue) 358061da546Spatrick raise AttributeError("Attribute '%s' is not defined" % name) 359061da546Spatrick 360061da546Spatrick def __add__(self, other): 361061da546Spatrick return int(self) + int(other) 362061da546Spatrick 363061da546Spatrick def __sub__(self, other): 364061da546Spatrick return int(self) - int(other) 365061da546Spatrick 366061da546Spatrick def __mul__(self, other): 367061da546Spatrick return int(self) * int(other) 368061da546Spatrick 369061da546Spatrick def __floordiv__(self, other): 370061da546Spatrick return int(self) // int(other) 371061da546Spatrick 372061da546Spatrick def __mod__(self, other): 373061da546Spatrick return int(self) % int(other) 374061da546Spatrick 375061da546Spatrick def __divmod__(self, other): 376061da546Spatrick return int(self) % int(other) 377061da546Spatrick 378061da546Spatrick def __pow__(self, other): 379061da546Spatrick return int(self) ** int(other) 380061da546Spatrick 381061da546Spatrick def __lshift__(self, other): 382061da546Spatrick return int(self) << int(other) 383061da546Spatrick 384061da546Spatrick def __rshift__(self, other): 385061da546Spatrick return int(self) >> int(other) 386061da546Spatrick 387061da546Spatrick def __and__(self, other): 388061da546Spatrick return int(self) & int(other) 389061da546Spatrick 390061da546Spatrick def __xor__(self, other): 391061da546Spatrick return int(self) ^ int(other) 392061da546Spatrick 393061da546Spatrick def __or__(self, other): 394061da546Spatrick return int(self) | int(other) 395061da546Spatrick 396061da546Spatrick def __div__(self, other): 397061da546Spatrick return int(self) / int(other) 398061da546Spatrick 399061da546Spatrick def __truediv__(self, other): 400061da546Spatrick return int(self) / int(other) 401061da546Spatrick 402061da546Spatrick def __iadd__(self, other): 403061da546Spatrick result = self.__add__(other) 404061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 405061da546Spatrick return result 406061da546Spatrick 407061da546Spatrick def __isub__(self, other): 408061da546Spatrick result = self.__sub__(other) 409061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 410061da546Spatrick return result 411061da546Spatrick 412061da546Spatrick def __imul__(self, other): 413061da546Spatrick result = self.__mul__(other) 414061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 415061da546Spatrick return result 416061da546Spatrick 417061da546Spatrick def __idiv__(self, other): 418061da546Spatrick result = self.__div__(other) 419061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 420061da546Spatrick return result 421061da546Spatrick 422061da546Spatrick def __itruediv__(self, other): 423061da546Spatrick result = self.__truediv__(other) 424061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 425061da546Spatrick return result 426061da546Spatrick 427061da546Spatrick def __ifloordiv__(self, other): 428061da546Spatrick result = self.__floordiv__(self, other) 429061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 430061da546Spatrick return result 431061da546Spatrick 432061da546Spatrick def __imod__(self, other): 433061da546Spatrick result = self.__and__(self, other) 434061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 435061da546Spatrick return result 436061da546Spatrick 437061da546Spatrick def __ipow__(self, other): 438061da546Spatrick result = self.__pow__(self, other) 439061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 440061da546Spatrick return result 441061da546Spatrick 442061da546Spatrick def __ipow__(self, other, modulo): 443061da546Spatrick result = self.__pow__(self, other, modulo) 444061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 445061da546Spatrick return result 446061da546Spatrick 447061da546Spatrick def __ilshift__(self, other): 448061da546Spatrick result = self.__lshift__(other) 449061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 450061da546Spatrick return result 451061da546Spatrick 452061da546Spatrick def __irshift__(self, other): 453061da546Spatrick result = self.__rshift__(other) 454061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 455061da546Spatrick return result 456061da546Spatrick 457061da546Spatrick def __iand__(self, other): 458061da546Spatrick result = self.__and__(self, other) 459061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 460061da546Spatrick return result 461061da546Spatrick 462061da546Spatrick def __ixor__(self, other): 463061da546Spatrick result = self.__xor__(self, other) 464061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 465061da546Spatrick return result 466061da546Spatrick 467061da546Spatrick def __ior__(self, other): 468061da546Spatrick result = self.__ior__(self, other) 469061da546Spatrick self.sbvalue.SetValueFromCString (str(result)) 470061da546Spatrick return result 471061da546Spatrick 472061da546Spatrick def __neg__(self): 473061da546Spatrick return -int(self) 474061da546Spatrick 475061da546Spatrick def __pos__(self): 476061da546Spatrick return +int(self) 477061da546Spatrick 478061da546Spatrick def __abs__(self): 479061da546Spatrick return abs(int(self)) 480061da546Spatrick 481061da546Spatrick def __invert__(self): 482061da546Spatrick return ~int(self) 483061da546Spatrick 484061da546Spatrick def __complex__(self): 485061da546Spatrick return complex (int(self)) 486061da546Spatrick 487061da546Spatrick def __int__(self): 488061da546Spatrick is_num,is_sign = is_numeric_type(self.sbvalue.GetType().GetCanonicalType().GetBasicType()) 489061da546Spatrick if is_num and not is_sign: return self.sbvalue.GetValueAsUnsigned() 490061da546Spatrick return self.sbvalue.GetValueAsSigned() 491061da546Spatrick 492061da546Spatrick def __long__(self): 493061da546Spatrick return self.__int__() 494061da546Spatrick 495061da546Spatrick def __float__(self): 496061da546Spatrick return float (self.sbvalue.GetValueAsSigned()) 497061da546Spatrick 498061da546Spatrick def __oct__(self): 499061da546Spatrick return '0%o' % self.sbvalue.GetValueAsUnsigned() 500061da546Spatrick 501061da546Spatrick def __hex__(self): 502061da546Spatrick return '0x%x' % self.sbvalue.GetValueAsUnsigned() 503061da546Spatrick 504061da546Spatrick def __len__(self): 505061da546Spatrick return self.sbvalue.GetNumChildren() 506061da546Spatrick 507061da546Spatrick def __eq__(self, other): 508061da546Spatrick if type(other) is int: 509061da546Spatrick return int(self) == other 510061da546Spatrick elif type(other) is str: 511061da546Spatrick return str(self) == other 512061da546Spatrick elif type(other) is value: 513061da546Spatrick self_err = SBError() 514061da546Spatrick other_err = SBError() 515061da546Spatrick self_val = self.sbvalue.GetValueAsUnsigned(self_err) 516061da546Spatrick if self_err.fail: 517061da546Spatrick raise ValueError("unable to extract value of self") 518061da546Spatrick other_val = other.sbvalue.GetValueAsUnsigned(other_err) 519061da546Spatrick if other_err.fail: 520061da546Spatrick raise ValueError("unable to extract value of other") 521061da546Spatrick return self_val == other_val 522061da546Spatrick raise TypeError("Unknown type %s, No equality operation defined." % str(type(other))) 523061da546Spatrick 524061da546Spatrick def __ne__(self, other): 525061da546Spatrick return not self.__eq__(other) 526061da546Spatrick%} 527061da546Spatrick 528061da546Spatrick%pythoncode %{ 529061da546Spatrick 530061da546Spatrickclass SBSyntheticValueProvider(object): 531061da546Spatrick def __init__(self,valobj): 532061da546Spatrick pass 533061da546Spatrick 534061da546Spatrick def num_children(self): 535061da546Spatrick return 0 536061da546Spatrick 537061da546Spatrick def get_child_index(self,name): 538061da546Spatrick return None 539061da546Spatrick 540061da546Spatrick def get_child_at_index(self,idx): 541061da546Spatrick return None 542061da546Spatrick 543061da546Spatrick def update(self): 544061da546Spatrick pass 545061da546Spatrick 546061da546Spatrick def has_children(self): 547061da546Spatrick return False 548061da546Spatrick 549061da546Spatrick 550061da546Spatrick%} 551061da546Spatrick 552061da546Spatrick%pythoncode %{ 553061da546Spatrick 554061da546Spatrick# given an lldb.SBBasicType it returns a tuple 555061da546Spatrick# (is_numeric, is_signed) 556061da546Spatrick# the value of is_signed is undefined if is_numeric == false 557061da546Spatrickdef is_numeric_type(basic_type): 558061da546Spatrick if basic_type == eBasicTypeInvalid: return (False,False) 559061da546Spatrick if basic_type == eBasicTypeVoid: return (False,False) 560061da546Spatrick if basic_type == eBasicTypeChar: return (True,False) 561061da546Spatrick if basic_type == eBasicTypeSignedChar: return (True,True) 562061da546Spatrick if basic_type == eBasicTypeUnsignedChar: return (True,False) 563061da546Spatrick if basic_type == eBasicTypeWChar: return (True,False) 564061da546Spatrick if basic_type == eBasicTypeSignedWChar: return (True,True) 565061da546Spatrick if basic_type == eBasicTypeUnsignedWChar: return (True,False) 566061da546Spatrick if basic_type == eBasicTypeChar16: return (True,False) 567061da546Spatrick if basic_type == eBasicTypeChar32: return (True,False) 568*f6aab3d8Srobert if basic_type == eBasicTypeChar8: return (True,False) 569061da546Spatrick if basic_type == eBasicTypeShort: return (True,True) 570061da546Spatrick if basic_type == eBasicTypeUnsignedShort: return (True,False) 571061da546Spatrick if basic_type == eBasicTypeInt: return (True,True) 572061da546Spatrick if basic_type == eBasicTypeUnsignedInt: return (True,False) 573061da546Spatrick if basic_type == eBasicTypeLong: return (True,True) 574061da546Spatrick if basic_type == eBasicTypeUnsignedLong: return (True,False) 575061da546Spatrick if basic_type == eBasicTypeLongLong: return (True,True) 576061da546Spatrick if basic_type == eBasicTypeUnsignedLongLong: return (True,False) 577061da546Spatrick if basic_type == eBasicTypeInt128: return (True,True) 578061da546Spatrick if basic_type == eBasicTypeUnsignedInt128: return (True,False) 579061da546Spatrick if basic_type == eBasicTypeBool: return (False,False) 580061da546Spatrick if basic_type == eBasicTypeHalf: return (True,True) 581061da546Spatrick if basic_type == eBasicTypeFloat: return (True,True) 582061da546Spatrick if basic_type == eBasicTypeDouble: return (True,True) 583061da546Spatrick if basic_type == eBasicTypeLongDouble: return (True,True) 584061da546Spatrick if basic_type == eBasicTypeFloatComplex: return (True,True) 585061da546Spatrick if basic_type == eBasicTypeDoubleComplex: return (True,True) 586061da546Spatrick if basic_type == eBasicTypeLongDoubleComplex: return (True,True) 587061da546Spatrick if basic_type == eBasicTypeObjCID: return (False,False) 588061da546Spatrick if basic_type == eBasicTypeObjCClass: return (False,False) 589061da546Spatrick if basic_type == eBasicTypeObjCSel: return (False,False) 590061da546Spatrick if basic_type == eBasicTypeNullPtr: return (False,False) 591061da546Spatrick #if basic_type == eBasicTypeOther: 592061da546Spatrick return (False,False) 593061da546Spatrick 594061da546Spatrick%} 595