[lldb] Accept negative indexes in __getitem__
authorDave Lee <davelee.com@gmail.com>
Fri, 3 Feb 2023 16:45:44 +0000 (08:45 -0800)
committerDave Lee <davelee.com@gmail.com>
Wed, 8 Feb 2023 18:46:26 +0000 (10:46 -0800)
commit3ff636729d067801039b3a37618f6ce0dd1c3d24
tree22a48d087319e4571c4bfa4594d0b3600619c46c
parent5d07e0448e38d4be0cc7b1079d72b5e3644e941c
[lldb] Accept negative indexes in __getitem__

To the Python bindings, add support for Python-like negative indexes.

While was using `script`, I tried to access a thread's bottom frame with
`thread.frame[-1]`, but that failed. This change updates the `__getitem__`
implementations to support negative indexes as one would expect in Python.

Differential Revision: https://reviews.llvm.org/D143282
13 files changed:
lldb/bindings/interface/SBBreakpoint.i
lldb/bindings/interface/SBInstructionList.i
lldb/bindings/interface/SBModule.i
lldb/bindings/interface/SBProcess.i
lldb/bindings/interface/SBSymbolContextList.i
lldb/bindings/interface/SBTarget.i
lldb/bindings/interface/SBThread.i
lldb/bindings/interface/SBTypeCategory.i
lldb/bindings/interface/SBTypeEnumMember.i
lldb/bindings/interface/SBValue.i
lldb/bindings/interface/SBValueList.i
lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py
lldb/test/API/python_api/thread/TestThreadAPI.py