From patchwork Mon Jan 10 16:16:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 78168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 00108B7131 for ; Tue, 11 Jan 2011 03:26:07 +1100 (EST) Received: from localhost ([127.0.0.1]:42900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcKXu-0002uN-Ux for incoming@patchwork.ozlabs.org; Mon, 10 Jan 2011 11:24:38 -0500 Received: from [140.186.70.92] (port=48176 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcKX2-0002oo-MU for qemu-devel@nongnu.org; Mon, 10 Jan 2011 11:23:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PcKQ1-00076H-6Q for qemu-devel@nongnu.org; Mon, 10 Jan 2011 11:16:30 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:48131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PcKQ0-00075r-Vo for qemu-devel@nongnu.org; Mon, 10 Jan 2011 11:16:29 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1PcKPy-0003GJ-Qm; Mon, 10 Jan 2011 16:16:26 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 10 Jan 2011 16:16:26 +0000 Message-Id: <1294676186-12518-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: riku voipio Subject: [Qemu-devel] [PATCH] arm-dis: Include opcode hex when doing disassembly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Enhance the ARM disassembler used for debugging so that it includes the hex dump of the opcode as well as the symbolic disassembly. Signed-off-by: Peter Maydell --- This is based on meego-qemu commit e548a60c with a change suggested last time that patch was sent to qemu-devel: http://www.mail-archive.com/qemu-devel@nongnu.org/msg28258.html http://www.mail-archive.com/qemu-devel@nongnu.org/msg29235.html I have used GNU-style indent conventions in this change because the rest of this file consistently does so (being from libopcode originally). arm-dis.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/arm-dis.c b/arm-dis.c index af21739..3ece02c 100644 --- a/arm-dis.c +++ b/arm-dis.c @@ -4101,6 +4101,30 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info) addresses, since the addend is not currently pc-relative. */ pc = 0; + /* We include the hexdump of the instruction. The format here + matches that used by objdump and the ARM ARM (in particular, + 32 bit Thumb instructions are displayed as pairs of halfwords, + not as a single word.) */ + if (is_thumb) + { + if (size == 2) + { + info->fprintf_func(info->stream, "%04lx ", + ((unsigned long)given) & 0xffff); + } + else + { + info->fprintf_func(info->stream, "%04lx %04lx ", + (((unsigned long)given) >> 16) & 0xffff, + ((unsigned long)given) & 0xffff); + } + } + else + { + info->fprintf_func(info->stream, "%08lx ", + ((unsigned long)given) & 0xffffffff); + } + printer (pc, info, given); if (is_thumb)