summaryrefslogtreecommitdiff
path: root/gdb/gdbserver/i386-low.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-04-22 19:47:04 +0100
committerPedro Alves <palves@redhat.com>2014-04-23 18:33:52 +0100
commita4165e94f452b3137a1071a5034853a93a9de1a2 (patch)
tree6df836db855c5b2464ef3a4c757d6be41252a135 /gdb/gdbserver/i386-low.c
parentb8acf843690988fa96123b3c54bc3850d874eb35 (diff)
downloadbinutils-gdb-a4165e94f452b3137a1071a5034853a93a9de1a2.tar.gz
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.
Diffstat (limited to 'gdb/gdbserver/i386-low.c')
-rw-r--r--gdb/gdbserver/i386-low.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/gdbserver/i386-low.c b/gdb/gdbserver/i386-low.c
index 33ef0a4d60f..03eebd1b761 100644
--- a/gdb/gdbserver/i386-low.c
+++ b/gdb/gdbserver/i386-low.c
@@ -20,7 +20,6 @@
#include "server.h"
#include "target.h"
#include "i386-low.h"
-#include "break-common.h"
/* Support for 8-byte wide hw watchpoints. */
#ifndef TARGET_HAS_DR_LEN_8
@@ -408,9 +407,7 @@ Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n",
#define Z_PACKET_READ_WP '3'
#define Z_PACKET_ACCESS_WP '4'
-/* Map the protocol watchpoint type TYPE to enum target_hw_bp_type. */
-
-static enum target_hw_bp_type
+enum target_hw_bp_type
Z_packet_to_hw_type (char type)
{
switch (type)
@@ -457,10 +454,10 @@ i386_update_inferior_debug_regs (struct i386_debug_reg_state *inf_state,
int
i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
- char type_from_packet, CORE_ADDR addr, int len)
+ enum target_hw_bp_type type,
+ CORE_ADDR addr, int len)
{
int retval;
- enum target_hw_bp_type type = Z_packet_to_hw_type (type_from_packet);
/* Work on a local copy of the debug registers, and on success,
commit the change back to the inferior. */
struct i386_debug_reg_state local_state = *state;
@@ -493,14 +490,14 @@ i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
/* Remove a watchpoint that watched the memory region which starts at
address ADDR, whose length is LEN bytes, and for accesses of the
- type TYPE_FROM_PACKET. Return 0 on success, -1 on failure. */
+ type TYPE. Return 0 on success, -1 on failure. */
int
i386_low_remove_watchpoint (struct i386_debug_reg_state *state,
- char type_from_packet, CORE_ADDR addr, int len)
+ enum target_hw_bp_type type,
+ CORE_ADDR addr, int len)
{
int retval;
- enum target_hw_bp_type type = Z_packet_to_hw_type (type_from_packet);
/* Work on a local copy of the debug registers, and on success,
commit the change back to the inferior. */
struct i386_debug_reg_state local_state = *state;