public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var'
@ 2009-11-25 22:01 ppluzhnikov at google dot com
  2009-11-25 22:01 ` [Bug breakpoints/11022] " ppluzhnikov at google dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ppluzhnikov at google dot com @ 2009-11-25 22:01 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug breakpoints/11022] HW watchpoints interact badly with 'set var'
  2009-11-25 22:01 [Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var' ppluzhnikov at google dot com
@ 2009-11-25 22:01 ` ppluzhnikov at google dot com
  2009-12-03 17:47 ` cvs-commit at gcc dot gnu dot org
  2009-12-03 17:49 ` ppluzhnikov at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ppluzhnikov at google dot com @ 2009-11-25 22:01 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|ppluzhnikov at google dot
                   |org                         |com
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1


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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug breakpoints/11022] HW watchpoints interact badly with 'set var'
  2009-11-25 22:01 [Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var' ppluzhnikov at google dot com
  2009-11-25 22:01 ` [Bug breakpoints/11022] " ppluzhnikov at google dot com
@ 2009-12-03 17:47 ` cvs-commit at gcc dot gnu dot org
  2009-12-03 17:49 ` ppluzhnikov at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2009-12-03 17:47 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-12-03 17:47 -------
Subject: Bug 11022

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ppluzhnikov@sourceware.org	2009-12-03 17:47:08

Modified files:
	gdb            : ChangeLog breakpoint.c 
	gdb/testsuite  : ChangeLog 
Added files:
	gdb/testsuite/gdb.base: pr11022.c pr11022.exp 

Log message:
	ChangeLog:
	
	2009-12-03  Paul Pluzhnikov  <ppluzhnikov@google.com>
	
	PR gdb/11022
	
	* breakpoint.c (invalidate_bp_value_on_memory_change):
	New function.
	(_initialize_breakpoint): Add it as memory change observer.
	
	testsuite/ChangeLog:
	
	2009-12-03  Paul Pluzhnikov  <ppluzhnikov@google.com>
	
	PR gdb/11022
	
	* gdb.base/pr11022.exp: New test.
	* gdb.base/pr11022.c: New test.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11125&r2=1.11126
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.c.diff?cvsroot=src&r1=1.437&r2=1.438
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2042&r2=1.2043
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/pr11022.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/pr11022.exp.diff?cvsroot=src&r1=NONE&r2=1.1



-- 


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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug breakpoints/11022] HW watchpoints interact badly with 'set var'
  2009-11-25 22:01 [Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var' ppluzhnikov at google dot com
  2009-11-25 22:01 ` [Bug breakpoints/11022] " ppluzhnikov at google dot com
  2009-12-03 17:47 ` cvs-commit at gcc dot gnu dot org
@ 2009-12-03 17:49 ` ppluzhnikov at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ppluzhnikov at google dot com @ 2009-12-03 17:49 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From ppluzhnikov at google dot com  2009-12-03 17:49 -------
Fixed in CVS.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-03 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-25 22:01 [Bug breakpoints/11022] New: HW watchpoints interact badly with 'set var' ppluzhnikov at google dot com
2009-11-25 22:01 ` [Bug breakpoints/11022] " ppluzhnikov at google dot com
2009-12-03 17:47 ` cvs-commit at gcc dot gnu dot org
2009-12-03 17:49 ` ppluzhnikov at google dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).