public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/9681] New: gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members
@ 2008-12-23 22:26 pmaydell at chiark dot greenend dot org dot uk
  2008-12-30  0:26 ` [Bug breakpoints/9681] " pedro at codesourcery dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pmaydell at chiark dot greenend dot org dot uk @ 2008-12-23 22:26 UTC (permalink / raw)
  To: gdb-prs

Seen with gdb-weekly-6.8.50.20081216.tar.bz2 on Linux/ix86 native.

This snapshot of gdb will happily allow you to put watchpoints on structure
members which don't exist:
  (gdb) watch myfoo.nosuchmember
  Watchpoint 2: myfoo.nosuchmember

Trying the same thing with ubuntu's gdb (which advertises itself as "GNU gdb
6.8-debian") gives:
  (gdb) watch myfoo.nosuchmember
  There is no member named nosuchmember.

So I guess this is a regression. It seems to be watchpoint-specific; for
instance "print myfoo.nosuch" correctly gives an error.

The transcript below gives a more complete test example.

pm215@canth:~/gdb-srcs$ cat t.c
struct foo {
  int x;
  int y;
};
struct foo myfoo;
int main(void) {
  myfoo.x = 1;
  return 0;
}
pm215@canth:~/gdb-srcs$ gcc -g -Wall -o t t.c
pm215@canth:~/gdb-srcs$ build/gdb/gdb t
GNU gdb (GDB) 6.8.50.20081216
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) break main
Breakpoint 1 at 0x80483a2: file t.c, line 7.
(gdb) run
Starting program: /home/pm215/gdb-srcs/t

Breakpoint 1, main () at t.c:7
7         myfoo.x = 1;
(gdb) watch myfoo.nosuchmember
Watchpoint 2: myfoo.nosuchmember
(gdb) c
Continuing.

Program exited normally.
Current language:  auto; currently asm

-- 
           Summary: gdb-weekly-6.8.50.20081216 lets you set watchpoints on
                    nonexistent struct members
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: pmaydell at chiark dot greenend dot org dot uk
                CC: gdb-prs at sourceware dot org
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=9681

------- 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] 5+ messages in thread

* [Bug breakpoints/9681] gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members
  2008-12-23 22:26 [Bug breakpoints/9681] New: gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members pmaydell at chiark dot greenend dot org dot uk
@ 2008-12-30  0:26 ` pedro at codesourcery dot com
  2008-12-31 17:55 ` pedro at codesourcery dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pedro at codesourcery dot com @ 2008-12-30  0:26 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pedro at codesourcery dot com  2008-12-30 00:26 -------
I tracked it down to around 2008-03-03.  This seems related/suspicious:

2008-03-03  Daniel Jacobowitz  <dan@codesourcery.com>

	* breakpoint.c (fetch_watchpoint_value): New function.
	(update_watchpoint): Set and clear val_valid.  Use
	fetch_watchpoint_value.  Handle unreadable values on the
	value chain.  Correct check for user-requested array watchpoints.
	(breakpoint_init_inferior): Clear val_valid.
	(watchpoint_value_print): New function.
	(print_it_typical): Use it.  Do not free or clear old_val.  Print
	watchpoints even if old_val == NULL.
	(watchpoint_check): Use fetch_watchpoint_value.  Check for values
	becoming readable or unreadable.
	(watch_command_1): Use fetch_watchpoint_value.  Set val_valid.
	(do_enable_watchpoint): Likewise.
	* breakpoint.h (struct breakpoint): Update comment for val.  Add
	val_valid.
	* NEWS: Mention watchpoints on inaccessible memory.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1


http://sourceware.org/bugzilla/show_bug.cgi?id=9681

------- 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] 5+ messages in thread

* [Bug breakpoints/9681] gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members
  2008-12-23 22:26 [Bug breakpoints/9681] New: gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members pmaydell at chiark dot greenend dot org dot uk
  2008-12-30  0:26 ` [Bug breakpoints/9681] " pedro at codesourcery dot com
@ 2008-12-31 17:55 ` pedro at codesourcery dot com
  2009-01-01 22:02 ` cvs-commit at gcc dot gnu dot org
  2009-01-01 22:04 ` pedro at codesourcery dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pedro at codesourcery dot com @ 2008-12-31 17:55 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pedro at codesourcery dot com  2008-12-31 17:55 -------
Testing a patch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|pedro at codesourcery dot
                   |org                         |com
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=9681

------- 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] 5+ messages in thread

* [Bug breakpoints/9681] gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members
  2008-12-23 22:26 [Bug breakpoints/9681] New: gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members pmaydell at chiark dot greenend dot org dot uk
  2008-12-30  0:26 ` [Bug breakpoints/9681] " pedro at codesourcery dot com
  2008-12-31 17:55 ` pedro at codesourcery dot com
@ 2009-01-01 22:02 ` cvs-commit at gcc dot gnu dot org
  2009-01-01 22:04 ` pedro at codesourcery dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2009-01-01 22:02 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-01-01 22:02 -------
Subject: Bug 9681

CVSROOT:	/cvs/src
Module name:	src
Changes by:	palves@sourceware.org	2009-01-01 22:02:03

Modified files:
	gdb            : ChangeLog breakpoint.c corefile.c exceptions.h 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.base: watchpoint.exp 

Log message:
	2009-01-01  Pedro Alves  <pedro@codesourcery.com>
	
	PR breakpoints/9681:
	* exceptions.h (enum errors): New error type, MEMORY_ERROR.
	* corefile.c (memory_error): Rewrite to throw a MEMORY_ERROR.
	* breakpoint.c (fetch_watchpoint_value): Ignore MEMORY_ERRORs, but
	retrow all other exceptions.
	
	2009-01-01  Pedro Alves  <pedro@codesourcery.com>
	
	PR breakpoints/9681:
	* gdb.base/watchpoint.exp: Add regression test.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.10057&r2=1.10058
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.c.diff?cvsroot=src&r1=1.368&r2=1.369
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/corefile.c.diff?cvsroot=src&r1=1.47&r2=1.48
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/exceptions.h.diff?cvsroot=src&r1=1.22&r2=1.23
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1783&r2=1.1784
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/watchpoint.exp.diff?cvsroot=src&r1=1.19&r2=1.20



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=9681

------- 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] 5+ messages in thread

* [Bug breakpoints/9681] gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members
  2008-12-23 22:26 [Bug breakpoints/9681] New: gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members pmaydell at chiark dot greenend dot org dot uk
                   ` (2 preceding siblings ...)
  2009-01-01 22:02 ` cvs-commit at gcc dot gnu dot org
@ 2009-01-01 22:04 ` pedro at codesourcery dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pedro at codesourcery dot com @ 2009-01-01 22:04 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pedro at codesourcery dot com  2009-01-01 22:04 -------
Fix checked in.  The next snapshot should have this fixed.  Thanks!


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|6.8                         |6.9


http://sourceware.org/bugzilla/show_bug.cgi?id=9681

------- 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] 5+ messages in thread

end of thread, other threads:[~2009-01-01 22:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-23 22:26 [Bug breakpoints/9681] New: gdb-weekly-6.8.50.20081216 lets you set watchpoints on nonexistent struct members pmaydell at chiark dot greenend dot org dot uk
2008-12-30  0:26 ` [Bug breakpoints/9681] " pedro at codesourcery dot com
2008-12-31 17:55 ` pedro at codesourcery dot com
2009-01-01 22:02 ` cvs-commit at gcc dot gnu dot org
2009-01-01 22:04 ` pedro at codesourcery 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).