binutils/
[external/binutils.git] / gdb / testsuite / gdb.trace / tracecmd.exp
index d11ec8a..679cc32 100644 (file)
@@ -1,4 +1,5 @@
-#   Copyright 1998, 2007, 2008 Free Software Foundation, Inc.
+#   Copyright 1998, 2007, 2008, 2009, 2010, 2011
+#   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
@@ -13,9 +14,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
 # This file was written by Michael Snyder (msnyder@cygnus.com)
 
 load_lib "trace-support.exp";
@@ -24,23 +22,16 @@ if $tracelevel then {
     strace $tracelevel
 }
 
-set prms_id 0
-set bug_id 0
 
 gdb_exit
 gdb_start
-if [istarget "m68k-*-elf"] then {
-    set srcfile gdb_c_test.c
-    set binfile [board_info target d490_binfile];
-} else {
-    set testfile "actions"
-    set srcfile ${testfile}.c
-    set binfile $objdir/$subdir/$testfile
-    if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
-           executable {debug nowarnings}] != "" } {
-       untested tracecmd.exp
-       return -1
-    }
+set testfile "actions"
+set srcfile ${testfile}.c
+set binfile $objdir/$subdir/tracecmd
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+         executable {debug nowarnings}] != "" } {
+    untested tracecmd.exp
+    return -1
 }
 gdb_reinitialize_dir $srcdir/$subdir
 
@@ -90,6 +81,7 @@ gdb_test "info trace" "No tracepoints.*" \
 
 # 1.3 trace line in invalid source file
 gdb_delete_tracepoints
+gdb_test_no_output "set breakpoint pending off"
 gdb_test "trace NoSuChFiLe.c:1" "No source file named NoSuChFiLe.c." \
        "1.3a: trace invalid source file"
 gdb_test "info trace" "No tracepoints.*" \
@@ -112,12 +104,10 @@ gdb_test "info trace" "No tracepoints.*" \
 
 # 1.6 trace at a specific address
 #     Collect the address of "gdb_asm_test", and use that.
-send_gdb "print gdb_asm_test\n"
-gdb_expect {
+gdb_test_multiple "print gdb_asm_test" "" {
     -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" {
        set asm_test_addr $expect_out(1,string)
     }
-    timeout { }
 }
 
 gdb_delete_tracepoints
@@ -129,12 +119,10 @@ gdb_test "info trace" "$asm_test_addr.*gdb_asm_test.*" \
 
 # 1.7 trace at function's exact address
 #     Collect the address of the function for comparison
-send_gdb "print gdb_recursion_test\n"
-gdb_expect {
+gdb_test_multiple "print gdb_recursion_test" "" {
     -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" {
        set c_test_addr $expect_out(1,string)
     }
-    timeout { }
 }
 
 gdb_delete_tracepoints
@@ -148,14 +136,18 @@ gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline" \
 # no address is invalid
 
 # 1.9 trace no arguments
-gdb_test "trace" "trace command requires an argument" \
+gdb_test "trace" "No default breakpoint address now." \
        "1.9: trace <no arguments>"
 
-# 1.10 set large number of tracepoints
-# deferred to limits test module
+# 1.10 there's no 1.10.
 
 # 1.11 tracepoint conditions
-# conditions on tracepoints not implemented
+gdb_delete_tracepoints
+gdb_test "trace gdb_recursion_test if q1 > 0" \
+       "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \
+       "1.11a: conditional tracepoint"
+gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1.*trace only if q1 > 0" \
+       "1.11b: verify conditional tracepoint"
 
 # 1.12 set tracepoint in prologue
 # [see tfind.exp]
@@ -166,4 +158,16 @@ gdb_test "trace" "trace command requires an argument" \
 # 1.14 help trace
 gdb_test "help trace" "Set a tracepoint at .*" "1.14: help trace"
 
+# 1.15 ftrace
 
+gdb_delete_tracepoints
+
+# Acceptance vs rejection of a location are target-specific, so allow both.
+gdb_test_multiple "ftrace gdb_recursion_test" "Set a fast tracepoint" {
+    -re "Fast tracepoint $decimal at $hex: file.*$srcfile, line $testline1.*$gdb_prompt $" {
+       pass "Set a fast tracepoint"
+    }
+    -re ".*May not have a fast tracepoint at $hex.*$gdb_prompt $" {
+       pass "Declined to set a fast tracepoint"
+    }
+}