aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-08-07 20:50:54 +0200
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-12-11 04:31:05 +0100
commitd8edc8b768f0f611088161161392e1075134d635 (patch)
tree37f073313f2bf23e8dcbddbd19c815e7b3a0fba6 /gdb/testsuite
parent5afa80e9a8e6585eeaac44ca51be9c6b2471bf80 (diff)
downloadgdb-d8edc8b768f0f611088161161392e1075134d635.zip
gdb-d8edc8b768f0f611088161161392e1075134d635.tar.gz
gdb-d8edc8b768f0f611088161161392e1075134d635.tar.bz2
Implement 'print -raw-values' and 'set print raw-values on|off'
The option framework documentation was speaking about a 'print -raw' option, but this option does not exist. This patch implements -raw-values option that tells to ignore the active pretty printers when printing a value. As we already have -raw-frame-arguments, I thought -raw-values was more clear, in particular to differentiate set print raw-values and set print raw-frame-arguments. gdb/doc/ChangeLog 2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Command Options): Use -p and -pretty in the example, as -r is ambiguous. Update the print - TAB TAB completion result. (Data): Document new option -raw-values. Use -p and -pretty in the example, as -r is ambiguous. (Print Settings): Document set print raw values. (Pretty-Printer Commands): Document interaction between enabled pretty printers and -raw-values/-raw-frame-arguments. gdb/ChangeLog 2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Document -raw-values option and the related setting commands. * printcmd.c (print_command_parse_format): Do not set opts->raw off, only set it on when /r is given. * valprint.c (value_print_option_defs): New element raw-values. * Makefile.in: Add the new file. gdb/testsuite/ChangeLog 2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/options.exp: Add -raw-values in the print completion list. * gdb.python/py-prettyprint.exp: Add tests for -raw-values.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/options.exp1
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp21
3 files changed, 27 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8b846a1..17d4993 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * gdb.base/options.exp: Add -raw-values in the print completion list.
+ * gdb.python/py-prettyprint.exp: Add tests for -raw-values.
+
2019-12-10 Kevin Buettner <kevinb@redhat.com>
* gdb.threads/omp-par-scope.c: New file.
diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp
index 7a18fe9..78ddc26 100644
--- a/gdb/testsuite/gdb.base/options.exp
+++ b/gdb/testsuite/gdb.base/options.exp
@@ -168,6 +168,7 @@ proc_with_prefix test-print {{prefix ""}} {
"-null-stop"
"-object"
"-pretty"
+ "-raw-values"
"-repeats"
"-static-members"
"-symbol"
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 82e7e65..e9ad561 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -199,3 +199,24 @@ gdb_test_no_output "python enable_lookup_function ()"
gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \
"print ss enabled #2"
+
+gdb_test "print -raw-values -- ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}" \
+ "print -raw-values -- ss"
+
+gdb_test "print -raw-values on -- ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}" \
+ "print -raw-values on -- ss"
+
+gdb_test "with print raw-values -- print ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}" \
+ "with print raw-values -- print ss"
+
+# Test interaction between /r format and raw-values option:
+# When /r is not present, raw-values option tells to bypass (or not) the pretty printers.
+# (these cases are tested above).
+# When /r is present, it must override the option raw-values off.
+gdb_test "print /r ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}"
+
+gdb_test "with print raw-values off -- print /r ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}"
+
+gdb_test "print -raw-values off -- /r ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}"
+
+