Skip to content

Commit

Permalink
arm-dis: Include opcode hex when doing disassembly
Browse files Browse the repository at this point in the history
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 <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
  • Loading branch information
pm215 authored and aurel32 committed Jan 12, 2011
1 parent 5677903 commit 5d48e91
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions arm-dis.c
Expand Up @@ -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)
Expand Down

0 comments on commit 5d48e91

Please sign in to comment.