-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+# Copyright 1992, 1994, 1996, 1997, 1998, 2001, 2003, 2007
+# 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
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
set bug_id 0
set testfile "setshow"
-set srcfile ${srcdir}/${subdir}/${testfile}.c
+set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile ${srcfile} ${binfile} executable {debug}] != "" } {
- perror "Couldn't compile ${srcfile}"
- return -1
+if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
+ untested setshow.exp
+ return -1
}
# Start with a fresh gdb
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# make sure $pc is sane, in case we're talking to a board.
+if { ![runto_main] } {
+ gdb_suppress_tests;
+}
+
#
# Test gdb set and show commands.
# Add tests here for show and set that don't fit neatly elsewhere.
#test set annotate 2
send_gdb "set annotate 2\n"
-expect {
- -re ".*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
+gdb_expect {
+ -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
{ pass "set annotate 2" }
- -re ".*$prompt $" { fail "set annotate 2" }
+ -re ".*$gdb_prompt $" { fail "set annotate 2" }
timeout { fail "(timeout) set annotate 2" }
}
send_gdb "show annotate\n"
-expect {
- -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
+gdb_expect {
+ -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
{ pass "show annotate (2)" }
- -re ".*$prompt $" { fail "show annotate (2)" }
+ -re ".*$gdb_prompt $" { fail "show annotate (2)" }
timeout { fail "(timeout) show annotate (2)" }
}
#test annotation_level 2
send_gdb "info line 1\n"
-expect {
- -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
+gdb_expect {
+ -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
{ pass "annotation_level 2" }
- -re ".*$prompt $" { fail "annotation_level 2" }
+ -re ".*$gdb_prompt $" { fail "annotation_level 2" }
timeout { fail "(timeout) annotation_level 2" }
}
#test set args
gdb_test "set args foo bar blup baz bubble" "" "set args"
#test show args
-gdb_test "show args" "Arguments to give program being debugged when it is started is \"foo bar blup baz bubble\"..*" "show args"
-#test passing args
-gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
+gdb_test "show args" "Argument list to give program being debugged when it is started is \"foo bar blup baz bubble\"..*" "show args"
+
+# Don't test if we can't pass args or if we're using a stub.
+if { ![target_info exists use_gdb_stub] && ![target_info exists noargs] } {
+ #test passing args
+ gdb_test "cont" "Continuing.*" "continuing"
+ delete_breakpoints
+ gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
+}
#test set check range on
gdb_test "set check range on" "" "set check range on"
#test show check range on
#test set language auto
gdb_test "set language auto" "" "set language auto"
#test show language
-gdb_test "show language" "The current source language is \"auto\"..*" "show language (auto)"
+gdb_test "show language" "The current source language is \"auto.*\"..*" "show language (auto)"
#test set listsize 100
gdb_test "set listsize 100" "" "set listsize 100"
#test show listsize 100
gdb_test "show listsize" "Number of source lines gdb will list by default is 100..*" "show listsize (100)"
-#test set prompt (FooBarBaz)
-set newprompt "\\(FooBarBaz\\)"
-send_gdb "set prompt (FooBarBaz) \n"
-expect {
+if ![board_info target exists gdb_prompt] {
+ #test set prompt (FooBarBaz)
+ set newprompt "\\(FooBarBaz\\)"
+ send_gdb "set prompt (FooBarBaz) \n"
+ gdb_expect {
-re "$newprompt $" { pass "set prompt (FooBarBaz) " }
timeout { fail "(timeout) set prompt (FooBarBaz) " }
- }
+ }
-#test show prompt (FooBarBaz)
-send_gdb "show prompt\n"
-expect {
+ #test show prompt (FooBarBaz)
+ send_gdb "show prompt\n"
+ gdb_expect {
-re "Gdb's prompt is \"$newprompt \"..* $" \
- { pass "show prompt (FooBarBaz) " }
+ { pass "show prompt (FooBarBaz) " }
timeout { fail "(timeout) show prompt (FooBarBaz) " }
- }
+ }
-#test set prompt (gdb)
-send_gdb "set prompt (gdb) \n"
-expect {
- -re "$prompt $" { pass "set prompt (gdb) " }
+ #test set prompt (gdb)
+ send_gdb "set prompt (gdb) \n"
+ gdb_expect {
+ -re "$gdb_prompt $" { pass "set prompt (gdb) " }
timeout { fail "(timeout) set prompt (gdb) " }
- }
+ }
+}
#test set radix 11
gdb_test "set radix 11" "Unsupported output radix ``decimal 11''; output radix unchanged..*" "set radix 11"