summaryrefslogtreecommitdiff
path: root/opcodes/avr-dis.c
diff options
context:
space:
mode:
authorDenis Chertykov <chertykov@gmail.com>2016-06-09 19:00:57 +0300
committerDenis Chertykov <chertykov@gmail.com>2016-06-09 19:00:57 +0300
commit1857fe72aff6f254217956d141bff4b9ca454bc5 (patch)
tree85738760d7e2c8810e930388514e7a293482bed2 /opcodes/avr-dis.c
parent337c570c5f4442459d3324c9429ad80840094015 (diff)
downloadbinutils-gdb-1857fe72aff6f254217956d141bff4b9ca454bc5.tar.gz
Print symbol names in comments for LDS/STS disassembly.
This patch adds default data address space origin (0x800000) to the symbol addresses. when disassemble lds/sts instructions. So that symbol names shall be printed in comments for lds/sts instructions disassemble. ld/ * testsuite/ld-avr/lds-mega.d: New test. * testsuite/ld-avr/lds-mega.s: New test source. * testsuite/ld-avr/lds-tiny.d: New test. * testsuite/ld-avr/lds-tiny.s: New test source. opcodes/ * avr-dis.c (avr_operand): Add default data address space origin (0x800000) to the address and set as symbol address for LDS/ STS immediate operands.
Diffstat (limited to 'opcodes/avr-dis.c')
-rw-r--r--opcodes/avr-dis.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c
index 3b783fb8e4f..748cb2dbb6e 100644
--- a/opcodes/avr-dis.c
+++ b/opcodes/avr-dis.c
@@ -184,17 +184,23 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra
break;
case 'i':
- sprintf (buf, "0x%04X", insn2);
+ {
+ unsigned int val = insn2 | 0x800000;
+ *sym = 1;
+ *sym_addr = val;
+ sprintf (buf, "0x%04X", insn2);
+ strcpy (comment, comment_start);
+ }
break;
case 'j':
{
unsigned int val = ((insn & 0xf) | ((insn & 0x600) >> 5)
| ((insn & 0x100) >> 2));
- if (val > 0 && !(insn & 0x100))
- val |= 0x80;
+ *sym = 1;
+ *sym_addr = val | 0x800000;
sprintf (buf, "0x%02x", val);
- sprintf (buf, "%d", val);
+ strcpy (comment, comment_start);
}
break;