From: Yao Qi <qiyaoltc@gmail.com>
To: "Maciej W. Rozycki" <macro@imgtec.com>
Cc: <binutils@sourceware.org>, <gdb-patches@sourceware.org>,
Alan Modra <amodra@gmail.com>
Subject: Re: [PATCH] GDB/opcodes: Remove arch/mach/endian disassembler assertions
Date: Thu, 03 Aug 2017 11:04:00 -0000 [thread overview]
Message-ID: <86pocc3oam.fsf@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1708010044560.29991@tp.orcam.me.uk> (Maciej W. Rozycki's message of "Tue, 1 Aug 2017 17:39:33 +0100")
"Maciej W. Rozycki" <macro@imgtec.com> writes:
Hi Maciej,
> @@ -971,13 +971,6 @@ default_print_insn (bfd_vma memaddr, dis
> {
> disassembler_ftype disassemble_fn;
>
> - if (exec_bfd != NULL)
> - {
> - gdb_assert (info->arch == bfd_get_arch (exec_bfd));
> - gdb_assert (info->endian == (bfd_big_endian (exec_bfd)
> - ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE));
> - gdb_assert (info->mach == bfd_get_mach (exec_bfd));
> - }
> disassemble_fn = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG,
> info->mach, exec_bfd);
I prefer to keep these asserts, as they could check the inconsistent
uses of disassemble_info between gdb and opcodes. There is another
assert for target armv5te, PR 21818, but the assert exposes an improper
or unexpected usage of disassemble_info.mach in opcodes/arm-dis.c. I am
fixing it.
If these asserts make few sense to mips, gdb_print_insn_mips doesn't
have to call default_print_insn. You can just do this at the end of
gdb_print_insn_mips,
--
Yao (齐尧)
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c1800e4..8ab7886 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -7025,7 +7025,13 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info)
register naming conventions specified by the user. */
info->disassembler_options = "gpr-names=32";
- return default_print_insn (memaddr, info);
+ disassembler_ftype disassemble_fn;
+
+ disassemble_fn = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG,
+ info->mach, exec_bfd);
+
+ gdb_assert (disassemble_fn != NULL);
+ return (*disassemble_fn) (memaddr, info);
}
static int
next prev parent reply other threads:[~2017-08-03 11:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 16:39 Maciej W. Rozycki
2017-08-03 11:04 ` Yao Qi [this message]
2017-08-03 11:36 ` Maciej W. Rozycki
2017-08-03 12:25 ` Maciej W. Rozycki
2017-08-04 10:49 ` Yao Qi
2017-08-07 13:24 ` Alan Modra
2017-08-07 14:56 ` Maciej W. Rozycki
2017-08-07 15:05 ` H.J. Lu
2017-08-07 15:15 ` Maciej W. Rozycki
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=86pocc3oam.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=amodra@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