This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
patch proposal: fixing hex/decimal inconsistencies in arm disassembler
- To: binutils at sourceware dot cygnus dot com
- Subject: patch proposal: fixing hex/decimal inconsistencies in arm disassembler
- From: Thomas de Lellis <tdel at windriver dot com>
- Date: Fri, 28 Apr 2000 19:29:35 -0700
Hi,
Arm disassembler sometimes shows #<hex val without preceeding 0x> but
most of the time shows #<decimal>
See Attachment.
Tom
Patch proposal to make arm disassembly a bit more consistent.
Some routines in the arm disassembler disassemble some values
following #'s as hex, while other parts of the disassembler
show those vales as decimal.
Offending parts of the disassembler were changed to show values
following #'s as decimal instead of hex.
=======================================================================
2000-03-28 Thomas de Lellis <tdel@windriver.com>
* arm-dis.c: (print_insn_arm): Changed output
from hex to decimal. Makes #<val> output consistently
show #<dec val> instead of a hex val which, by the way, was not
preceeded by "0x".
=======================================================================
*** arm-dis.c.org Fri Apr 28 18:52:40 2000
--- arm-dis.c Fri Apr 28 18:53:02 2000
*************** print_insn_arm (pc, info, given)
*** 198,204 ****
offset = - offset;
/* pre-indexed */
! func (stream, ", #%x]", offset);
offset += pc + 8;
--- 198,204 ----
offset = - offset;
/* pre-indexed */
! func (stream, ", #%d]", offset);
offset += pc + 8;
*************** print_insn_arm (pc, info, given)
*** 212,218 ****
else
{
/* Post indexed. */
! func (stream, "], #%x", offset);
offset = pc + 8; /* ie ignore the offset. */
}
--- 212,218 ----
else
{
/* Post indexed. */
! func (stream, "], #%d", offset);
offset = pc + 8; /* ie ignore the offset. */
}
*************** print_insn_arm (pc, info, given)
*** 277,283 ****
if ((given & 0x00800000) == 0)
offset = -offset;
! func (stream, "[pc, #%x]\t; ", offset);
(*info->print_address_func)
(offset + pc + 8, info);
--- 277,283 ----
if ((given & 0x00800000) == 0)
offset = -offset;
! func (stream, "[pc, #%d]\t; ", offset);
(*info->print_address_func)
(offset + pc + 8, info);
TESTCASE ==============================================================
> cat a.s
.text
ldr r0,[pc,#9]
ldr r0,[pc,#0xa]
ldr r0,[pc,#10]
add r0,r0,#9
add r0,r0,#0xa
add r0,r0,#10
FAIL ==================================================================
> asarm -o a.o a.s
> objdumparm -d a.o
x.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <.text>:
0: e59f0009 ldr r0, [pc, #9] ; 0x11
4: e59f000a ldr r0, [pc, #a] ; 0x16 <<<< #<hex>
8: e59f000a ldr r0, [pc, #a] ; 0x1a
c: e2800009 add r0, r0, #9 ; 0x9
10: e280000a add r0, r0, #10 ; 0xa <<<< # <dec>
14: e280000a add r0, r0, #10 ; 0xa
PASS ==================================================================
> asarm -o a.o a.s
> objdumparm -d a.o
x.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <.text>:
0: e59f0009 ldr r0, [pc, #9] ; 0x11
4: e59f000a ldr r0, [pc, #10] ; 0x16
8: e59f000a ldr r0, [pc, #10] ; 0x1a
c: e2800009 add r0, r0, #9 ; 0x9
10: e280000a add r0, r0, #10 ; 0xa
14: e280000a add r0, r0, #10 ; 0xa