]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[ARM] Mark USER_SPECIFIED_MACHINE_TYPE in disassemble_info.flags
authorYao Qi <yao.qi@linaro.org>
Fri, 18 Aug 2017 08:30:12 +0000 (09:30 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 18 Aug 2017 08:30:12 +0000 (09:30 +0100)
opcodes/arm-dis.c:print_insn may update disassemble_info.mach to
bfd_mach_arm_unknown unless USER_SPECIFIED_MACHINE_TYPE is marked.
When default_print_insn is called for the first time,
disassemble_info.mach is correctly set in GDB, but arm-dis.c:print_insn
sets it to bfd_mach_arm_unknown.  Then, when default_print_insn is
called again (in a loop), it triggers the assert.

The patch fixes the assert by marking USER_SPECIFIED_MACHINE_TYPE so that
opcodes won't reset disassemble_info.mach.

gdb:

2017-08-18  Yao Qi  <yao.qi@linaro.org>

PR tdep/21818
* arm-tdep.c (gdb_print_insn_arm): Mark
USER_SPECIFIED_MACHINE_TYPE if exec_bfd isn't NULL.

gdb/ChangeLog
gdb/arm-tdep.c

index 2581935a98c8f7505b56f74cbbaf80c92d831e6b..592909190fee9a3648cd68b485db5322875a9d1c 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-18  Yao Qi  <yao.qi@linaro.org>
+
+       PR tdep/21818
+       * arm-tdep.c (gdb_print_insn_arm): Mark
+       USER_SPECIFIED_MACHINE_TYPE if exec_bfd isn't NULL.
+
 2017-08-18  Yao Qi  <yao.qi@linaro.org>
 
        * NEWS: Mention GDBserver's new option "--selftest".
index a1075847d685c57e49439b4233f3f40726d776c4..0c1a0b3294ac39818fd1d95dbafda1acc1f4a398 100644 (file)
@@ -7773,6 +7773,14 @@ gdb_print_insn_arm (bfd_vma memaddr, disassemble_info *info)
   else
     info->symbols = NULL;
 
+  /* GDB is able to get bfd_mach from the exe_bfd, info->mach is
+     accurate, so mark USER_SPECIFIED_MACHINE_TYPE bit.  Otherwise,
+     opcodes/arm-dis.c:print_insn reset info->mach, and it will trigger
+     the assert on the mismatch of info->mach and bfd_get_mach (exec_bfd)
+     in default_print_insn.  */
+  if (exec_bfd != NULL)
+    info->flags |= USER_SPECIFIED_MACHINE_TYPE;
+
   return default_print_insn (memaddr, info);
 }