1 # Copyright 2007 Free Software Foundation, Inc.
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 2 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 if {[gdb_skip_xml_test]} {
18 unsupported "tdesc-arch.exp"
24 # Find some valid architectures - we just need legitimate values
25 # to put in our <architecture> elements.
28 set msg "read valid architectures"
29 gdb_test_multiple "set architecture" $msg {
30 -re "Requires an argument. Valid arguments are (\[^ \]*), (\[^ \]*), .*auto\\.\r\n$gdb_prompt $" {
31 set arch1 $expect_out(1,string)
32 set arch2 $expect_out(2,string)
38 set msg "read default architecture"
39 gdb_test_multiple "show architecture" $msg {
40 -re "The target architecture is set automatically \\(currently (\[^ \]*)\\)\r\n$gdb_prompt $" {
41 set default_arch $expect_out(1,string)
46 # If that did not work, no point running further tests.
47 if { "$arch1" == "" || "$arch2" == "" || "$default_arch" == "" } {
48 unresolved "architecture XML tests"
52 # Run these tests twice, once for $arch1 and once for $arch2, to
53 # make sure that the tdesc file overrides the global default.
55 proc set_arch { arch which } {
58 set fd [open "tdesc-arch.xml" w]
61 <architecture>$arch</architecture>
65 # Anchor the test output, so that error messages are detected.
66 set cmd "set tdesc filename tdesc-arch.xml"
67 set msg "$cmd ($which architecture)"
68 set cmd_regex [string_to_regexp $cmd]
69 gdb_test_multiple $cmd $msg {
70 -re "^$cmd_regex\r\n$gdb_prompt $" {
73 -re "^$cmd_regex\r\nwarning: A handler for the OS ABI.*\r\n$gdb_prompt $" {
78 set cmd "show architecture"
80 "The target architecture is set automatically \\(currently $arch\\)" \
81 "$cmd ($which architecture)"
83 file delete "tdesc-arch.xml"
87 set_arch $arch2 second
89 # Check an invalid architecture setting.
90 set fd [open "tdesc-arch.xml" w]
93 <architecture>invalid</architecture>
97 set cmd "set tdesc filename tdesc-arch.xml"
99 "warning:.*Target description specified unknown architecture.*" \
100 "$cmd (invalid architecture)"
102 set cmd "show architecture"
104 "The target architecture is set automatically \\(currently $default_arch\\)" \
105 "$cmd (invalid architecture)"
107 file delete "tdesc-arch.xml"