From: Pierre Muller Date: Sat, 26 Sep 2009 12:08:31 +0000 (+0000) Subject: gdb ChangeLog entry: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=087b74b25b24a901bc78eb5a2d436dd1fd5fda21;p=binutils-gdb.git gdb ChangeLog entry: * i386-nat.c (i386_stopped_data_address): Also check that hitted watch register is not vacant. gdb/testsuite ChangeLog entry: New test for two watchpoints, with disabling of the first inserted. * testsuite/gdb.base/watchpoints.c: New file. * testsuite/gdb.base/watchpoints.exp: New file. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e2396a260c2..25964d31bd4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-09-26 Pierre Muller + + * i386-nat.c (i386_stopped_data_address): Also check that + hitted watch register is not vacant. + 2009-09-25 Tom Tromey PR python/10664: diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index ab1bd8a83fe..325b4df6ca1 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -555,7 +555,10 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) that GDB doesn't call the target_stopped_data_address method except for data watchpoints. In other words, I'm being paranoiac. */ - && I386_DR_GET_RW_LEN (i) != 0) + && I386_DR_GET_RW_LEN (i) != 0 + /* This third condition makes sure DRi is not vacant, this + avoids false positives in windows-nat.c. */ + && !I386_DR_VACANT (i)) { addr = dr_mirror[i]; rc = 1; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 54f7963faed..555868a8f02 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-09-26 Pierre Muller + + New test for two watchpoints, with disabling of + the first inserted. + * testsuite/gdb.base/watchpoints.c: New file. + * testsuite/gdb.base/watchpoints.exp: New file. + 2009-09-25 Tom Tromey * gdb.base/charset.exp: Test utf-16 strings with Python. diff --git a/gdb/testsuite/gdb.base/watchpoints.c b/gdb/testsuite/gdb.base/watchpoints.c new file mode 100644 index 00000000000..fa9ba34095f --- /dev/null +++ b/gdb/testsuite/gdb.base/watchpoints.c @@ -0,0 +1,33 @@ +#include +#include +/* + * This source is mainly to test + * what happens when a watchpoint is removed + * while another watchpoint, inserted later is + * left active. + */ + +int count = -1; +int ival1 = -1; +int ival2 = -1; +int ival3 = -1; +int ival4 = -1; + +int +main () +{ +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + + for (count = 0; count < 4; count++) { + ival1 = count; ival2 = count; + ival3 = count; ival4 = count; + } + + ival1 = count; ival2 = count; /* Outside loop */ + ival3 = count; ival4 = count; + + return 0; +} diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp new file mode 100644 index 00000000000..7abe14bb874 --- /dev/null +++ b/gdb/testsuite/gdb.base/watchpoints.exp @@ -0,0 +1,101 @@ +# Copyright 2009 +# 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 +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This file was written by Pierre Muller. (muller@ics.u-strasbg.fr) + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "watchpoints" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +set wp_set 1 + +if [get_compiler_info ${binfile}] { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested watchpoint.exp + return -1 +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load $binfile + + runto_main + gdb_test "watch ival1" "" "" + gdb_test "watch ival3" "" "" + + set timeout 600 + + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = -1.*New value = 0.*ival1 = count; ival2 = count;.*" "watchpoint hit, first time" + + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit, first time" + + # Check that the ival3 hit count is reported correctly + gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 1 time.*" "Watchpoint hit count is 1" + + # Continue until the next change for ival1, from 0 to 1. + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 0.*New value = 1.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, second time" + + # Check that the hit count for ival1 is reported correctly + gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 2 times.*" "Watchpoint ival1 hit count is 2" + + # Continue until the next change for ival3, from 0 to 1. + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time" + + # Check that the hit count is reported correctly + gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 2 times.*" "Watchpoint hit count is 2" + + # Continue until the next change, from 1 to 2. + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 1.*New value = 2.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, third time" + + # Check that the hit count is reported correctly + gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 3 times.*" "Watchpoint ival1 hit count is 3" + # Disable ival1 watchpoint + gdb_test "disable 2" "" "" + + # Continue until the next change, from 1 to 2. + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time" + + # Check that the hit count is reported correctly + gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "Watchpoint hit count is 3" + + # Continue until the next change, from 2 to 3. + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time" + + # Check that the hit count is reported correctly + gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 4 times.*" "Watchpoint hit count is 4" + + # Continue until the next change, from 3 to 4. + # Note that this one is outside the loop. + + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time" + + # Check that the hit count is reported correctly + gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 5 times.*" "Watchpoint hit count is 5" + +