Added printing of symbols on AVR disasm
This commit is contained in:
parent
1fb249302e
commit
246f4c05fd
2 changed files with 30 additions and 17 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-12-14 Svein E. Seldal <Svein.Seldal@solidas.com>
|
||||||
|
|
||||||
|
* avr-dis.c: Prettyprint. Added printing of symbol names in all
|
||||||
|
memory references. Convert avr_operand() to C90 formatting.
|
||||||
|
|
||||||
2004-12-05 Tomer Levi <Tomer.Levi@nsc.com>
|
2004-12-05 Tomer Levi <Tomer.Levi@nsc.com>
|
||||||
|
|
||||||
* crx-dis.c (print_arg): Use 'info->print_address_func' for address printing.
|
* crx-dis.c (print_arg): Use 'info->print_address_func' for address printing.
|
||||||
|
|
|
@ -42,20 +42,15 @@ const struct avr_opcodes_s avr_opcodes[] =
|
||||||
{NULL, NULL, NULL, 0, 0, 0}
|
{NULL, NULL, NULL, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int avr_operand PARAMS ((unsigned int, unsigned int,
|
static int avr_operand (unsigned int, unsigned int, unsigned int, int,
|
||||||
unsigned int, int, char *, char *, int));
|
char *, char *, int, int *, bfd_vma *);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
avr_operand (insn, insn2, pc, constraint, buf, comment, regs)
|
avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constraint,
|
||||||
unsigned int insn;
|
char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr)
|
||||||
unsigned int insn2;
|
|
||||||
unsigned int pc;
|
|
||||||
int constraint;
|
|
||||||
char *buf;
|
|
||||||
char *comment;
|
|
||||||
int regs;
|
|
||||||
{
|
{
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
|
*sym = 0;
|
||||||
|
|
||||||
switch (constraint)
|
switch (constraint)
|
||||||
{
|
{
|
||||||
|
@ -145,15 +140,18 @@ avr_operand (insn, insn2, pc, constraint, buf, comment, regs)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
sprintf (buf, "0x%x",
|
*sym = 1;
|
||||||
((((insn & 1) | ((insn & 0x1f0) >> 3)) << 16) | insn2) * 2);
|
*sym_addr = ((((insn & 1) | ((insn & 0x1f0) >> 3)) << 16) | insn2) * 2;
|
||||||
|
sprintf (buf, "0x");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
{
|
{
|
||||||
int rel_addr = (((insn & 0xfff) ^ 0x800) - 0x800) * 2;
|
int rel_addr = (((insn & 0xfff) ^ 0x800) - 0x800) * 2;
|
||||||
sprintf (buf, ".%+-8d", rel_addr);
|
sprintf (buf, ".%+-8d", rel_addr);
|
||||||
sprintf (comment, "0x%x", pc + 2 + rel_addr);
|
*sym = 1;
|
||||||
|
*sym_addr = pc + 2 + rel_addr;
|
||||||
|
sprintf (comment, "0x");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -161,7 +159,9 @@ avr_operand (insn, insn2, pc, constraint, buf, comment, regs)
|
||||||
{
|
{
|
||||||
int rel_addr = ((((insn >> 3) & 0x7f) ^ 0x40) - 0x40) * 2;
|
int rel_addr = ((((insn >> 3) & 0x7f) ^ 0x40) - 0x40) * 2;
|
||||||
sprintf (buf, ".%+-8d", rel_addr);
|
sprintf (buf, ".%+-8d", rel_addr);
|
||||||
sprintf (comment, "0x%x", pc + 2 + rel_addr);
|
*sym = 1;
|
||||||
|
*sym_addr = pc + 2 + rel_addr;
|
||||||
|
sprintf (comment, "0x");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -265,6 +265,8 @@ print_insn_avr(addr, info)
|
||||||
int cmd_len = 2;
|
int cmd_len = 2;
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
char op1[20], op2[20], comment1[40], comment2[40];
|
char op1[20], op2[20], comment1[40], comment2[40];
|
||||||
|
int sym_op1 = 0, sym_op2 = 0;
|
||||||
|
bfd_vma sym_addr1, sym_addr2;
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
|
@ -336,11 +338,11 @@ print_insn_avr(addr, info)
|
||||||
{
|
{
|
||||||
int regs = REGISTER_P (*op);
|
int regs = REGISTER_P (*op);
|
||||||
|
|
||||||
ok = avr_operand (insn, insn2, addr, *op, op1, comment1, 0);
|
ok = avr_operand (insn, insn2, addr, *op, op1, comment1, 0, &sym_op1, &sym_addr1);
|
||||||
|
|
||||||
if (ok && *(++op) == ',')
|
if (ok && *(++op) == ',')
|
||||||
ok = avr_operand (insn, insn2, addr, *(++op), op2,
|
ok = avr_operand (insn, insn2, addr, *(++op), op2,
|
||||||
*comment1 ? comment2 : comment1, regs);
|
*comment1 ? comment2 : comment1, regs, &sym_op2, &sym_addr2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +358,7 @@ print_insn_avr(addr, info)
|
||||||
(*prin) (stream, "%s", ok ? opcode->name : ".word");
|
(*prin) (stream, "%s", ok ? opcode->name : ".word");
|
||||||
|
|
||||||
if (*op1)
|
if (*op1)
|
||||||
(*prin) (stream, "\t%s", op1);
|
(*prin) (stream, "\t%s", op1);
|
||||||
|
|
||||||
if (*op2)
|
if (*op2)
|
||||||
(*prin) (stream, ", %s", op2);
|
(*prin) (stream, ", %s", op2);
|
||||||
|
@ -364,8 +366,14 @@ print_insn_avr(addr, info)
|
||||||
if (*comment1)
|
if (*comment1)
|
||||||
(*prin) (stream, "\t; %s", comment1);
|
(*prin) (stream, "\t; %s", comment1);
|
||||||
|
|
||||||
|
if (sym_op1)
|
||||||
|
info->print_address_func(sym_addr1, info);
|
||||||
|
|
||||||
if (*comment2)
|
if (*comment2)
|
||||||
(*prin) (stream, " %s", comment2);
|
(*prin) (stream, " %s", comment2);
|
||||||
|
|
||||||
|
if (sym_op2)
|
||||||
|
info->print_address_func(sym_addr2, info);
|
||||||
|
|
||||||
return cmd_len;
|
return cmd_len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue