This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 2/6] Delegate opcodes to select disassembler in GDB
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: "Maciej W. Rozycki" <macro at imgtec dot com>
- Cc: <binutils at sourceware dot org>, <gdb-patches at sourceware dot org>
- Date: Fri, 30 Jun 2017 08:38:46 +0100
- Subject: Re: [PATCH 2/6] Delegate opcodes to select disassembler in GDB
- Authentication-results: sourceware.org; auth=none
- References: <1494931698-15309-1-git-send-email-yao.qi@linaro.org> <1494931698-15309-3-git-send-email-yao.qi@linaro.org> <alpine.DEB.2.00.1706300107040.31404@tp.orcam.me.uk>
"Maciej W. Rozycki" <macro@imgtec.com> writes:
> This change causes an assertion failure when trying to disassemble a
> MIPS16 function:
>
> (gdb) disassemble main
> Dump of assembler code for function main:
> 0x00400209 <+0>:
> .../gdb/arch-utils.c:979: internal-error: int default_print_insn(bfd_vma, disassemble_info*): Assertion `info->mach == bfd_get_mach (exec_bfd)' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n)
Sorry about that. I did deliberately run
testsuite/gdb.base/all-architectures-[0-7].exp tests to cover the case
that using disassembler for each architecture. It covers mips, but it
doesn't cover mips16 and micromips.
>
> This is because `info->mach' is 16 (the `bfd_mach_mips16' aka `mips:16'
> BFD) whereas `bfd_get_mach (exec_bfd)' is 33 (the `bfd_mach_mipsisa32r2'
> aka `mips:isa32r2' BFD). This is expected for MIPS16 code within a
> program that has been built for the MIPS32r2 ISA; see
> `gdb_print_insn_mips' for the origin.
>
> So what's the purpose of this assertion?
The assertion is based on assumption that "info->mach" is got from
bfd_get_mach (exec_bfd), but it is not right for mips16. We can remove
this line. If you agree, I'll post a patch to remove this line.
--
Yao (齐尧)