public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/12526] New: watch -location false positives on bitfields
@ 2011-03-01 17:44 jan.kratochvil at redhat dot com
2014-09-16 16:42 ` [Bug breakpoints/12526] " cvs-commit at gcc dot gnu.org
2014-09-16 17:19 ` palves at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-03-01 17:44 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12526
Summary: watch -location false positives on bitfields
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: breakpoints
AssignedTo: unassigned@sourceware.org
ReportedBy: jan.kratochvil@redhat.com
CC: tromey@redhat.com
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
struct s {
unsigned a:1;
unsigned b:1;
} v;
int main (void) {
v.b = 1;
return 0;
}
GNU gdb (GDB) 7.2.50.20110228-cvs
(gdb) watch -location v.a
Watchpoint 1: -location: v.a
(gdb) run
Starting program: /home/jkratoch/t/f
Hardware watchpoint 1: -location: v.a
Old value = 0
New value = 2
main () at f.c:7
7 return 0;
(gdb) _
But `v.a' has not changed at all.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug breakpoints/12526] watch -location false positives on bitfields
2011-03-01 17:44 [Bug breakpoints/12526] New: watch -location false positives on bitfields jan.kratochvil at redhat dot com
@ 2014-09-16 16:42 ` cvs-commit at gcc dot gnu.org
2014-09-16 17:19 ` palves at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-09-16 16:42 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=12526
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The branch, master has been updated
via bb9d5f81c36ecc61e3d4a70ce7e41348c8b12fef (commit)
from d3d3c6db1a3de87d5df6900f3be0557c33fa23b3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bb9d5f81c36ecc61e3d4a70ce7e41348c8b12fef
commit bb9d5f81c36ecc61e3d4a70ce7e41348c8b12fef
Author: Patrick Palka <patrick@parcs.ath.cx>
Date: Tue Sep 16 17:40:06 2014 +0100
Fix PR12526: -location watchpoints for bitfield arguments
PR 12526 reports that -location watchpoints against bitfield arguments
trigger false positives when bits around the bitfield, but not the
bitfield itself, are modified.
This happens because -location watchpoints naturally operate at the
byte level, not at the bit level. When the address of a bitfield
lvalue is taken, information about the bitfield (i.e. its offset and
size) is lost in the process.
This information must first be retained throughout the lifetime of the
-location watchpoint. This patch achieves this by adding two new
fields to the watchpoint struct: val_bitpos and val_bitsize. These
fields are set when a watchpoint is first defined in watch_command_1.
They are both equal to zero if the watchpoint is not a -location
watchpoint or if the argument is not a bitfield.
Then these bitfield parameters are used inside update_watchpoint and
watchpoint_check to extract the actual value of the bitfield from the
watchpoint address, with the help of a local helper function
extract_bitfield_from_watchpoint_value.
Finally when creating a HW breakpoint pointing to a bitfield, we
optimize the address and length of the breakpoint. By skipping over
the bytes that don't cover the bitfield, this step reduces the
frequency at which a read watchpoint for the bitfield is triggered.
It also reduces the number of times a false-positive call to
check_watchpoint is triggered for a write watchpoint.
gdb/
PR breakpoints/12526
* breakpoint.h (struct watchpoint): New fields val_bitpos and
val_bitsize.
* breakpoint.c (watch_command_1): Use these fields to retain
bitfield information.
(extract_bitfield_from_watchpoint_value): New function.
(watchpoint_check): Use it.
(update_watchpoint): Use it. Optimize the address and length of a
HW watchpoint pointing to a bitfield.
* value.h (unpack_value_bitfield): New prototype.
* value.c (unpack_value_bitfield): Make extern.
gdb/testsuite/
PR breakpoints/12526
* gdb.base/watch-bitfields.exp: New file.
* gdb.base/watch-bitfields.c: New file.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 14 +++++
gdb/breakpoint.c | 74 +++++++++++++++++++++++++++-
gdb/breakpoint.h | 5 ++
gdb/testsuite/ChangeLog | 6 ++
gdb/testsuite/gdb.base/watch-bitfields.c | 54 ++++++++++++++++++++
gdb/testsuite/gdb.base/watch-bitfields.exp | 56 +++++++++++++++++++++
gdb/value.c | 2 +-
gdb/value.h | 5 ++
8 files changed, 214 insertions(+), 2 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/watch-bitfields.c
create mode 100644 gdb/testsuite/gdb.base/watch-bitfields.exp
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug breakpoints/12526] watch -location false positives on bitfields
2011-03-01 17:44 [Bug breakpoints/12526] New: watch -location false positives on bitfields jan.kratochvil at redhat dot com
2014-09-16 16:42 ` [Bug breakpoints/12526] " cvs-commit at gcc dot gnu.org
@ 2014-09-16 17:19 ` palves at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: palves at redhat dot com @ 2014-09-16 17:19 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=12526
Pedro Alves <palves at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |palves at redhat dot com
Resolution|--- |FIXED
Target Milestone|--- |7.9
--- Comment #2 from Pedro Alves <palves at redhat dot com> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-16 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 17:44 [Bug breakpoints/12526] New: watch -location false positives on bitfields jan.kratochvil at redhat dot com
2014-09-16 16:42 ` [Bug breakpoints/12526] " cvs-commit at gcc dot gnu.org
2014-09-16 17:19 ` palves at redhat 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).