From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22056 invoked by alias); 25 Nov 2009 22:01:22 -0000 Received: (qmail 21791 invoked by uid 48); 25 Nov 2009 22:01:19 -0000 Date: Wed, 25 Nov 2009 22:01:00 -0000 From: "ppluzhnikov at google dot com" To: gdb-prs@sourceware.org Message-ID: <20091125220119.11022.ppluzhnikov@google.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var' X-Bugzilla-Reason: CC Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00281.txt.bz2 Originally reported here: http://sourceware.org/ml/gdb-patches/2009-11/msg00551.html --- cut --- int x; int main() { int i, j; for (i = 0; i < 500; ++i) { j = 0; // break here x = 42; j = i; // expect HW watchpoint stop } return 0; } --- cut --- gdb64-cvs -q ./a.out Reading symbols from /tmp/a.out...done. (gdb) b 7 Breakpoint 1 at 0x400455: file foo.c, line 7. (gdb) r Breakpoint 1, main () at foo.c:7 7 j = 0; // break here (gdb) watch x Hardware watchpoint 2: x (gdb) c Hardware watchpoint 2: x Old value = 0 New value = 42 main () at foo.c:9 9 j = i; // expect HW watchpoint stop (gdb) c Breakpoint 1, main () at foo.c:7 7 j = 0; // break here So far, everything is working just as one would expect. (gdb) p x $1 = 42 (gdb) set var x = 1 (gdb) print x $2 = 1 (gdb) c Breakpoint 1, main () at foo.c:7 7 j = 0; // break here (gdb) print x $3 = 42 Why didn't HW watchpoint fire? Clearly 'x' changed from 1 to 42. Software watchpoints do not suffer the same problem, as Joel correctly theorised: (gdb) set can-use-hw-watchpoints 0 (gdb) watch x Watchpoint 2: x (gdb) c Watchpoint 2: x Old value = 0 New value = 42 main () at foo.c:9 9 j = i; // expect HW watchpoint stop (gdb) c Breakpoint 1, main () at foo.c:7 7 j = 0; // break here (gdb) set x = 1 (gdb) p x $1 = 1 (gdb) c Watchpoint 2: x Old value = 42 New value = 1 main () at foo.c:8 8 x = 42; (gdb) c Watchpoint 2: x Old value = 1 New value = 42 main () at foo.c:9 9 j = i; // expect HW watchpoint stop -- Summary: HW watchpoints interact badly with 'set var' Product: gdb Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: breakpoints AssignedTo: unassigned at sourceware dot org ReportedBy: ppluzhnikov at google dot com CC: gdb-prs at sourceware dot org GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://sourceware.org/bugzilla/show_bug.cgi?id=11022 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.