diff mbox

[3/5] ARM: arm_breakpoint should be little endian form in case for arm BE8

Message ID 1413853021-4393-4-git-send-email-victor.kamensky@linaro.org
State New
Headers show

Commit Message

vkamensky Oct. 21, 2014, 12:56 a.m. UTC
tdep->arm_breakpoint, tdep->thumb_breakpoint, tdep->thumb2_breakpoint
should be set le_ variants in case of arm BE8 code. Those instruciton
sequences are writen to target with simple write_memory, without
regarding gdbarch_byte_order_for_code. But in BE8 case even data
memory is in big endian form, instructions are still in little endian
form.

Because of this issue there are many issues while running gdb test
case in armv7b mode. For example gdb.arch/arm-disp-step.exp test fails
because it gets SIGILL when displaced instrucion sequence reaches
break instruction, which is in wrong byte order.

Solution is to set tdep->xxx_breakpoint sequences in BE8 case (i.e
when gdbarch_byte_order_for_code is BFD_ENDIAN_BIG.
---
 gdb/ChangeLog        | 5 +++++
 gdb/arm-linux-tdep.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Yao Qi Oct. 21, 2014, 8:09 a.m. UTC | #1
Victor Kamensky <victor.kamensky@linaro.org> writes:

> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 2aef5dc..c32fb3f 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,10 @@
>  2014-10-13  Victor Kamensky  <victor.kamensky@linaro.org>
>  
> +	* arm-tdep.c: (extract_arm_insn): use dbarch_byte_order_for_code
> +	to read arm instruction.

The file and function name in the changelog entry is wrong.  The
description of each entry is a sentence, so the first letter should be
capitalized.

	* arm-linux-tdep.c (arm_linux_init_abi): Use
	 gdbarch_byte_order_for_code to read arm instruction.

Otherwise, it looks good to me.
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2aef5dc..c32fb3f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@ 
 2014-10-13  Victor Kamensky  <victor.kamensky@linaro.org>
 
+	* arm-tdep.c: (extract_arm_insn): use dbarch_byte_order_for_code
+	to read arm instruction.
+
+2014-10-13  Victor Kamensky  <victor.kamensky@linaro.org>
+
 	* arm-tdep.c (extract_arm_insn): use dbarch_byte_order_for_code
 	to read arm instruction.
 
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index e3587f3..2e79658 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1361,7 +1361,7 @@  arm_linux_init_abi (struct gdbarch_info info,
   linux_init_abi (info, gdbarch);
 
   tdep->lowest_pc = 0x8000;
-  if (info.byte_order == BFD_ENDIAN_BIG)
+  if (info.byte_order_for_code == BFD_ENDIAN_BIG)
     {
       if (tdep->arm_abi == ARM_ABI_AAPCS)
 	tdep->arm_breakpoint = eabi_linux_arm_be_breakpoint;