This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: objdump -D option gives different numbers in different bases


Hello Thiemo


> It's hardcoded in opcodes/mips-dis.c. Unsigned immediates are in hex,
> signed immediates are in dec. Other numbers are in hex, with the
> exception of mtc*/mfc* fields and performance counter registers.

I am seeing more decimal used that this, signed is best in decimal, but 
there are other opcodes using decimal:

ldr 
t7,10104(t2)
daddiu 
s3,t2,30004
ldr 
a2,8302(s2)
jalx 
0xb1c004d0

ldr 
t5,26477(t2)
addi 
s4,v1,23261
sltiu 
v0,s2,23233
nop
daddi 
zero,t8,20338
daddi 
s1,t2,27015
ldr 
v0,25996(v2)
ldr 
t4,8223(k0)
daddi 
zero,s2,24956
sltiu 
t4,s1,8303


above some unsigned values are comming out in decimal.

> Maybe we should generally standardize on hex output.

I think for the majority of the opcodes hex is best IMO, but this could 
be controled by options if people need to force to hex,dec or oct.

> This is output from an older toolchain which gets the register names
> wrong (it's either k0 or $26).

Yes, its an older toolchain, k0 is r26, what do you mean is wrong? the $?

>>relative addressing from $k0 could be controled, and also the code that 
>>decided the li instruction and the ori instruction.
>>
>>if there was a --use-base-dec and --use-base-hex (default) that would be 
>>very useful I think.
>>
> 
> Why do you thinks it's useful? It looks to be a nice-to-have thing.

When reading through dissassembled code the li macro comes out as 2 
opcodes, and sometimes the addui is in decimal so i have to convert it 
to hex to add it onto the 0x8000 that was in the lui opcode. addiu seems 
to be the worst for this eg:


lui     k0,0xbfc0
addiu   k0,k0,1004
jalr    k1,k0

lui     v1,0xbfc0
ori     v1,v1,0xf500  <- this is ok

please CC me in any replys

JG



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]