aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-09-29 10:14:52 -0600
committerTom Tromey <tromey@adacore.com>2021-10-29 07:23:38 -0600
commit9e6978753df24726a73667b293ac7f0cc94a2fcb (patch)
tree0c2979ffc3f7301481a1bf6b71b8c2cb95656b92 /gdb
parentb88e456f7e3e6d8c354da57d3e77a98575070ee8 (diff)
downloadgdb-9e6978753df24726a73667b293ac7f0cc94a2fcb.zip
gdb-9e6978753df24726a73667b293ac7f0cc94a2fcb.tar.gz
gdb-9e6978753df24726a73667b293ac7f0cc94a2fcb.tar.bz2
Avoid self-test failures on x86-linux
The disassembly tests in "maint selftest" will fail on x86-linux. This happens because opcodes rejects an attempt to disassemble for an arch with a 64-bit address size when bfd_vma is 32-bit. This patch avoids this problem by avoiding the test in this case. I chose to do it this way because this seems to be the only situation where opcodes checks the size of bfd_vma. For v2 of this patch, I've also updated memory_error_test to do the same thing. This is needed due to the "improve error reporting from the disassembler" patch.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/disasm-selftests.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index 0a383d6..59c09c9 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -85,8 +85,19 @@ print_one_insn_test (struct gdbarch *gdbarch)
/* PR 21003 */
if (gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_arc_arc601)
return;
+ goto generic_case;
+ case bfd_arch_i386:
+ {
+ const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch);
+ /* The disassembly tests will fail on x86-linux because
+ opcodes rejects an attempt to disassemble for an arch with
+ a 64-bit address size when bfd_vma is 32-bit. */
+ if (info->bits_per_address > sizeof (bfd_vma) * CHAR_BIT)
+ return;
+ }
/* fall through */
default:
+ generic_case:
{
/* Test disassemble breakpoint instruction. */
CORE_ADDR pc = 0;
@@ -187,6 +198,16 @@ memory_error_test (struct gdbarch *gdbarch)
}
};
+ if (gdbarch_bfd_arch_info (gdbarch)->arch == bfd_arch_i386)
+ {
+ const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch);
+ /* This test will fail on x86-linux because opcodes rejects an
+ attempt to disassemble for an arch with a 64-bit address size
+ when bfd_vma is 32-bit. */
+ if (info->bits_per_address > sizeof (bfd_vma) * CHAR_BIT)
+ return;
+ }
+
gdb_disassembler_test di (gdbarch);
bool saw_memory_error = false;