old-cross-binutils/gdb/testsuite/gdb.python
Tom Tromey ddae946278 Fix PR python/17386 - add __index__ method to gdb.Value
This patch fixes PR python/17386.

The bug is that gdb.Value does not implement the Python __index__
method.  This method is needed to convert a Python object to an index
and is used by various operations in Python, such as indexing an
array.

The fix is to implement the nb_index method for gdb.Value.

nb_index was added in Python 2.5.  I don't have a good way to test
Python 2.4, but I made an attempt to accomodate it.

I chose to use valpy_long in all cases because this simplifies porting
to Python 3, and because there didn't seem to be any harm.

Built and regtested on x86-64 Fedora 23.

2016-05-24  Tom Tromey  <tom@tromey.com>

	PR python/17386:
	* python/py-value.c (value_object_as_number): Add
	nb_inplace_floor_divide, nb_inplace_true_divide, nb_index.

2016-05-24  Tom Tromey  <tom@tromey.com>

	PR python/17386:
	* gdb.python/py-value.exp (test_value_numeric_ops): Add tests that
	use value as an index.
2016-05-24 10:05:59 -06:00
..
amd64-py-framefilter-invalidarg.S
lib-types.cc
lib-types.exp
py-arch.c
py-arch.exp
py-as-string.c
py-as-string.exp
py-bad-printers.c
py-bad-printers.exp
py-bad-printers.py
py-block.c
py-block.exp
py-breakpoint.c
py-breakpoint.exp Fix PR python/17981 2016-05-24 09:55:01 -06:00
py-caller-is.c
py-caller-is.exp
py-cmd.c
py-cmd.exp
py-completion.exp
py-completion.py
py-error.exp
py-error.py
py-events-shlib.c
py-events.c
py-events.exp
py-events.py
py-evsignal.exp
py-evthreads.c
py-evthreads.exp
py-explore-cc.exp
py-explore.c
py-explore.cc
py-explore.exp
py-finish-breakpoint.c
py-finish-breakpoint.exp Rename gdb_load_shlibs to gdb_load_shlib 2016-04-27 18:09:14 -04:00
py-finish-breakpoint.py
py-finish-breakpoint2.cc
py-finish-breakpoint2.exp
py-finish-breakpoint2.py
py-frame-args.c
py-frame-args.exp
py-frame-args.py
py-frame-inline.c
py-frame-inline.exp
py-frame.c
py-frame.exp
py-framefilter-gdb.py.in
py-framefilter-invalidarg-gdb.py.in
py-framefilter-invalidarg.exp
py-framefilter-invalidarg.py
py-framefilter-mi.c
py-framefilter-mi.exp
py-framefilter.c
py-framefilter.exp
py-framefilter.py
py-function.exp
py-inferior.c
py-inferior.exp
py-infthread.c
py-infthread.exp
py-lazy-string.c
py-lazy-string.exp
py-linetable.c
py-linetable.exp
py-linetable.S
py-lookup-type.exp
py-mi-events-gdb.py gdb.python/py-mi-events-gdb.py: Add parentheses to print 2016-04-09 08:41:41 -04:00
py-mi-events.c
py-mi-events.exp
py-mi-objfile-gdb.py testsuite: Update py-mi-objfile to expect console format print 2016-04-06 09:39:16 +03:00
py-mi-objfile.c
py-mi-objfile.exp testsuite: Update py-mi-objfile to expect console format print 2016-04-06 09:39:16 +03:00
py-mi.exp
py-objfile-script-gdb.py
py-objfile-script.c
py-objfile-script.exp
py-objfile.c
py-objfile.exp Fix PR python/19438, PR python/18393 - initialize dictionaries 2016-05-23 10:08:34 -06:00
py-parameter.exp
py-pp-integral.c
py-pp-integral.exp
py-pp-integral.py
py-pp-maint.c
py-pp-maint.exp
py-pp-maint.py
py-pp-re-notag.c
py-pp-re-notag.exp
py-pp-re-notag.py
py-pp-registration.c
py-pp-registration.exp
py-pp-registration.py
py-prettyprint.c
py-prettyprint.exp
py-prettyprint.py
py-progspace.c
py-progspace.exp Fix PR python/19438, PR python/18393 - initialize dictionaries 2016-05-23 10:08:34 -06:00
py-prompt.c
py-prompt.exp
py-section-script.c
py-section-script.exp
py-section-script.py
py-shared-sl.c
py-shared.c
py-shared.exp Rename gdb_load_shlibs to gdb_load_shlib 2016-04-27 18:09:14 -04:00
py-strfns.c
py-strfns.exp
py-symbol.c
py-symbol.exp
py-symtab.exp
py-sync-interp.c
py-sync-interp.exp
py-template.cc
py-template.exp
py-type.c
py-type.exp
py-typeprint.cc
py-typeprint.exp
py-typeprint.py
py-unwind-maint.c
py-unwind-maint.exp
py-unwind-maint.py
py-unwind.c
py-unwind.exp
py-unwind.py
py-value-cc.cc
py-value-cc.exp
py-value.c
py-value.exp Fix PR python/17386 - add __index__ method to gdb.Value 2016-05-24 10:05:59 -06:00
py-xmethods.cc
py-xmethods.exp
py-xmethods.py
python-1.c
python.c
python.exp
source1
source2.py