This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var'
- From: "ppluzhnikov at google dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 25 Nov 2009 22:01:19 -0000
- Subject: [Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var'
- Reply-to: sourceware-bugzilla at sourceware dot org
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.