[gdb] Data watchpoints in Windows weirdness. Call for testers.

René Berber r.berber@computer.org
Sun Oct 14 01:20:00 GMT 2007


Pedro Alves wrote:

[snip]
> Any change someone does the little testing to make sure I'm not
> having a local problem here?
> 
> as easy as:
> 
> gcc main.c -o main.exe -g3 -O0
> gdb main.exe
> start
> watch count
> 'continue' several times, and send me or post here the results.
> 
> A log with the these on would be nice, but not essencial:
> set debug infrun 1
> set debugevents 1
> set debugexceptions 1
> maint show-debug-regs 1

$ gcc main.c -o main.exe -g3 -O0

rberber@black /c/tmp
$ gdb main.exe
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
Copyright (C) 2006 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-cygwin"...
(gdb) start
Breakpoint 1 at 0x401075: file main.c, line 8.
Starting program: /c/tmp/main.exe
Loaded symbols for /c/WINDOWS/system32/ntdll.dll
Loaded symbols for /c/WINDOWS/system32/kernel32.dll
Loaded symbols for /usr/bin/cygwin1.dll
Loaded symbols for /c/WINDOWS/system32/advapi32.dll
Loaded symbols for /c/WINDOWS/system32/rpcrt4.dll
main ()
    at main.c:8
8	{
(gdb) watch count
Hardware watchpoint 2: count
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at main.c:11
11	  printf ("count %d\n", count);
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at main.c:16
16	      printf ("count %d\n", count);
(gdb) p count
$1 = 1000
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at main.c:18
18	      Sleep (1000);
(gdb) p count
$3 = 1001
(gdb) c
Continuing.
Hardware watchpoint 2: count

Old value = 0
New value = 1002
main () at main.c:18
18	      Sleep (1000);
(gdb) c
Continuing.
Hardware watchpoint 2: count

Old value = 1002
New value = 1003
main () at main.c:18
18	      Sleep (1000);
(gdb) c
Continuing.
Hardware watchpoint 2: count

Old value = 1003
New value = 1004
main () at main.c:18
18	      Sleep (1000);
(gdb) c
Continuing.
Hardware watchpoint 2: count

Old value = 1004
New value = 1005
main () at main.c:18
18	      Sleep (1000);
(gdb) c
Continuing.
Hardware watchpoint 2: count

Old value = 1005
New value = 1006
main () at main.c:18
18	      Sleep (1000);
(gdb) set debug infrun 1
(gdb) set debugevents 1
(gdb) set debugexceptions 1
(gdb) maint show-debug-regs 1
(gdb) c
Continuing.
infrun: proceed (addr=0xffffffff, signal=144, step=0)
insert_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: resume (step=0, signal=0)
ContinueDebugEvent (cpid=1548, ctid=1364, DBG_CONTINUE);
infrun: wait_for_inferior
gdb: kernel event for pid=1548 tid=1364 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_SINGLE_STEP at 0x004010d9
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x4010d9
watchpoint_hit (addr=403010, len=-1, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: BPSTATE_WHAT_STOP_NOISY
infrun: stop_stepping
remove_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0100          STATUS (DR6): ffff0ff1
	DR0: addr=0x00000000, ref.count=0  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
Hardware watchpoint 2: count

Old value = 1006
New value = 1007
main () at main.c:18
18	      Sleep (1000);
(gdb) c
Continuing.
infrun: proceed (addr=0xffffffff, signal=144, step=0)
insert_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: resume (step=0, signal=0)
ContinueDebugEvent (cpid=1548, ctid=1364, DBG_CONTINUE);
infrun: wait_for_inferior
gdb: kernel event for pid=1548 tid=1364 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_SINGLE_STEP at 0x004010d9
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x4010d9
watchpoint_hit (addr=403010, len=-1, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: BPSTATE_WHAT_STOP_NOISY
infrun: stop_stepping
remove_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0100          STATUS (DR6): ffff0ff1
	DR0: addr=0x00000000, ref.count=0  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
Hardware watchpoint 2: count

Old value = 1007
New value = 1008
main () at main.c:18
18	      Sleep (1000);
(gdb) c
Continuing.
infrun: proceed (addr=0xffffffff, signal=144, step=0)
insert_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: resume (step=0, signal=0)
ContinueDebugEvent (cpid=1548, ctid=1364, DBG_CONTINUE);
infrun: wait_for_inferior
gdb: kernel event for pid=1548 tid=1364 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_SINGLE_STEP at 0x004010d9
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x4010d9
watchpoint_hit (addr=403010, len=-1, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: BPSTATE_WHAT_STOP_NOISY
infrun: stop_stepping
remove_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0100          STATUS (DR6): ffff0ff1
	DR0: addr=0x00000000, ref.count=0  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
Hardware watchpoint 2: count

Old value = 1008
New value = 1009
main () at main.c:18
18	      Sleep (1000);
(gdb) c
Continuing.
infrun: proceed (addr=0xffffffff, signal=144, step=0)
insert_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: resume (step=0, signal=0)
ContinueDebugEvent (cpid=1548, ctid=1364, DBG_CONTINUE);
infrun: wait_for_inferior
gdb: kernel event for pid=1548 tid=1364 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_SINGLE_STEP at 0x004010d9
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x4010d9
watchpoint_hit (addr=403010, len=-1, type=data-write):
	CONTROL (DR7): 000d0101          STATUS (DR6): ffff0ff1
	DR0: addr=0x00403010, ref.count=1  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
infrun: BPSTATE_WHAT_STOP_NOISY
infrun: stop_stepping
remove_watchpoint (addr=403010, len=4, type=data-write):
	CONTROL (DR7): 000d0100          STATUS (DR6): ffff0ff1
	DR0: addr=0x00000000, ref.count=0  DR1: addr=0x00000000, ref.count=0
	DR2: addr=0x00000000, ref.count=0  DR3: addr=0x00000000, ref.count=0
Hardware watchpoint 2: count

Old value = 1009
New value = 1010
main () at main.c:18
18	      Sleep (1000);
(gdb) ki
Kill the program being debugged? (y or n) y
ContinueDebugEvent (cpid=1548, ctid=1364, DBG_CONTINUE);
ContinueDebugEvent (cpid=1548, ctid=1364, DBG_CONTINUE);
ContinueDebugEvent (cpid=1548, ctid=3808, DBG_CONTINUE);
gdb: win32_close, inferior_ptid=1364
(gdb) q

-- 
René Berber


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list