Re: proposed PATCH: make watchpoints work correctly

Paul Koning
2003-05-29T17:41:25Z

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 632 bytes --]

>>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:

Daniel> I don't know how facile you are with expect, but could you
Daniel> either write a full testcase or at least give me a small
Daniel> sample code and session transcript to reduce the problem, so
Daniel> that this can go into the testsuite?

I know next to nothing about expect, and from a quick look at some
testsuite files it would take me some time to construct a proper
testcase file.

Attached are a test program and a before and after log of a session
that shows the issue with awatch. The test run was on RedHat 8.0
linux, gdb 5.3 native.

paul

[-- Attachment #2: awatch.c --]
[-- Type: text/plain, Size: 113 bytes --]

volatile int i, j;

int main (int argc, char **argv)
{
i = 1;
j = 1;
j = 2;
j = 3;
i = 2;
}

[-- Attachment #3: before.log --]
[-- Type: text/plain, Size: 1274 bytes --]

[pkoning@pkoning gdb-5.3]$ gdb/gdb a.out
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) b main
Breakpoint 1 at 0x8048318: file awatch.c, line 5.
(gdb) run
Starting program: /usr/src/gdb-5.3/a.out

Breakpoint 1, main (argc=1, argv=0xbffffae4) at awatch.c:5
5 i = 1;
(gdb) awatch i
Hardware access (read/write) watchpoint 2: i
(gdb) s
6 j = 1;
(gdb)
Hardware access (read/write) watchpoint 2: i

Value = 0
main (argc=1, argv=0xbffffae4) at awatch.c:7
7 j = 2;
(gdb)
Hardware access (read/write) watchpoint 2: i

Value = 0
main (argc=1, argv=0xbffffae4) at awatch.c:8
8 j = 3;
(gdb)
Hardware access (read/write) watchpoint 2: i

Value = 0
main (argc=1, argv=0xbffffae4) at awatch.c:9
9 i = 2;
(gdb)
Hardware access (read/write) watchpoint 2: i

Old value = 0
New value = 2
main (argc=1, argv=0xbffffae4) at awatch.c:10
10 }
(gdb) q
The program is running. Exit anyway? (y or n) y

[-- Attachment #4: after.log --]
[-- Type: text/plain, Size: 971 bytes --]

[pkoning@pkoning gdb-5.3]$ gdb/gdb a.out
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) b main
Breakpoint 1 at 0x8048318: file awatch.c, line 5.
(gdb) run
Starting program: /usr/src/gdb-5.3/a.out

Breakpoint 1, main (argc=1, argv=0xbffffae4) at awatch.c:5
5 i = 1;
(gdb) awatch i
Hardware access (read/write) watchpoint 2: i
(gdb) s
6 j = 1;
(gdb)
7 j = 2;
(gdb)
8 j = 3;
(gdb)
9 i = 2;
(gdb)
Hardware access (read/write) watchpoint 2: i

Old value = 0
New value = 2
main (argc=1, argv=0xbffffae4) at awatch.c:10
10 }
(gdb) q
The program is running. Exit anyway? (y or n) y