aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-01-26 20:58:49 +0000
committerTom Tromey <tromey@redhat.com>2011-01-26 20:58:49 +0000
commita81766d88fb4f4be52357e186146752b47cf3b58 (patch)
treec094f6f18555eb1608350b7e6b74d4bea952fa6f /gdb
parent74aedc4602913e330a1ec0cf5e9b8c8fe2b19a48 (diff)
downloadgdb-a81766d88fb4f4be52357e186146752b47cf3b58.zip
gdb-a81766d88fb4f4be52357e186146752b47cf3b58.tar.gz
gdb-a81766d88fb4f4be52357e186146752b47cf3b58.tar.bz2
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/python/py-prettyprint.c18
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp7
4 files changed, 34 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d59307c..4318d42 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2011-01-26 Tom Tromey <tromey@redhat.com>
+ * 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.
+
+2011-01-26 Tom Tromey <tromey@redhat.com>
+
* python/python.c (gdbpy_solib_name): Use gdb_py_longest and
GDB_PY_LL_ARG.
* python/python-internal.h (GDB_PY_LL_ARG, GDB_PY_LLU_ARG): New
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);
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5219de1..3b9b284 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-26 Tom Tromey <tromey@redhat.com>
+
+ * gdb.python/py-prettyprint.exp (run_lang_tests): Ensure no blank
+ space before string output. Add test for "set print pretty off"
+ case.
+
2011-01-25 Pedro Alves <pedro@codesourcery.com>
* gdb.base/frame-args.exp: Adjust.
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index e4a6c38..81de5a2 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -92,7 +92,7 @@ proc run_lang_tests {lang} {
gdb_test "print x" " = \"this is x\""
gdb_test "print cstring" " = \"const string\""
- gdb_test "print estring" "\"embedded x\\\\201\\\\202\\\\203\\\\204\""
+ gdb_test "print estring" " = \"embedded x\\\\201\\\\202\\\\203\\\\204\""
gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>"
@@ -100,6 +100,11 @@ proc run_lang_tests {lang} {
gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
+
+ gdb_test_no_output "set print pretty off"
+ gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \
+ "print nstype on one line"
+
gdb_test "continue" "Program exited normally\."
remote_file host delete ${remote_python_file}