2010-04-14 Phil Muldoon <pmuldoon@redhat.com>

PR python/11381

	* python/py-prettyprint.c (pretty_print_one_value): Test for
	Py_None.
	(print_string_repr): Test for Py_None.  Set flags accordingly.
	Return value depending on return type.
	(print_children): Take a value indicating whether data was printed
	before this function was called.  Alter output accordingly.
	(apply_val_pretty_printer): Capture return value from
	print_string_repr and pass to print_children.

2010-04-14  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-prettyprint.py (NoStringContainerPrinter): New printer.
	* gdb.python/py-prettyprint.c: Add justchildren struct, typedefs.
	* gdb.python/py-prettyprint.exp: New test for to_string returning None.
	* gdb.python/py-mi.exp: New test for to_string returning None.

2010-04-14  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Pretty Printing): Document behaviour when to_string
	returns None.
This commit is contained in:
Phil Muldoon 2010-04-14 12:02:46 +00:00
parent d594eacc9e
commit 79f283fe85
9 changed files with 180 additions and 47 deletions

View file

@ -119,6 +119,15 @@ typedef struct string_repr
/* This lets us avoid malloc. */
int array[100];
int narray[10];
struct justchildren
{
int len;
int *elements;
};
typedef struct justchildren nostring_type;
struct container
{
@ -196,7 +205,9 @@ main ()
const struct string_repr cstring = { { "const string" } };
/* Clearing by being `static' could invoke an other GDB C++ bug. */
struct nullstr nullstr;
nostring_type nstype;
nstype.elements = narray;
nstype.len = 0;
init_ss(&ss, 1, 2);
init_ss(ssa+0, 3, 4);
@ -249,5 +260,9 @@ main ()
do_nothing ();
#endif
nstype.elements[0] = 7;
nstype.elements[1] = 42;
nstype.len = 2;
return 0; /* break to inspect struct and union */
}