binutils-gdb/gdb/testsuite/gdb.python
Andrew Burgess 7807d76a1c gdb/python: fix FrameDecorator regression on Python 2
This commit:

  commit d1cab9876d
  Date:   Tue Sep 15 11:08:56 2020 -0600

      Don't use gdb_py_long_from_ulongest

Introduced a regression when GDB is compiled with Python 2.  The frame
filter API expects the gdb.FrameDecorator.function () method to return
either a string (the name of a function) or an address, which GDB then
uses to lookup a msymbol.

If the address returned from gdb.FrameDecorator.function () comes from
gdb.Frame.pc () then before the above commit we would always expect to
see a PyLong object.

After the above commit we might (on Python 2) get a PyInt object.

The GDB code does not expect to see a PyInt, and only checks for a
PyLong, we then see an error message like:

  RuntimeError: FrameDecorator.function: expecting a String, integer or None.

This commit just adds an additional call to PyInt_Check which handle
the missing case.

I had already written a test case to cover this issue before spotting
that the gdb.python/py-framefilter.exp test also triggers this
failure.  As the new test case is slightly different I have kept it
in.

The new test forces the behaviour of gdb.FrameDecorator.function
returning an address.  The reason the existing test case hits this is
due to the behaviour of the builtin gdb.FrameDecorator base class.  If
the base class behaviour ever changed then the return an address case
would only be tested by the new test case.

gdb/ChangeLog:

	* python/py-framefilter.c (py_print_frame): Use PyInt_Check as
	well as PyLong_Check for Python 2.

gdb/testsuite/ChangeLog:

	* gdb.python/py-framefilter-addr.c: New file.
	* gdb.python/py-framefilter-addr.exp: New file.
	* gdb.python/py-framefilter-addr.py: New file.
2021-03-16 09:31:56 +00:00
..
amd64-py-framefilter-invalidarg.S
compare-enum-type-a.c
compare-enum-type-b.c
compare-enum-type.exp
compare-enum-type.h
lib-types.cc
lib-types.exp gdb/testsuite: check the correct Python variable in test 2021-03-12 12:18:33 +00:00
py-arch-reg-groups.exp
py-arch-reg-names.exp
py-arch.c
py-arch.exp
py-as-string.c
py-as-string.exp
py-auto-load-chaining-f1.c gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining-f1.o-gdb.py gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining-f2.c gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining-f2.o-gdb.py gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining.c gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-auto-load-chaining.exp gdb: use make_scoped_restore to restore gdbpy_current_objfile 2021-03-15 09:21:37 +00:00
py-bad-printers.c
py-bad-printers.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-bad-printers.py
py-block.c
py-block.exp gdb/testsuite: make test names unique in gdb.python/py-block.exp 2021-03-12 12:18:33 +00:00
py-breakpoint-create-fail.c
py-breakpoint-create-fail.exp
py-breakpoint-create-fail.py
py-breakpoint.c
py-breakpoint.exp
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 gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-events.py
py-evsignal.exp
py-evthreads.c
py-evthreads.exp
py-explore-cc.exp gdb/testsuite: make test names unique in gdb.python/py-explore-cc.exp 2021-03-12 12:18:33 +00:00
py-explore.c
py-explore.cc
py-explore.exp gdb/testsuite: make test names unique in gdb.python/py-explore.exp 2021-03-12 12:18:33 +00:00
py-finish-breakpoint2.cc
py-finish-breakpoint2.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-finish-breakpoint2.py
py-finish-breakpoint.c
py-finish-breakpoint.exp gdb/testsuite: make test names unique in gdb.python/py-finish-breakpoint.exp 2021-03-12 12:18:33 +00:00
py-finish-breakpoint.py
py-format-string.c
py-format-string.exp
py-format-string.py
py-frame-args.c
py-frame-args.exp
py-frame-args.py
py-frame-inline.c
py-frame-inline.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-frame.c
py-frame.exp gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-framefilter-addr.c gdb/python: fix FrameDecorator regression on Python 2 2021-03-16 09:31:56 +00:00
py-framefilter-addr.exp gdb/python: fix FrameDecorator regression on Python 2 2021-03-16 09:31:56 +00:00
py-framefilter-addr.py gdb/python: fix FrameDecorator regression on Python 2 2021-03-16 09:31:56 +00:00
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 gdb/testsuite: resolve remaining duplicate test names in gdb.python/*.exp 2021-03-12 12:18:34 +00:00
py-lazy-string.c
py-lazy-string.exp
py-linetable.c
py-linetable.exp
py-linetable.S
py-lookup-type.exp gdb/testsuite: remove a duplicate test 2021-03-12 12:18:33 +00:00
py-mi-events-gdb.py
py-mi-events.c
py-mi-events.exp
py-mi-objfile-gdb.py
py-mi-objfile.c
py-mi-objfile.exp
py-mi-var-info-path-expression.c
py-mi-var-info-path-expression.exp
py-mi-var-info-path-expression.py
py-mi.exp
py-nested-maps.c
py-nested-maps.exp
py-nested-maps.py
py-objfile-script-gdb.py
py-objfile-script.c
py-objfile-script.exp
py-objfile.c
py-objfile.exp
py-parameter.exp
py-pp-integral.c
py-pp-integral.exp
py-pp-integral.py
py-pp-maint.c
py-pp-maint.exp gdb/testsuite: make test names unique in gdb.python/py-pp-maint.exp 2021-03-12 12:18:33 +00:00
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
py-prompt.c
py-prompt.exp gdb/testsuite: make test names unique in gdb.python/py-prompt.exp 2021-03-12 12:18:33 +00:00
py-rbreak-func2.c
py-rbreak.c
py-rbreak.exp
py-record-btrace-threads.c
py-record-btrace-threads.exp
py-record-btrace.c
py-record-btrace.exp
py-record-full.c
py-record-full.exp
py-recurse-unwind.c
py-recurse-unwind.exp
py-recurse-unwind.py
py-rvalue-ref-value-cc.cc
py-rvalue-ref-value-cc.exp
py-section-script.c
py-section-script.exp
py-section-script.py
py-shared-sl.c
py-shared.c
py-shared.exp
py-strfns.c
py-strfns.exp gdb/testsuite: make test names unique in gdb.python/py-strfns.exp 2021-03-12 12:18:33 +00:00
py-symbol-2.c
py-symbol.c
py-symbol.exp
py-symtab.exp gdb/testsuite: make test names unique in gdb.python/py-symtab.exp 2021-03-12 12:18:33 +00:00
py-sync-interp.c
py-sync-interp.exp
py-template.cc
py-template.exp
py-thrhandle.c
py-thrhandle.exp
py-type.c
py-type.exp
py-typeprint.cc
py-typeprint.exp
py-typeprint.py
py-unwind-inline.c
py-unwind-inline.exp
py-unwind-inline.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 gdb/testsuite: remove duplicate test from gdb.python/py-value-cc.exp 2021-03-12 12:18:34 +00:00
py-value.c
py-value.exp
py-xmethods.cc
py-xmethods.exp
py-xmethods.py
python-1.c
python.c
python.exp
source1
source2.py
tui-window-disabled.c
tui-window-disabled.exp
tui-window-disabled.py
tui-window.exp
tui-window.py