diff options
author | Yao Qi <yao.qi@linaro.org> | 2015-12-07 15:56:31 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-12-07 15:56:31 +0000 |
commit | 17b1509aac6ff4205749c2626fddbb1c4d7255f4 (patch) | |
tree | 9617dfc9ff8efb576b31693ed29107bcecc52228 /gdb/gdbserver/linux-aarch64-low.c | |
parent | 6056244624a21a569985e33b30f43f44c8da482e (diff) | |
download | gdb-17b1509aac6ff4205749c2626fddbb1c4d7255f4.zip gdb-17b1509aac6ff4205749c2626fddbb1c4d7255f4.tar.gz gdb-17b1509aac6ff4205749c2626fddbb1c4d7255f4.tar.bz2 |
Support Z0 packet in AArch64 multi-arch debugging
In commit 6085d6f6, Z0 packet is disabled in aarch64 GDBserver if
the inferior is 32-bit or there may be multiple inferiors, because
Z0 packet isn't supported for arm then. Recently, Z0 packet
is supported in arm target, so we don't have such limitation in
aarch64 GDBserver, that is to say, aarch64 GDBserver can use Z0
packet in multi-arch/multi-inferior debugging when the inferior's
arch is arm.
Part of this patch is to revert 6085d6f6, and the rest of the patch
is to move some breakpoint related arm_* functions into
linux-aarch32-low.c in order to share them between arm and aarch64.
This patch is regression tested on aarch64-linux for debugging both
aarch64 programs and arm programs respectively.
gdb/gdbserver:
2015-12-07 Yao Qi <yao.qi@linaro.org>
* configure.srv: Append arm.o to srv_tgtobj for
aarch64*-*-linux* target.
* linux-aarch32-low.c (arm_abi_breakpoint): New macro. Moved
from linux-arm-low.c.
(arm_eabi_breakpoint, arm_breakpoint): Likewise.
(arm_breakpoint_len, thumb_breakpoint): Likewise.
(thumb_breakpoint_len, thumb2_breakpoint): Likewise.
(thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode, arm_breakpoint_at): Likewise.
(arm_breakpoint_kinds): Likewise.
(arm_breakpoint_kind_from_pc): Likewise.
(arm_sw_breakpoint_from_kind): Likewise.
(arm_breakpoint_kind_from_current_state): Likewise.
* linux-aarch32-low.h (arm_breakpoint_kind_from_pc): Declare.
(arm_sw_breakpoint_from_kind): Declare.
(arm_breakpoint_kind_from_current_state): Declare.
(arm_breakpoint_at): Declare.
* linux-aarch64-low.c (aarch64_sw_breakpoint_from_kind): Call
arm_sw_breakpoint_from_kind if process is 32-bit.
(aarch64_breakpoint_kind_from_pc): New function.
(aarch64_breakpoint_kind_from_current_state): New function.
(the_low_target): Initialize fields breakpoint_kind_from_pc
and breakpoint_kind_from_current_state.
* linux-arm-low.c (arm_breakpoint_kinds): Move to
linux-aarch32-low.c.
(arm_abi_breakpoint, arm_eabi_breakpoint): Likewise.
(arm_breakpoint, arm_breakpoint_len): Likewise.
(thumb_breakpoint, thumb_breakpoint_len): Likewise.
(thumb2_breakpoint, thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode): Likewise.
(arm_breakpoint_at): Likewise.
(arm_breakpoint_kind_from_pc): Likewise.
(arm_sw_breakpoint_from_kind): Likewise.
(arm_breakpoint_kind_from_current_state): Likewise.
Revert:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_supports_z_point_type): Return
0 for Z_PACKET_SW_BP if it may be used in multi-arch debugging.
* server.c (extended_protocol): Remove "static".
* server.h (extended_protocol): Declare it.
Diffstat (limited to 'gdb/gdbserver/linux-aarch64-low.c')
-rw-r--r-- | gdb/gdbserver/linux-aarch64-low.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 17798ff..5fd3f51 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -260,22 +260,6 @@ aarch64_supports_z_point_type (char z_type) switch (z_type) { case Z_PACKET_SW_BP: - { - if (!extended_protocol && is_64bit_tdesc ()) - { - /* Only enable Z0 packet in non-multi-arch debugging. If - extended protocol is used, don't enable Z0 packet because - GDBserver may attach to 32-bit process. */ - return 1; - } - else - { - /* Disable Z0 packet so that GDBserver doesn't have to handle - different breakpoint instructions (aarch64, arm, thumb etc) - in multi-arch debugging. */ - return 0; - } - } case Z_PACKET_HW_BP: case Z_PACKET_WRITE_WP: case Z_PACKET_READ_WP: @@ -2940,8 +2924,36 @@ aarch64_supports_range_stepping (void) static const gdb_byte * aarch64_sw_breakpoint_from_kind (int kind, int *size) { - *size = aarch64_breakpoint_len; - return aarch64_breakpoint; + if (is_64bit_tdesc ()) + { + *size = aarch64_breakpoint_len; + return aarch64_breakpoint; + } + else + return arm_sw_breakpoint_from_kind (kind, size); +} + +/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */ + +static int +aarch64_breakpoint_kind_from_pc (CORE_ADDR *pcptr) +{ + if (is_64bit_tdesc ()) + return aarch64_breakpoint_len; + else + return arm_breakpoint_kind_from_pc (pcptr); +} + +/* Implementation of the linux_target_ops method + "breakpoint_kind_from_current_state". */ + +static int +aarch64_breakpoint_kind_from_current_state (CORE_ADDR *pcptr) +{ + if (is_64bit_tdesc ()) + return aarch64_breakpoint_len; + else + return arm_breakpoint_kind_from_current_state (pcptr); } /* Support for hardware single step. */ @@ -2961,7 +2973,7 @@ struct linux_target_ops the_low_target = NULL, /* fetch_register */ aarch64_get_pc, aarch64_set_pc, - NULL, /* breakpoint_kind_from_pc */ + aarch64_breakpoint_kind_from_pc, aarch64_sw_breakpoint_from_kind, NULL, /* breakpoint_reinsert_addr */ 0, /* decr_pc_after_break */ @@ -2985,7 +2997,7 @@ struct linux_target_ops the_low_target = aarch64_emit_ops, aarch64_get_min_fast_tracepoint_insn_len, aarch64_supports_range_stepping, - NULL, /* breakpoint_kind_from_current_state */ + aarch64_breakpoint_kind_from_current_state, aarch64_supports_hardware_single_step, }; |