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]

[RFC] symbol-printing from avr-disasm


Hello,

I'm working on improving the avr disassembler. I'm trying to make it print the symols on jumps, calls and data load/store. The latter has given me some trouble. The problem is that the avr architecture places the data segment in address 0x800000 and above. AVR is a Harvard architeture, thus the data segment is placed in high address to make gas/gcc differentiate between data and code addresses. When the code is run on target, it will be used as normal addresses from 0x0.

If I use (*info->print_address_func)( adr, info ) directly it will print something like this on this target:

00000648 <uart_init>:
648: 10 92 0f 02 sts 0x80020f <rx_ptr_out>, r1
64c: 80 91 0f 02 lds r24, 0x80020f <rx_ptr_out>
650: 80 93 7e 01 sts 0x80017e <rx_ptr_in>, r24
654: 10 92 13 02 sts 0x800213 <tx_ptr_out>, r1
658: 80 91 13 02 lds r24, 0x800213 <tx_ptr_out>
65c: 80 93 15 02 sts 0x800215 <tx_ptr_in>, r24

Now, my problem is that I want to print *only* the last 16-bits of the address, not the "80" prefix. (However, I need the full address to make print_address_func work). From my view there are two fixes to this:

Either make a new (global) function which could print the symbol without the address part, or print the symbol without the address prefix (forcing myself to print the literal address fist). Either way, it requires global modifications to objdump.c and dis-asm.h.

Or, I could make a phony info structure in the avr-dis.c which and emulate the fprintf_func. It will place the data from the print_address_func into a temporary buffer. When the function returns, I will scan this buffer, modify it by removing the prefix, and then manually print it using the real fprintf_func. (I really feel that this would be a *hack*).

Which one is better? Does anyone else have any other ideas?


Svein


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