File tree Expand file tree Collapse file tree 13 files changed +74
-18
lines changed Expand file tree Collapse file tree 13 files changed +74
-18
lines changed Original file line number Diff line number Diff line change @@ -273,8 +273,11 @@ public:
273
273
return 0
274
274
275
275
def __getitem__ (self, key):
276
- if type (key) is int and key < len (self):
277
- return self.sbbreakpoint .GetLocationAtIndex (key)
276
+ if isinstance (key, int ):
277
+ count = len (self)
278
+ if -count <= key < count:
279
+ key %= count
280
+ return self.sbbreakpoint .GetLocationAtIndex (key)
278
281
return None
279
282
280
283
def get_locations_access_object (self):
Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ public:
83
83
' ' ' Access instructions by integer index for array access or by lldb.SBAddress to find an instruction that matches a section offset address object.' ' '
84
84
if type (key) is int :
85
85
# Find an instruction by index
86
- if key < len (self):
86
+ count = len (self)
87
+ if -count <= key < count:
88
+ key %= count
87
89
return self.GetInstructionAtIndex (key)
88
90
elif type (key) is SBAddress:
89
91
# Find an instruction using a lldb.SBAddress object
Original file line number Diff line number Diff line change @@ -415,7 +415,8 @@ public:
415
415
def __getitem__ (self, key):
416
416
count = len (self)
417
417
if type (key) is int :
418
- if key < count:
418
+ if -count <= key < count:
419
+ key %= count
419
420
return self.sbmodule .GetSymbolAtIndex (key)
420
421
elif type (key) is str:
421
422
matches = []
@@ -476,7 +477,8 @@ public:
476
477
def __getitem__ (self, key):
477
478
count = len (self)
478
479
if type (key) is int :
479
- if key < count:
480
+ if -count <= key < count:
481
+ key %= count
480
482
return self.sbmodule .GetSectionAtIndex (key)
481
483
elif type (key) is str:
482
484
for idx in range (count):
@@ -511,7 +513,8 @@ public:
511
513
def __getitem__ (self, key):
512
514
count = len (self)
513
515
if type (key) is int :
514
- if key < count:
516
+ if -count <= key < count:
517
+ key %= count
515
518
return self.sbmodule .GetCompileUnitAtIndex (key)
516
519
elif type (key) is str:
517
520
is_full_path = key[0 ] == ' /'
Original file line number Diff line number Diff line change @@ -487,8 +487,11 @@ public:
487
487
return 0
488
488
489
489
def __getitem__ (self, key):
490
- if type (key) is int and key < len (self):
491
- return self.sbprocess .GetThreadAtIndex (key)
490
+ if isinstance (key, int ):
491
+ count = len (self)
492
+ if -count <= key < count:
493
+ key %= count
494
+ return self.sbprocess .GetThreadAtIndex (key)
492
495
return None
493
496
494
497
def get_threads_access_object (self):
Original file line number Diff line number Diff line change @@ -74,8 +74,9 @@ public:
74
74
75
75
def __getitem__ (self, key):
76
76
count = len (self)
77
- if type (key) is int :
78
- if key < count:
77
+ if isinstance (key, int ):
78
+ if -count <= key < count:
79
+ key %= count
79
80
return self.GetContextAtIndex (key)
80
81
else :
81
82
raise IndexError
Original file line number Diff line number Diff line change @@ -1001,7 +1001,8 @@ public:
1001
1001
def __getitem__ (self, key):
1002
1002
num_modules = self.sbtarget .GetNumModules ()
1003
1003
if type (key) is int :
1004
- if key < num_modules:
1004
+ if -num_modules <= key < num_modules:
1005
+ key %= num_modules
1005
1006
return self.sbtarget .GetModuleAtIndex (key)
1006
1007
elif type (key) is str:
1007
1008
if key.find (' /' ) == -1 :
Original file line number Diff line number Diff line change @@ -434,8 +434,11 @@ public:
434
434
return 0
435
435
436
436
def __getitem__ (self, key):
437
- if type (key) is int and key < self.sbthread .GetNumFrames ():
438
- return self.sbthread .GetFrameAtIndex (key)
437
+ if isinstance (key, int ):
438
+ count = len (self)
439
+ if -count <= key < count:
440
+ key %= count
441
+ return self.sbthread .GetFrameAtIndex (key)
439
442
return None
440
443
441
444
def get_frames_access_object (self):
Original file line number Diff line number Diff line change @@ -147,7 +147,8 @@ namespace lldb {
147
147
def __getitem__ (self, key):
148
148
num_items = len (self)
149
149
if type (key) is int :
150
- if key < num_items:
150
+ if -num_items <= key < num_items:
151
+ key %= num_items
151
152
return self.get_at_index_function (self.sbcategory ,key)
152
153
elif type (key) is str:
153
154
return self.get_by_name_function (self.sbcategory ,SBTypeNameSpecifier (key))
Original file line number Diff line number Diff line change @@ -121,7 +121,8 @@ public:
121
121
def __getitem__ (self, key):
122
122
num_elements = self.GetSize ()
123
123
if type (key) is int :
124
- if key < num_elements:
124
+ if -num_elements <= key < num_elements:
125
+ key %= num_elements
125
126
return self.GetTypeEnumMemberAtIndex (key)
126
127
elif type (key) is str:
127
128
for idx in range (num_elements):
Original file line number Diff line number Diff line change @@ -459,8 +459,11 @@ public:
459
459
return 0
460
460
461
461
def __getitem__ (self, key):
462
- if type (key) is int and key < len (self):
463
- return self.sbvalue .GetChildAtIndex (key)
462
+ if isinstance (key, int ):
463
+ count = len (self)
464
+ if -count <= key < count:
465
+ key %= count
466
+ return self.sbvalue .GetChildAtIndex (key)
464
467
return None
465
468
466
469
def get_child_access_object (self):
You can’t perform that action at this time.
0 commit comments