#
require target_can_use_run_cmd
+# This test checks the full path to the binary in the output of some
+# tests, as a result this test will not work for remote host boards
+# where we have to first copy the binary to the remote host.
+require {!is_remote host}
+
set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n"
#
# test running programs
#
-standard_testfile .c
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested "failed to compile"
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-
-clean_restart ${binfile}
-
-# The commands we test here produce many lines of output; disable "press
-# <return> to continue" prompts.
-gdb_test_no_output "set height 0"
-
#
# break in main
#
#
# NOTE: this prompt is OK only when the annotation level is > 1
-# NOTE: When this prompt is in use the gdb_test procedure cannot be used because
-# it assumes that the last char after the gdb_prompt is a white space. This is not
-# true with this annotated prompt. So we must use send_gdb and gdb_expect.
-#
+# NOTE: When this prompt is in use the gdb_test procedure must be
+# called with '-prompt "$gdb_prompt$"' otherwise it assumes the
+# last char after the gdb_prompt is a white space. This is not
+# true with this annotated prompt.
set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
# annotate-prompt
# annotate-post-prompt (in the next block)
#
-send_gdb "set annotate 2\n"
-gdb_expect {
- -re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" }
- -re ".*$gdb_prompt$" { fail "annotation set at level 2" }
- timeout { fail "annotation set at level 2 (timeout)" }
- }
-
+gdb_test_no_output -prompt "$gdb_prompt$" "set annotate 2" \
+ "annotation set at level 2"
#
# info break will test:
# annotate-frame-end
# annotate-stopped
#
-#exp_internal 1
+
set binexp [string_to_regexp $binfile]
set warning_slow_re \
pass $gdb_test_name
}
}
-#exp_internal 0
-#exit 0
#
# Let's do a next, to get to a point where the array is initialized
# FIXME: annotate-error not tested
#
-#exp_internal 1
gdb_test_multiple "print non_existent_value" "print non_existent_value" {
-re "\r\n\032\032post-prompt\r\n\r\n\032\032error-begin\r\nNo symbol \"non_existent_value\" in current context.\r\n\r\n\032\032error\r\n$gdb_prompt$" {
pass $gdb_test_name
# test running programs
#
-standard_testfile .c
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested "failed to compile"
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-clean_restart ${binfile}
-
-# The commands we test here produce many lines of output; disable "press
-# <return> to continue" prompts.
-gdb_test_no_output "set height 0"
-
#
# break in main
#
# NOTE: this prompt is OK only when the annotation level is > 1
-# NOTE: When this prompt is in use the gdb_test procedure cannot be
-# used because it assumes that the last char after the gdb_prompt is a
-# white space. This is not true with this annotated prompt. So we must
-# use send_gdb and gdb_expect or gdb_expect_list.
+# NOTE: When this prompt is in use the gdb_test procedure must be
+# called with '-prompt "$gdb_prompt$"' otherwise it assumes the
+# last char after the gdb_prompt is a white space. This is not
+# true with this annotated prompt.
set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
# annotate-prompt
# annotate-post-prompt (in the next block)
#
-send_gdb "set annotate 3\n"
-gdb_expect_list "annotation set at level 3" "\r\n$gdb_prompt$" {
+gdb_test_no_output -prompt "$gdb_prompt$" "set annotate 3" \
"set annotate 3"
-}
#
# if construct:
#
# run to a break point will test:
#
-#exp_internal 1
send_gdb "run\n"
gdb_expect_list "run until main breakpoint" "$gdb_prompt$" [concat {
"\r\n\032\032post-prompt\r\n"
"\r\n\032\032source.*annota3.c:$main_line:.*:beg:0x\[0-9a-z\]+\r\n"] {
"\r\n\032\032stopped\r\n"
}]
-#exp_internal 0
-#exit 0
#
# Let's do a next, to get to a point where the array is initialized
# FIXME: annotate-error not tested
#
-#exp_internal 1
send_gdb "print non_existent_value\n"
gdb_expect_list "print non_existent_value" "$gdb_prompt$" {
"\r\n\032\032post-prompt\r\n"
#
# break at signal handler
#
-send_gdb "break handle_USR1\n"
-gdb_expect_list "breakpoint handle_USR1" "$gdb_prompt$" {
- "\r\n\032\032post-prompt\r\n"
- "Breakpoint.*at 0x\[0-9a-z\]+: file.*annota3.c, line.*\r\n"
-}
+gdb_test -prompt "$gdb_prompt$" "break handle_USR1" \
+ "\r\n\032\032post-prompt\r\nBreakpoint \[^\r\n\]+ at $hex: file \[^\r\n\]+/$srcfile, line\[^\r\n\]+\\."
#
-# break at printf. When we are stopped at printf, we can test
+# Break at printf.
#
-send_gdb "break printf\n"
-gdb_expect_list "breakpoint printf" "$gdb_prompt$" {
- "\r\n\032\032post-prompt\r\n"
- "Breakpoint.*at 0x\[0-9a-z\]+.*"
-}
+gdb_test -prompt "$gdb_prompt$" "break printf" \
+ "\r\n\032\032post-prompt\r\nBreakpoint \[^\r\n\]+ at $hex\[^\r\n\]+"
#
# get to printf
# break in main, after value is initialized. This is in preparation
# to test the annotate output for the display command.
#
-send_gdb "break ${srcfile}:${main_line}\n"
-gdb_expect_list "break in main" "$gdb_prompt$" [concat {
- "\r\n\032\032post-prompt\r\n" } [list \
- "Breakpoint 4 at 0x\[0-9a-z\]+: file .*annota3.c, line $main_line.\r\n"]]
+gdb_test -prompt "$gdb_prompt$" "break ${srcfile}:${main_line}" \
+ "\r\n\032\032post-prompt\r\nBreakpoint 4 at $hex: file \[^\r\n\]+/$srcfile, line $main_line\\." \
+ "break in main"
#
# display the value
set value_inc_line [gdb_get_line_number "increment value"]
-send_gdb "break $value_inc_line\n"
-gdb_expect_list "break at value++" "$gdb_prompt$" [concat {
- "\r\n\032\032post-prompt\r\n" } [list \
- "Breakpoint 5 at 0x\[0-9a-z\]+: file .*annota3.c, line $value_inc_line.\r\n"]]
+gdb_test -prompt "$gdb_prompt$" "break $value_inc_line" \
+ "\r\n\032\032post-prompt\r\nBreakpoint 5 at $hex: file\[^\r\n\]*$srcfile, line $value_inc_line\\." \
+ "break at value++"
send_gdb "ignore 5 4\n"
gdb_expect_list "ignore 5 4" "$gdb_prompt$" {