Commit Graph

7 Commits

Author SHA1 Message Date
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Luis Machado f24a38c514 Use software watchpoints if hardware watchpoints are not available when testing gdb.base/watch-bitfields.exp
There are targets GDB thinks support hardware watchpoints, but in reality they
don't.  Though it may seem that hardware watchpoint creation was successful,
the actual insertion of such watchpoint will fail when GDB moves the inferior.

(gdb) watch -location q.a^M
Hardware watchpoint 2: -location q.a^M
(gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.a
watch -location q.e^M
Hardware watchpoint 3: -location q.e^M
(gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.e
print q.a^M
$1 = 0^M
(gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression before
continue^M
Continuing.^M
Warning:^M
Could not insert hardware watchpoint 2.^M
Could not insert hardware watchpoint 3.^M
Could not insert hardware breakpoints:^M
You may have requested too many hardware breakpoints/watchpoints.^M
^M
(gdb) FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue

This leads to a number of FAILs:

FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression after
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: print expression after
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: print expression before
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression before
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression after
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit

We can avoid these errors/FAILs by checking the board data and switching to
software watchpoints if the board does not support hardware watchpoints.

gdb/testsuite/ChangeLog:

2015-04-29  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.base/watch-bitfields.exp: Switch to software watchpoints if
	the target does not support hardware watchpoints.
2015-04-29 12:22:24 -03:00
Yao Qi 45fd756caf Increase timeout in watch-bitfields.exp for software watchpoint
I see the following two timeout fails on pandaboard (arm-linux target),

 FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit (timeout)
 FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit (timeout)

In this test, more than one watchpoint is used, so the following
watchpoint requests fall back to software watchpoint, so that GDB
will single step all the way and it is very slow.

This patch is to copy the fix from

  [PATCH] GDB/testsuite: Correct gdb.base/watchpoint-solib.exp timeout tweak
  https://sourceware.org/ml/gdb-patches/2014-07/msg00716.html

I find the left-over of this patch review is to factor out code into
a procedure, so I do that in this patch.

Re-run tests watch-bitfields.exp, watchpoint-solib.exp, sigall-reverse.exp,
and until-precsave.exp on pandaboard, no regression.

gdb/testsuite:

2015-04-15  Pedro Alves  <palves@redhat.com>
	    Yao Qi  <yao.qi@linaro.org>

	* gdb.base/watch-bitfields.exp (test_watch_location): Increase
	timeout by factor of 4.
	(test_regular_watch): Likewise.
	* gdb.base/watchpoint-solib.exp: Use with_timeout_factor.
	* gdb.reverse/sigall-reverse.exp: Likewise.
	* gdb.reverse/until-precsave.exp: Likewise.
	* lib/gdb.exp (with_timeout_factor): New proc.
	(gdb_expect): Move some code to ...
	(get_largest_timeout): ... here.  New procedure.
2015-04-15 12:46:58 +01:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Sergio Durigan Junior 91c190590a gdb.base/watch-bitfields.exp: Improve test
Make test messages unique and a couple other tweaks.

gdb/testsuite/
2014-09-16  Sergio Durigan Junior  <sergiodj@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.base/watch-bitfields.exp: Pass string other than test file
	name to prepare_for_testing.
	(watch): New procedure.
	(expect_watchpoint): Use with_test_prefix.
	(top level): Factor out tests to ...
	(test_watch_location, test_regular_watch): ... these new
	procedures, and use with_test_prefix and gdb_continue_to_end.
2014-09-16 17:55:21 +01:00
Patrick Palka bb9d5f81c3 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.
2014-09-16 17:40:06 +01:00