public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: "Maciej W. Rozycki" <macro@imgtec.com>
Cc: <binutils@sourceware.org>,  <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/6] Delegate opcodes to select disassembler in GDB
Date: Fri, 30 Jun 2017 07:38:00 -0000	[thread overview]
Message-ID: <86efu1diwp.fsf@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1706300107040.31404@tp.orcam.me.uk> (Maciej	W. Rozycki's message of "Fri, 30 Jun 2017 01:18:50 +0100")

"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 (齐尧)

  reply	other threads:[~2017-06-30  7:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 10:49 [PATCH 0/6] Unify the disassembler selection in gdb and objdump Yao Qi
2017-05-16 10:48 ` [PATCH 2/6] Delegate opcodes to select disassembler in GDB Yao Qi
2017-06-30  0:19   ` Maciej W. Rozycki
2017-06-30  7:38     ` Yao Qi [this message]
2017-07-05 23:53       ` Maciej W. Rozycki
2017-07-07 16:41         ` Yao Qi
2017-08-01 16:31           ` Maciej W. Rozycki
2017-05-16 10:48 ` [PATCH 5/6] Use disassble.c:disassembler select rs6000 disassembler Yao Qi
2017-05-16 10:48 ` [PATCH 4/6] Use disassble.c:disassembler select rl78 disassembler Yao Qi
2017-05-16 10:49 ` [PATCH 1/6] Refactor disassembler selection Yao Qi
2017-05-16 10:49 ` [PATCH 3/6] Use disassble.c:disassembler select h8300 disassembler Yao Qi
2017-05-16 10:49 ` [RFC 6/6] Move print_insn_XXX to an opcodes internal header Yao Qi
2017-05-17  3:00 ` [PATCH 0/6] Unify the disassembler selection in gdb and objdump Alan Modra
2017-05-24 16:26   ` Yao Qi
2017-05-23  9:19 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86efu1diwp.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@imgtec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).