aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.guile
diff options
context:
space:
mode:
authorKent Cheung <kent.cheung@arm.com>2021-05-13 15:42:20 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-05-14 06:51:21 +0100
commitecf25064e87a3d2d59871b3ea7126fa0dee0001d (patch)
treeda6aa892b6386531716e8e1b3b33f4168f09d3e4 /gdb/testsuite/gdb.guile
parent64654371d6324794d11131fc95c1bc4caaaf173d (diff)
downloadgdb-ecf25064e87a3d2d59871b3ea7126fa0dee0001d.zip
gdb-ecf25064e87a3d2d59871b3ea7126fa0dee0001d.tar.gz
gdb-ecf25064e87a3d2d59871b3ea7126fa0dee0001d.tar.bz2
gdb: fix pretty printing max depth behaviour
The 'print max-depth' feature incorrectly causes GDB to skip printing the string representation of pretty printed variables if the variable is stored at a nested depth corresponding to the set max-depth value. This change ensures that it is always printed before checking whether the maximum print depth has been reached. Regression tested with GCC 7.3.0 on x86_64, ppc64le, aarch64. gdb/ChangeLog: * cp-valprint.c (cp_print_value): Replaced duplicate code. * guile/scm-pretty-print.c (ppscm_print_children): Check max_depth just before printing child values. (gdbscm_apply_val_pretty_printer): Don't check max_depth before printing string representation. * python/py-prettyprint.c (print_children): Check max_depth just before printing child values. (gdbpy_apply_val_pretty_printer): Don't check max_depth before printing string representation. gdb/testsuite/ChangeLog: * gdb.python/py-format-string.c: Added a variable to test. * gdb.python/py-format-string.exp: Check string representation is printed at appropriate max_depth settings. * gdb.python/py-nested-maps.exp: Likewise. * gdb.guile/scm-pretty-print.exp: Add additional tests.
Diffstat (limited to 'gdb/testsuite/gdb.guile')
-rw-r--r--gdb/testsuite/gdb.guile/scm-pretty-print.exp4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.guile/scm-pretty-print.exp b/gdb/testsuite/gdb.guile/scm-pretty-print.exp
index f1ed714..7bd9d46 100644
--- a/gdb/testsuite/gdb.guile/scm-pretty-print.exp
+++ b/gdb/testsuite/gdb.guile/scm-pretty-print.exp
@@ -92,6 +92,10 @@ proc run_lang_tests {exefile lang} {
gdb_test "print x" " = \"this is x\""
gdb_test "print cstring" " = \"const string\""
+ gdb_test_no_output "set print max-depth 0"
+ gdb_test "print cstring" " = \"const string\""
+ gdb_test_no_output "set print max-depth unlimited"
+
gdb_test "print estring" " = \"embedded x\\\\201\\\\202\\\\203\\\\204\""
gdb_test_no_output "guile (set! *pp-ls-encoding* \"UTF-8\")"