]> git.gag.com Git - fw/openocd/commit
target/aarch64: fix soft breakpoint when PE is in AArch32 state
authorTarek BOCHKATI <tarek.bouchkati@gmail.com>
Wed, 4 Dec 2019 14:09:51 +0000 (15:09 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Thu, 12 Mar 2020 09:46:43 +0000 (09:46 +0000)
commita154973896576ae59952785e7b2137fb17dac7da
tree130e47514999e9d69fcdc80789fc119e58f21f9f
parent4845b5437284b964aad40b1cec57324732abb4d5
target/aarch64: fix soft breakpoint when PE is in AArch32 state

Before this patch aarch64_set_breakpoint was using either A64, or A32
HLT opcode by relying on armv8_opcode helper.
This behaviors ignores the fact that in AArch32 state the core could
execute Thumb-2 instructions, and gdb could request to insert a soft
bkpt in a Thumb-2 code chunk.

In this change, we check the core_state and bkpt length to know the
correct opcode to use.

Note: based on https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Breakpoint-Kinds.html
      if bkpt length/kind == 3, we should replace a 32-bit Thumb-2 opcode,
      then we use twice the 16 bits Thumb-2 bkpt opcode and we fix-up the
      length to 4 bytes, in order to set correctly the bpkt.

Change-Id: I8f3551124412c61d155eae87761767e9937f917d
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5355
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/aarch64.c
src/target/armv8_opcodes.h