forked from Imagelibrary/binutils-gdb
[GDBserver] Move Z packet defines and type convertion routines to shared code.
The Aarch64, MIPS and x86 Linux backends all have Z packet number defines and corresponding protocol number to internal type convertion routines. Factor them all out to gdbserver's core code, so we only have one shared copy. Tested on x86_64 Fedora 20, and also cross built for aarch64-linux-gnu and mips-linux-gnu. gdb/gdbserver/ 2014-05-20 Pedro Alves <palves@redhat.com> * mem-break.h: Include break-common.h. (Z_PACKET_SW_BP, Z_PACKET_HW_BP, Z_PACKET_WRITE_WP) (Z_PACKET_READ_WP, Z_PACKET_ACCESS_WP): New defines. (Z_packet_to_target_hw_bp_type): New declaration. * mem-break.c (Z_packet_to_target_hw_bp_type): New function. * i386-low.c (Z_PACKET_HW_BP, Z_PACKET_WRITE_WP, Z_PACKET_READ_WP) (Z_PACKET_ACCESS_WP): Delete macros. (Z_packet_to_hw_type): Delete function. * i386-low.h: Don't include break-common.h here. (Z_packet_to_hw_type): Delete declaration. * linux-x86-low.c (x86_insert_point, x86_insert_point): Call Z_packet_to_target_hw_bp_type instead of Z_packet_to_hw_type. * win32-i386-low.c (i386_insert_point, i386_remove_point): Call Z_packet_to_target_hw_bp_type instead of Z_packet_to_hw_type. * linux-aarch64-low.c: Don't include break-common.h here. (Z_PACKET_SW_BP, Z_PACKET_HW_BP, Z_PACKET_WRITE_WP) (Z_PACKET_READ_WP, Z_PACKET_ACCESS_WP): Delete macros. (Z_packet_to_target_hw_bp_type): Delete function. * linux-mips-low.c (rsp_bp_type_to_target_hw_bp_type): Delete function. (mips_insert_point, mips_remove_point): Use Z_packet_to_target_hw_bp_type.
This commit is contained in:
@@ -372,24 +372,6 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp)
|
||||
}
|
||||
}
|
||||
|
||||
/* Translate breakpoint type TYPE in rsp to 'enum target_hw_bp_type'. */
|
||||
|
||||
static enum target_hw_bp_type
|
||||
rsp_bp_type_to_target_hw_bp_type (char type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case '2':
|
||||
return hw_write;
|
||||
case '3':
|
||||
return hw_read;
|
||||
case '4':
|
||||
return hw_access;
|
||||
}
|
||||
|
||||
gdb_assert_not_reached ("unhandled RSP breakpoint type");
|
||||
}
|
||||
|
||||
/* This is the implementation of linux_target_ops method
|
||||
insert_point. */
|
||||
|
||||
@@ -434,7 +416,7 @@ mips_insert_point (char type, CORE_ADDR addr, int len)
|
||||
mips_linux_watch_populate_regs (private->current_watches, ®s);
|
||||
|
||||
/* Now try to add the new watch. */
|
||||
watch_type = rsp_bp_type_to_target_hw_bp_type (type);
|
||||
watch_type = Z_packet_to_target_hw_bp_type (type);
|
||||
irw = mips_linux_watch_type_to_irw (watch_type);
|
||||
if (!mips_linux_watch_try_one_watch (®s, addr, len, irw))
|
||||
return -1;
|
||||
@@ -490,7 +472,7 @@ mips_remove_point (char type, CORE_ADDR addr, int len)
|
||||
}
|
||||
|
||||
/* Search for a known watch that matches. Then unlink and free it. */
|
||||
watch_type = rsp_bp_type_to_target_hw_bp_type (type);
|
||||
watch_type = Z_packet_to_target_hw_bp_type (type);
|
||||
deleted_one = 0;
|
||||
pw = &private->current_watches;
|
||||
while ((w = *pw))
|
||||
|
||||
Reference in New Issue
Block a user