]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.xml/tdesc-reload.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.xml / tdesc-reload.exp
1 # Copyright 2020-2024 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # Testing for 'maint print xml-tdesc'. Check we can print out the
17 # current target description and load it back in again.
18
19 require allow_xml_test
20
21 standard_testfile
22
23 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
24 return -1
25 }
26
27 if {![runto_main]} {
28 return 0
29 }
30
31 # Three files we're going to write out to.
32 set xml_file_1 [host_standard_output_file outfile1.xml]
33 set xml_file_2 [host_standard_output_file outfile2.xml]
34 set xml_file_3 [host_standard_output_file outfile3.xml]
35
36 # Write the current target description to a file.
37 gdb_test_no_output "pipe maint print xml-tdesc | cat > $xml_file_1" \
38 "write current target description to file"
39
40 # Read the target description back in to GDB, and the write it back
41 # out to a file.
42 gdb_test_no_output \
43 "pipe maint print xml-tdesc $xml_file_1 | cat > $xml_file_2" \
44 "read previous xml description, and write it out to a second file"
45
46 # Check the two produced files are identical.
47 gdb_test "shell diff -s $xml_file_1 $xml_file_2" \
48 "Files \[^\r\n\]* are identical" \
49 "first two produced xml files are identical"
50
51 # Restart GDB.
52 clean_restart
53
54 # Change to use one of the target descriptions we wrote out earlier.
55 gdb_test_no_output "set tdesc filename $xml_file_1" \
56 "set target description to use"
57
58 # Load the executable.
59 gdb_load ${binfile}
60
61 # Run to `main' where we begin our tests.
62 if {![runto_main]} {
63 return -1
64 }
65
66 # Run info registers just to check this appears to run fine with the
67 # new target description.
68 gdb_test -lbl "info all-registers" "" "Run info registers"
69
70 # Write out the current target description.
71 gdb_test_no_output "pipe maint print xml-tdesc | cat > $xml_file_3" \
72 "write third target description to file"
73
74 # And check that it matches the original file we loaded.
75 gdb_test "shell diff -s $xml_file_1 $xml_file_3" \
76 "Files \[^\r\n\]* are identical" \
77 "first and third produced xml files are identical"