[PATCH 3/4] Support ranged and masked watchpoints

Thiago Jung Bauermann bauerman@br.ibm.com
Thu Dec 24 00:32:00 GMT 2009


Adds support for the following types of watchpoints:

  * Range Hardware Watchpoints: Monitors accesses to an interval of data
    addresses.  For the 476, a single Range Hardware Watchpoint can be
    used provided that no Simple/Mask watchpoints are being used.

    Available GDB commands:

      watch-range <address1>, <address2>
      watch-range <address1>, +<length>

    Similarly for awatch-range and rwatch-range.

    Examples: 
      watch-range &i,&k
      awatch-range 0xbffff8e8,0xbffff8f8
      rwatch-range 0xbffff8e8,+8

  * Mask Hardware Watchpoints: Monitors accesses to data addresses that
    match a specific pattern.  For the 476, a single Mask Hardware
    Watchpoint can be used provided that no Simple/Range watchpoints are
    being used.  Due to the processor's design, the precise data address
    of the watchpoint trigger is not available, so the user must check the
    instruction that caused the trigger (usually at PC - 4) to obtain
    such data address.  With such data address in hand, it's possible to
    tell if its contents have changed.

    Available GDB commands:

      watch <variable | address> mask <mask_value>

    Similarly for awatch-range and rwatch-range.

    Examples:

      watch i mask 0xffffff00
      awatch *0xbffff8e8 mask 0xffffff00

Since the Simple/Range/Mask Hardware Watchpoints share the same register
set, the allowed combinations are as follows:

  - 2 Simple Hardware Watchpoints with/without data value check
  - 1 Range Hardware Watchpoint
  - 1 Mask Hardware Watchpoint
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


2009-12-23  Sergio Durigan Junior  <sergiodj@linux.vnet.ibm.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* breakpoint.c (update_watchpoint): Add variables to save/restore
	new fields for the new types of hardware breakpoints/watchpoints.
	(insert_bp_location): Call the correct insertion method according
	to the type of the hardware watchpoint.
	(remove_breakpoint_1): Call the correct deletion method according
	to the type of the hardware watchpoint.
	(print_it_typical): Handle printing of masked watchpoints.
	(watchpoints_triggered): Handle the triggering of a hardware masked
	watchpoint.
	(watchpoint_check): Handle the case of a hardware mased watchpoint
	trigger.
	(hw_watchpoint_used_count): Call to target-specific function
	that will tell how many extra slots a hardware watchpoint needs.
	(mention): Handle mentioning of masked watchpoints.
	(watch_command_1): Add a routine to check for the existence of the
	`mask' parameter when the user creates a watchpoint.
	(can_use_hardware_watchpoint): Add code to check if the memory
	that is going to be watched is big, i.e., it needs a hardware ranged
	watchpoint.
	(watch_range_command_1): New function.
	(watch_range_command): Ditto.
	(awatch_range_command): Ditto.
	(rwatch_range_command): Ditto.
	(_initialize_breakpoint): Register watch-range, awatch-range and
	rwatch-range commands.
	* breakpoint.h (struct bp_location) <ranged_hw_bp_length>,
	<hw_wp_mask>: New fields.
	(hw_point_flag) <HW_POINT_RANGED_WATCH>, <HW_POINT_MASKED_WATCH>: New values.
	* findcmd.c (parse_addr_range): New function.
	(parse_find_args): Call `parse_addr_range'.
	* i386-nat.c (i386_region_ok_for_watchpoint): Add `is_big_blob'
	parameter.
	* spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Ditto.
	* ppc-linux-nat.c (ppc_linux_can_use_special_hw_point_p): Handle
	HW_POINT_RANGED_WATCH and HW_POINT_MASKED_WATCH cases.
	(ppc_linux_region_ok_for_hw_watchpoint): Add the `is_big_blob'
	parameter and ranged watchpoints.
	(ppc_linux_insert_mask_watchpoint): New function.
	(ppc_linux_remove_mask_watchpoint): New function.
	(ppc_linux_insert_watchpoint): Handle ranged watchpoints.
	(ppc_linux_remove_watchpoint): Handle ranged watchpoints.
	(ppc_linux_hw_point_extra_slot_count): New function.
	(_initialize_ppc_linux_nat): Initialize to_insert_mask_watchpoint,
	to_remove_mask_watchpoint and hw_point_extra_slot_count.
	* target.c (default_region_ok_for_hw_watchpoint): Add `is_big_blob'
	parameter.
	(debug_to_region_ok_for_hw_watchpoint): Ditto.
	(update_current_target): Insert to_insert_mask_watchpoint,
	to_remove_mask_watchpoint and to_hw_point_extra_slot_count.
	* target.h (struct target_ops <to_insert_mask_watchpoint>,
	<to_remove_mask_watchpoint>, <to_hw_point_extra_slot_count>): New
	callbacks.
	(target_region_ok_for_hw_watchpoint): Add `is_big_blob' parameter.
	(target_insert_mask_watchpoint): New define.
	(target_remove_mask_watchpoint): Ditto.
	(target_hw_point_extra_slot_count): Ditto.
	* value.h (parse_addr_range): Declare.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc476-watchpoints.diff
Type: text/x-patch
Size: 44554 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20091224/2d0c03b0/attachment.bin>


More information about the Gdb-patches mailing list