Fix PR python/17981

PR python/17981 notes that gdb.breakpoints() returns None when there
are no breakpoints; whereas an empty list or tuple would be more in
keeping with Python and the documentation.

This patch fixes the bug by changing the no-breakpoint return to make
an empty tuple.

Built and regtested on x86-64 Fedora 23.

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

	PR python/17981:
	* python/py-breakpoint.c (gdbpy_breakpoints): Return a new tuple
	when there are no breakpoints.

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

	* python.texi (Basic Python): Document gdb.breakpoints return.

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

	PR python/17981:
	* gdb.python/py-breakpoint.exp (test_bkpt_basic): Add test for
	no-breakpoint case.
This commit is contained in:
Tom Tromey 2016-05-18 21:41:28 -06:00
parent 224f10c1ae
commit 1957f6b89f
6 changed files with 26 additions and 4 deletions

View file

@ -236,7 +236,10 @@ and height, and its pagination will be disabled; @pxref{Screen Size}.
@findex gdb.breakpoints
@defun gdb.breakpoints ()
Return a sequence holding all of @value{GDBN}'s breakpoints.
@xref{Breakpoints In Python}, for more information.
@xref{Breakpoints In Python}, for more information. In @value{GDBN}
version 7.11 and earlier, this function returned @code{None} if there
were no breakpoints. This peculiarity was subsequently fixed, and now
@code{gdb.breakpoints} returns an empty sequence in this case.
@end defun
@findex gdb.parameter