From a81766d88fb4f4be52357e186146752b47cf3b58 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 26 Jan 2011 20:58:49 +0000 Subject: gdb * python/py-prettyprint.c (print_string_repr): Clear 'addressprint' option when calling val_print_string. (print_children): Handle Val_pretty_default. Clear 'addressprint' option when calling val_print_string. gdb/testsuite * gdb.python/py-prettyprint.exp (run_lang_tests): Ensure no blank space before string output. Add test for "set print pretty off" case. --- gdb/python/py-prettyprint.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 7532aa5..916492e 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -325,13 +325,15 @@ print_string_repr (PyObject *printer, const char *hint, long length; struct type *type; char *encoding = NULL; + struct value_print_options local_opts = *options; make_cleanup (free_current_contents, &encoding); gdbpy_extract_lazy_string (py_str, &addr, &type, &length, &encoding); + local_opts.addressprint = 0; val_print_string (type, encoding, addr, (int) length, - stream, options); + stream, &local_opts); } else { @@ -499,7 +501,15 @@ print_children (PyObject *printer, const char *hint, /* Use the prettyprint_arrays option if we are printing an array, and the pretty option otherwise. */ - pretty = is_array ? options->prettyprint_arrays : options->pretty; + if (is_array) + pretty = options->prettyprint_arrays; + else + { + if (options->pretty == Val_prettyprint) + pretty = 1; + else + pretty = options->prettyprint_structs; + } /* Manufacture a dummy Python frame to work around Python 2.4 bug, where it insists on having a non-NULL tstate->frame when @@ -598,12 +608,14 @@ print_children (PyObject *printer, const char *hint, struct type *type; long length; char *encoding = NULL; + struct value_print_options local_opts = *options; make_cleanup (free_current_contents, &encoding); gdbpy_extract_lazy_string (py_v, &addr, &type, &length, &encoding); + local_opts.addressprint = 0; val_print_string (type, encoding, addr, (int) length, stream, - options); + &local_opts); do_cleanups (inner_cleanup); } -- cgit v1.1