X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fdisasm-selftests.c;h=a8943fb3d3a07efe3a718ff28439b5e164321bf3;hb=cb1a6dda0d7b14034f647fbc48a7d6a2d212db7f;hp=0a383d6b79590522514700e32430e9e7392107a3;hpb=479209dd4ff90c0bc66d80ebdcb1f21ea8fbb62d;p=binutils-gdb.git diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c index 0a383d6b795..a8943fb3d3a 100644 --- a/gdb/disasm-selftests.c +++ b/gdb/disasm-selftests.c @@ -1,6 +1,6 @@ /* Self tests for disassembler for GDB, the GNU debugger. - Copyright (C) 2017-2021 Free Software Foundation, Inc. + Copyright (C) 2017-2022 Free Software Foundation, Inc. This file is part of GDB. @@ -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;