| OLD | NEW |
| 1 # Copyright 1998, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 1998-2013 Free Software Foundation, Inc. |
| 2 # | 2 # |
| 3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # This file was written by Michael Snyder (msnyder@cygnus.com) | 16 # This file was written by Michael Snyder (msnyder@cygnus.com) |
| 17 | 17 |
| 18 load_lib "trace-support.exp"; | 18 load_lib "trace-support.exp" |
| 19 | 19 |
| 20 | 20 |
| 21 gdb_exit | 21 gdb_exit |
| 22 gdb_start | 22 gdb_start |
| 23 standard_testfile actions.c | 23 standard_testfile actions.c |
| 24 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | 24 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ |
| 25 executable {debug nowarnings}] != "" } { | 25 executable {debug nowarnings}] != "" } { |
| 26 untested tracecmd.exp | 26 untested tracecmd.exp |
| 27 return -1 | 27 return -1 |
| 28 } | 28 } |
| 29 gdb_reinitialize_dir $srcdir/$subdir | 29 gdb_reinitialize_dir $srcdir/$subdir |
| 30 | 30 |
| 31 # If testing on a remote host, download the source file. | 31 # If testing on a remote host, download the source file. |
| 32 # remote_download host $srcdir/$subdir/$srcfile | 32 # remote_download host $srcdir/$subdir/$srcfile |
| 33 | 33 |
| 34 gdb_file_cmd $binfile | 34 gdb_file_cmd $binfile |
| 35 | 35 |
| 36 # define relative source line numbers: | 36 # define relative source line numbers: |
| 37 # all subsequent line numbers are relative to this first one (baseline) | 37 # all subsequent line numbers are relative to this first one (baseline) |
| 38 set baseline [gdb_find_recursion_test_baseline $srcfile]; | 38 set baseline [gdb_find_recursion_test_baseline $srcfile] |
| 39 if { $baseline == -1 } then { | 39 if { $baseline == -1 } then { |
| 40 fail "Could not find gdb_recursion_test function" | 40 fail "Could not find gdb_recursion_test function" |
| 41 return; | 41 return |
| 42 } | 42 } |
| 43 | 43 |
| 44 set testline1 [expr $baseline + 1] | 44 set testline1 [expr $baseline + 1] |
| 45 set testline2 [expr $baseline + 3] | 45 set testline2 [expr $baseline + 3] |
| 46 | 46 |
| 47 # | 47 # |
| 48 # test "help tracepoints" | 48 # test "help tracepoints" |
| 49 # | 49 # |
| 50 | 50 |
| 51 set helpcnt 0; | 51 set helpcnt 0 |
| 52 test_class_help "tracepoints" { | 52 test_class_help "tracepoints" { |
| 53 "Tracing of program execution without stopping the program\.[\r\n\]+" | 53 "Tracing of program execution without stopping the program\.[\r\n\]+" |
| 54 } "1.0: help tracepoints" | 54 } "1.0: help tracepoints" |
| 55 | 55 |
| 56 # | 56 # |
| 57 # test trace command: | 57 # test trace command: |
| 58 # | 58 # |
| 59 | 59 |
| 60 # 1.1 trace source line | 60 # 1.1 trace source line |
| 61 gdb_delete_tracepoints | 61 gdb_delete_tracepoints |
| 62 gdb_test "trace $srcfile:$testline2" \ | 62 gdb_test "trace $srcfile:$testline2" \ |
| 63 "Tracepoint $decimal at $hex: file.*$srcfile, line $testline2." \ | 63 "Tracepoint $decimal at $hex: file.*$srcfile, line $testline2." \ |
| 64 "1.1a: set tracepoint at sourceline" | 64 "1.1a: set tracepoint at sourceline" |
| 65 gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2" \ | 65 gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2. |
| 66 \[\t \]+not installed on target." \ |
| 66 "1.1b: trace sourcefile:line" | 67 "1.1b: trace sourcefile:line" |
| 67 | 68 |
| 68 # 1.2 trace invalid source line | 69 # 1.2 trace invalid source line |
| 69 gdb_delete_tracepoints | 70 gdb_delete_tracepoints |
| 70 gdb_test_no_output "set breakpoint pending off" | 71 gdb_test_no_output "set breakpoint pending off" |
| 71 gdb_test "trace $srcfile:99999" "No line 99999 in file \".*$srcfile\"." \ | 72 gdb_test "trace $srcfile:99999" "No line 99999 in file \".*$srcfile\"." \ |
| 72 "1.2a: trace invalid line in sourcefile" | 73 "1.2a: trace invalid line in sourcefile" |
| 73 gdb_test "info trace" "No tracepoints.*" \ | 74 gdb_test "info trace" "No tracepoints.*" \ |
| 74 "1.2b: reject invalid line in srcfile" | 75 "1.2b: reject invalid line in srcfile" |
| 75 | 76 |
| 76 # 1.3 trace line in invalid source file | 77 # 1.3 trace line in invalid source file |
| 77 gdb_delete_tracepoints | 78 gdb_delete_tracepoints |
| 78 gdb_test "trace NoSuChFiLe.c:1" "No source file named NoSuChFiLe.c." \ | 79 gdb_test "trace NoSuChFiLe.c:1" "No source file named NoSuChFiLe.c." \ |
| 79 "1.3a: trace invalid source file" | 80 "1.3a: trace invalid source file" |
| 80 gdb_test "info trace" "No tracepoints.*" \ | 81 gdb_test "info trace" "No tracepoints.*" \ |
| 81 "1.3b: reject invalid srcfile" | 82 "1.3b: reject invalid srcfile" |
| 82 | 83 |
| 83 # 1.4 trace function by name | 84 # 1.4 trace function by name |
| 84 gdb_delete_tracepoints | 85 gdb_delete_tracepoints |
| 85 gdb_test "trace gdb_recursion_test" \ | 86 gdb_test "trace gdb_recursion_test" \ |
| 86 "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \ | 87 "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \ |
| 87 "1.4a: trace function by name" | 88 "1.4a: trace function by name" |
| 88 gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1" \ | 89 gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1. |
| 90 \[\t \]+not installed on target." \ |
| 89 "1.4b: trace function by name" | 91 "1.4b: trace function by name" |
| 90 | 92 |
| 91 # 1.5 trace non-existant function | 93 # 1.5 trace non-existant function |
| 92 gdb_delete_tracepoints | 94 gdb_delete_tracepoints |
| 93 gdb_test "trace NoSuChFuNc" "Function \"NoSuChFuNc\" not defined." \ | 95 gdb_test "trace NoSuChFuNc" "Function \"NoSuChFuNc\" not defined." \ |
| 94 "1.5a: trace invalid function" | 96 "1.5a: trace invalid function" |
| 95 gdb_test "info trace" "No tracepoints.*" \ | 97 gdb_test "info trace" "No tracepoints.*" \ |
| 96 "1.5b: reject invalid srcfile" | 98 "1.5b: reject invalid srcfile" |
| 97 | 99 |
| 98 # 1.6 trace at a specific address | 100 # 1.6 trace at a specific address |
| (...skipping 16 matching lines...) Expand all Loading... |
| 115 gdb_test_multiple "print gdb_recursion_test" "" { | 117 gdb_test_multiple "print gdb_recursion_test" "" { |
| 116 -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" { | 118 -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" { |
| 117 set c_test_addr $expect_out(1,string) | 119 set c_test_addr $expect_out(1,string) |
| 118 } | 120 } |
| 119 } | 121 } |
| 120 | 122 |
| 121 gdb_delete_tracepoints | 123 gdb_delete_tracepoints |
| 122 gdb_test "trace \*gdb_recursion_test" \ | 124 gdb_test "trace \*gdb_recursion_test" \ |
| 123 "Tracepoint $decimal at .*$c_test_addr.*" \ | 125 "Tracepoint $decimal at .*$c_test_addr.*" \ |
| 124 "1.7a: trace at function label (before prologue)" | 126 "1.7a: trace at function label (before prologue)" |
| 125 gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline" \ | 127 gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline. |
| 128 \[\t \]+not installed on target." \ |
| 126 "1.7b: verify trace at specific address" | 129 "1.7b: verify trace at specific address" |
| 127 | 130 |
| 128 # 1.8 trace at invalid address | 131 # 1.8 trace at invalid address |
| 129 # no address is invalid | 132 # no address is invalid |
| 130 | 133 |
| 131 # 1.9 trace no arguments | 134 # 1.9 trace no arguments |
| 132 gdb_test "trace" "No default breakpoint address now." \ | 135 gdb_test "trace" "No default breakpoint address now." \ |
| 133 "1.9: trace <no arguments>" | 136 "1.9: trace <no arguments>" |
| 134 | 137 |
| 135 # 1.10 there's no 1.10. | 138 # 1.10 there's no 1.10. |
| 136 | 139 |
| 137 # 1.11 tracepoint conditions | 140 # 1.11 tracepoint conditions |
| 138 gdb_delete_tracepoints | 141 gdb_delete_tracepoints |
| 139 gdb_test "trace gdb_recursion_test if q1 > 0" \ | 142 gdb_test "trace gdb_recursion_test if q1 > 0" \ |
| 140 "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \ | 143 "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \ |
| 141 "1.11a: conditional tracepoint" | 144 "1.11a: conditional tracepoint" |
| 142 gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1.*trace only if
q1 > 0" \ | 145 gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1. |
| 146 \[\t \]+trace only if q1 > 0. |
| 147 \[\t \]+not installed on target." \ |
| 143 "1.11b: verify conditional tracepoint" | 148 "1.11b: verify conditional tracepoint" |
| 144 | 149 |
| 145 # 1.12 set tracepoint in prologue | 150 # 1.12 set tracepoint in prologue |
| 146 # [see tfind.exp] | 151 # [see tfind.exp] |
| 147 | 152 |
| 148 # 1.13 trace on recursion | 153 # 1.13 trace on recursion |
| 149 # interesting only in "live" session: see backtrace.exp for live test. | 154 # interesting only in "live" session: see backtrace.exp for live test. |
| 150 | 155 |
| 151 # 1.14 help trace | 156 # 1.14 help trace |
| 152 gdb_test "help trace" "Set a tracepoint at .*" "1.14: help trace" | 157 gdb_test "help trace" "Set a tracepoint at .*" "1.14: help trace" |
| 153 | 158 |
| 154 # 1.15 ftrace | 159 # 1.15 ftrace |
| 155 | 160 |
| 156 gdb_delete_tracepoints | 161 gdb_delete_tracepoints |
| 157 | 162 |
| 158 # Acceptance vs rejection of a location are target-specific, so allow both. | 163 # Acceptance vs rejection of a location are target-specific, so allow both. |
| 159 gdb_test_multiple "ftrace gdb_recursion_test" "Set a fast tracepoint" { | 164 gdb_test_multiple "ftrace gdb_recursion_test" "Set a fast tracepoint" { |
| 160 -re "Fast tracepoint $decimal at $hex: file.*$srcfile, line $testline1.*$gdb
_prompt $" { | 165 -re "Fast tracepoint $decimal at $hex: file.*$srcfile, line $testline1.*$gdb
_prompt $" { |
| 161 pass "Set a fast tracepoint" | 166 pass "Set a fast tracepoint" |
| 162 } | 167 } |
| 163 -re ".*May not have a fast tracepoint at $hex.*$gdb_prompt $" { | 168 -re ".*May not have a fast tracepoint at $hex.*$gdb_prompt $" { |
| 164 pass "Declined to set a fast tracepoint" | 169 pass "Declined to set a fast tracepoint" |
| 165 } | 170 } |
| 166 } | 171 } |
| OLD | NEW |