forked from Imagelibrary/binutils-gdb
This commit is the result of the following actions:
- Running gdb/copyright.py to update all of the copyright headers to
include 2024,
- Manually updating a few files the copyright.py script told me to
update, these files had copyright headers embedded within the
file,
- Regenerating gdbsupport/Makefile.in to refresh it's copyright
date,
- Using grep to find other files that still mentioned 2023. If
these files were updated last year from 2022 to 2023 then I've
updated them this year to 2024.
I'm sure I've probably missed some dates. Feel free to fix them up as
you spot them.
232 lines
7.3 KiB
Plaintext
232 lines
7.3 KiB
Plaintext
# Copyright (C) 2019-2024 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# This tests GDB's python pretty printing of nested map like
|
|
# structures using structures as keys and values, it then tests how
|
|
# 'set print max-depth' affects this printing.
|
|
|
|
load_lib gdb-python.exp
|
|
|
|
require allow_python_tests
|
|
|
|
standard_testfile
|
|
|
|
if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
|
|
return -1
|
|
}
|
|
|
|
if {![runto_main]} {
|
|
return -1
|
|
}
|
|
|
|
gdb_breakpoint [gdb_get_line_number "Break here"]
|
|
gdb_continue_to_breakpoint "run to testing point" ".*Break here.*"
|
|
|
|
set remote_python_file [gdb_remote_download host \
|
|
${srcdir}/${subdir}/${testfile}.py]
|
|
gdb_test_no_output "source ${remote_python_file}" "load python file"
|
|
|
|
# Test printing with 'set print pretty off'.
|
|
gdb_test_no_output "set print pretty off"
|
|
with_test_prefix "pretty=off" {
|
|
gdb_print_expr_at_depths "*m1" \
|
|
[list \
|
|
"\{\\.\\.\\.\}" \
|
|
"\{\\\[\{a = 3, b = 4\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 4, b = 5\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 5, b = 6\}\\\] = \{\\.\\.\\.\}\}" \
|
|
"\{\\\[\{a = 3, b = 4\}\\\] = \{x = 0, y = 1, z = 2\}, \\\[\{a = 4, b = 5\}\\\] = \{x = 3, y = 4, z = 5\}, \\\[\{a = 5, b = 6\}\\\] = \{x = 6, y = 7, z = 8\}\}" \
|
|
]
|
|
|
|
gdb_print_expr_at_depths "*mm" \
|
|
[list \
|
|
"\{\\.\\.\\.\}" \
|
|
"\{\\\[$hex \"m1\"\\\] = \{\\.\\.\\.\}, \\\[$hex \"m2\"\\\] = \{\\.\\.\\.\}\}" \
|
|
"\{\\\[$hex \"m1\"\\\] = \{\\\[\{a = 3, b = 4\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 4, b = 5\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 5, b = 6\}\\\] = \{\\.\\.\\.\}\}, \\\[$hex \"m2\"\\\] = \{\\\[\{a = 6, b = 7\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 7, b = 8\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 8, b = 9\}\\\] = \{\\.\\.\\.\}\}\}" \
|
|
"\{\\\[$hex \"m1\"\\\] = \{\\\[\{a = 3, b = 4\}\\\] = \{x = 0, y = 1, z = 2\}, \\\[\{a = 4, b = 5\}\\\] = \{x = 3, y = 4, z = 5\}, \\\[\{a = 5, b = 6\}\\\] = \{x = 6, y = 7, z = 8\}\}, \\\[$hex \"m2\"\\\] = \{\\\[\{a = 6, b = 7\}\\\] = \{x = 9, y = 0, z = 1\}, \\\[\{a = 7, b = 8\}\\\] = \{x = 2, y = 3, z = 4\}, \\\[\{a = 8, b = 9\}\\\] = \{x = 5, y = 6, z = 7\}\}\}" \
|
|
]
|
|
}
|
|
|
|
# Now again, but with 'set print pretty on'.
|
|
gdb_test_no_output "set print pretty on"
|
|
with_test_prefix "pretty=on" {
|
|
gdb_print_expr_at_depths "*m1" \
|
|
[list \
|
|
"\{\\.\\.\\.\}" \
|
|
[multi_line \
|
|
" = \{" \
|
|
" \\\[\{" \
|
|
" a = 3," \
|
|
" b = 4" \
|
|
" \}\\\] = \{\\.\\.\\.\}," \
|
|
" \\\[\{" \
|
|
" a = 4," \
|
|
" b = 5" \
|
|
" \}\\\] = \{\\.\\.\\.\}," \
|
|
" \\\[\{" \
|
|
" a = 5," \
|
|
" b = 6" \
|
|
" \}\\\] = \{\\.\\.\\.\}" \
|
|
"\}" ] \
|
|
[multi_line \
|
|
" = \{" \
|
|
" \\\[\{" \
|
|
" a = 3," \
|
|
" b = 4" \
|
|
" \}\\\] = \{" \
|
|
" x = 0," \
|
|
" y = 1," \
|
|
" z = 2" \
|
|
" \}," \
|
|
" \\\[\{" \
|
|
" a = 4," \
|
|
" b = 5" \
|
|
" \}\\\] = \{" \
|
|
" x = 3," \
|
|
" y = 4," \
|
|
" z = 5" \
|
|
" \}," \
|
|
" \\\[\{" \
|
|
" a = 5," \
|
|
" b = 6" \
|
|
" \}\\\] = \{" \
|
|
" x = 6," \
|
|
" y = 7," \
|
|
" z = 8" \
|
|
" \}" \
|
|
"\}" ] \
|
|
]
|
|
|
|
gdb_print_expr_at_depths "*mm" \
|
|
[list \
|
|
"\{\\.\\.\\.\}" \
|
|
[multi_line \
|
|
" = \{" \
|
|
" \\\[$hex \"m1\"\\\] = \{\\.\\.\\.\}," \
|
|
" \\\[$hex \"m2\"\\\] = \{\\.\\.\\.\}" \
|
|
"\}" ] \
|
|
[multi_line \
|
|
" = \{" \
|
|
" \\\[$hex \"m1\"\\\] = \{" \
|
|
" \\\[\{" \
|
|
" a = 3," \
|
|
" b = 4" \
|
|
" \}\\\] = \{\\.\\.\\.\}," \
|
|
" \\\[\{" \
|
|
" a = 4," \
|
|
" b = 5" \
|
|
" \}\\\] = \{\\.\\.\\.\}," \
|
|
" \\\[\{" \
|
|
" a = 5," \
|
|
" b = 6" \
|
|
" \}\\\] = \{\\.\\.\\.\}" \
|
|
" \}," \
|
|
" \\\[$hex \"m2\"\\\] = \{" \
|
|
" \\\[\{" \
|
|
" a = 6," \
|
|
" b = 7" \
|
|
" \}\\\] = \{\\.\\.\\.\}," \
|
|
" \\\[\{" \
|
|
" a = 7," \
|
|
" b = 8" \
|
|
" \}\\\] = \{\\.\\.\\.\}," \
|
|
" \\\[\{" \
|
|
" a = 8," \
|
|
" b = 9" \
|
|
" \}\\\] = \{\\.\\.\\.\}" \
|
|
" \}" \
|
|
"\}" ] \
|
|
[multi_line \
|
|
" = \{" \
|
|
" \\\[$hex \"m1\"\\\] = \{" \
|
|
" \\\[\{" \
|
|
" a = 3," \
|
|
" b = 4" \
|
|
" \}\\\] = \{" \
|
|
" x = 0," \
|
|
" y = 1," \
|
|
" z = 2" \
|
|
" \}," \
|
|
" \\\[\{" \
|
|
" a = 4," \
|
|
" b = 5" \
|
|
" \}\\\] = \{" \
|
|
" x = 3," \
|
|
" y = 4," \
|
|
" z = 5" \
|
|
" \}," \
|
|
" \\\[\{" \
|
|
" a = 5," \
|
|
" b = 6" \
|
|
" \}\\\] = \{" \
|
|
" x = 6," \
|
|
" y = 7," \
|
|
" z = 8" \
|
|
" \}" \
|
|
" \}," \
|
|
" \\\[$hex \"m2\"\\\] = \{" \
|
|
" \\\[\{" \
|
|
" a = 6," \
|
|
" b = 7" \
|
|
" \}\\\] = \{" \
|
|
" x = 9," \
|
|
" y = 0," \
|
|
" z = 1" \
|
|
" \}," \
|
|
" \\\[\{" \
|
|
" a = 7," \
|
|
" b = 8" \
|
|
" \}\\\] = \{" \
|
|
" x = 2," \
|
|
" y = 3," \
|
|
" z = 4" \
|
|
" \}," \
|
|
" \\\[\{" \
|
|
" a = 8," \
|
|
" b = 9" \
|
|
" \}\\\] = \{" \
|
|
" x = 5," \
|
|
" y = 6," \
|
|
" z = 7" \
|
|
" \}" \
|
|
" \}" \
|
|
"\}" ] \
|
|
]
|
|
}
|
|
|
|
# Test printing with 'set print pretty off', but this time display a
|
|
# top level string (returned from the to_string method) as part of the
|
|
# printed value.
|
|
gdb_test_no_output "set mm->show_header=1"
|
|
gdb_test_no_output "set m1->show_header=1"
|
|
gdb_test_no_output "set m2->show_header=1"
|
|
with_test_prefix "headers=on" {
|
|
gdb_test_no_output "set print pretty off"
|
|
with_test_prefix "pretty=off" {
|
|
gdb_print_expr_at_depths "*m1" \
|
|
[list \
|
|
"pp_map = \{\\.\\.\\.\}" \
|
|
"pp_map = \{\\\[\{a = 3, b = 4\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 4, b = 5\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 5, b = 6\}\\\] = \{\\.\\.\\.\}\}" \
|
|
"pp_map = \{\\\[\{a = 3, b = 4\}\\\] = \{x = 0, y = 1, z = 2\}, \\\[\{a = 4, b = 5\}\\\] = \{x = 3, y = 4, z = 5\}, \\\[\{a = 5, b = 6\}\\\] = \{x = 6, y = 7, z = 8\}\}" \
|
|
]
|
|
|
|
gdb_print_expr_at_depths "*mm" \
|
|
[list \
|
|
"pp_map_map = \{\\.\\.\\.\}" \
|
|
"pp_map_map = \{\\\[$hex \"m1\"\\\] = pp_map = \{\\.\\.\\.\}, \\\[$hex \"m2\"\\\] = pp_map = \{\\.\\.\\.\}\}" \
|
|
"pp_map_map = \{\\\[$hex \"m1\"\\\] = pp_map = \{\\\[\{a = 3, b = 4\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 4, b = 5\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 5, b = 6\}\\\] = \{\\.\\.\\.\}\}, \\\[$hex \"m2\"\\\] = pp_map = \{\\\[\{a = 6, b = 7\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 7, b = 8\}\\\] = \{\\.\\.\\.\}, \\\[\{a = 8, b = 9\}\\\] = \{\\.\\.\\.\}\}\}" \
|
|
"pp_map_map = \{\\\[$hex \"m1\"\\\] = pp_map = \{\\\[\{a = 3, b = 4\}\\\] = \{x = 0, y = 1, z = 2\}, \\\[\{a = 4, b = 5\}\\\] = \{x = 3, y = 4, z = 5\}, \\\[\{a = 5, b = 6\}\\\] = \{x = 6, y = 7, z = 8\}\}, \\\[$hex \"m2\"\\\] = pp_map = \{\\\[\{a = 6, b = 7\}\\\] = \{x = 9, y = 0, z = 1\}, \\\[\{a = 7, b = 8\}\\\] = \{x = 2, y = 3, z = 4\}, \\\[\{a = 8, b = 9\}\\\] = \{x = 5, y = 6, z = 7\}\}\}" \
|
|
]
|
|
}
|
|
}
|