gdbserver: decouple x86 watchpoint / hw breakpoint routines from Z packet numbers.

My main motivation here is moving in the direction of decoupling
insert_point/remove_point from packet numbers, though this bit alone
should make it a little bit easier to merge gdb/gdbserver/i386-low.c
and gdb/i386-nat.c (which are largely the same).

Tested on x86_64 Fedora 17, and cross built for i686-mingw32 too.

gdb/gdbserver/
2014-04-23  Pedro Alves  <palves@redhat.com>

	* i386-low.c: Don't include break-common.h here.
	(i386_low_insert_watchpoint, i386_low_remove_watchpoint): Change
	prototype to take target_hw_bp_type as argument instead of a Z
	packet char.
	* i386-low.h: Include break-common.h here.
	(Z_packet_to_hw_type): Declare.
	(i386_low_insert_watchpoint, i386_low_remove_watchpoint): Change
	prototypes.
	* linux-x86-low.c (x86_insert_point): Convert the packet number to
	a target_hw_bp_type before calling i386_low_insert_watchpoint.
	(x86_remove_point): Convert the packet number to a
	target_hw_bp_type before calling i386_low_remove_watchpoint.
	* win32-i386-low.c (i386_insert_point): Convert the packet number
	to a target_hw_bp_type before calling i386_low_insert_watchpoint.
	(i386_remove_point): Convert the packet number to a
	target_hw_bp_type before calling i386_low_remove_watchpoint.
This commit is contained in:
Pedro Alves 2014-04-22 19:47:04 +01:00
parent b8acf84369
commit a4165e94f4
5 changed files with 62 additions and 21 deletions

View file

@ -641,8 +641,13 @@ x86_insert_point (char type, CORE_ADDR addr, int len)
case '2': /* write watchpoint */
case '3': /* read watchpoint */
case '4': /* access watchpoint */
return i386_low_insert_watchpoint (&proc->private->arch_private->debug_reg_state,
type, addr, len);
{
enum target_hw_bp_type hw_type = Z_packet_to_hw_type (type);
struct i386_debug_reg_state *state
= &proc->private->arch_private->debug_reg_state;
return i386_low_insert_watchpoint (state, hw_type, addr, len);
}
default:
/* Unsupported. */
@ -671,8 +676,13 @@ x86_remove_point (char type, CORE_ADDR addr, int len)
case '2': /* write watchpoint */
case '3': /* read watchpoint */
case '4': /* access watchpoint */
return i386_low_remove_watchpoint (&proc->private->arch_private->debug_reg_state,
type, addr, len);
{
enum target_hw_bp_type hw_type = Z_packet_to_hw_type (type);
struct i386_debug_reg_state *state
= &proc->private->arch_private->debug_reg_state;
return i386_low_remove_watchpoint (state, hw_type, addr, len);
}
default:
/* Unsupported. */
return 1;