| OLD | NEW |
| 1 # Copyright 2010-2012 Free Software Foundation, Inc. | 1 # This testcase is part of GDB, the GNU debugger. |
| 2 | 2 |
| 3 # Copyright 2012 Free Software Foundation, Inc. |
| 4 # |
| 3 # This program is free software; you can redistribute it and/or modify | 5 # 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 | 6 # 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 | 7 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 8 # (at your option) any later version. |
| 7 # | 9 # |
| 8 # This program is distributed in the hope that it will be useful, | 10 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
| 12 # | 14 # |
| 13 # You should have received a copy of the GNU General Public License | 15 # 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/>. | 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 17 |
| 16 # | 18 load_lib "go.exp" |
| 17 # Tests watchpoints that watch expressions that don't involve memory. | |
| 18 # | |
| 19 | 19 |
| 20 set testfile "watch-non-mem" | 20 if { [skip_go_tests] } { continue } |
| 21 set srcfile ${testfile}.c | |
| 22 set binfile ${objdir}/${subdir}/${testfile} | |
| 23 | 21 |
| 24 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { | 22 standard_testfile .go |
| 25 untested ${testfile}.exp | 23 |
| 24 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug go}] } { |
| 26 return -1 | 25 return -1 |
| 27 } | 26 } |
| 28 | 27 |
| 29 if ![runto_main] then { | 28 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] |
| 30 fail "Can't run to main" | 29 |
| 31 return | 30 if { [go_runto_main] < 0 } { |
| 31 untested $testfile |
| 32 return -1 |
| 32 } | 33 } |
| 33 | 34 |
| 34 gdb_test "watch \$pc" \ | 35 if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { |
| 35 "Watchpoint .*: .pc" \ | 36 pass "setting breakpoint 1" |
| 36 "set write watchpoint on \$pc" | 37 } |
| 37 | 38 |
| 38 gdb_test "continue" \ | 39 gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint" |
| 39 "Watchpoint 2: .pc.*Old value = .*New value = .*" \ | 40 |
| 40 "watchpoint on \$pc works" | 41 gdb_test {print "abc" + "def"} {.* = "abcdef"} |
| OLD | NEW |