]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR binutils/4045
authorNick Clifton <nickc@redhat.com>
Fri, 16 Feb 2007 10:24:48 +0000 (10:24 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 16 Feb 2007 10:24:48 +0000 (10:24 +0000)
* avr-dis.c (comment_start): New variable, contains the prefix to use when
    printing addresses in comments.
  (print_insn_avr): Set comment_start to an empty space if there is no symbol
     table available as the generic address printing code will prefix the
     numeric value of the address with 0x.

opcodes/ChangeLog
opcodes/avr-dis.c

index 1164417479062f7a3fb329e540f0dbb08d341007..72609eff895f4ce79e8cd05faaa2925e68fb61d8 100644 (file)
@@ -1,3 +1,12 @@
+2007-02-16  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/4045
+       * avr-dis.c (comment_start): New variable, contains the prefix to
+       use when printing addresses in comments.
+       (print_insn_avr): Set comment_start to an empty space if there is
+       no symbol table available as the generic address printing code
+       will prefix the numeric value of the address with 0x.
+
 2007-02-13  H.J. Lu  <hongjiu.lu@intel.com>
 
         * i386-dis.c: Updated to use an array of MAX_OPERANDS operands
index 0a2bd361444e0b52b303663cbb506dc27051ba24..aea807e9255d630346574492bfa219db40cc98d0 100644 (file)
@@ -43,6 +43,8 @@ const struct avr_opcodes_s avr_opcodes[] =
   {NULL, NULL, NULL, 0, 0, 0}
 };
 
+static const char * comment_start = "0x";
+
 static int
 avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constraint,
              char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr)
@@ -144,8 +146,7 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra
         value of the address only once, but this would mean recoding
         objdump_print_address() which would affect many targets.  */
       sprintf (buf, "%#lx", (unsigned long) *sym_addr);      
-      sprintf (comment, "0x");
-
+      sprintf (comment, comment_start);
       break;
       
     case 'L':
@@ -154,17 +155,18 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra
        sprintf (buf, ".%+-8d", rel_addr);
         *sym = 1;
         *sym_addr = pc + 2 + rel_addr;
-       sprintf (comment, "0x");
+       sprintf (comment, comment_start);
       }
       break;
 
     case 'l':
       {
        int rel_addr = ((((insn >> 3) & 0x7f) ^ 0x40) - 0x40) * 2;
+
        sprintf (buf, ".%+-8d", rel_addr);
         *sym = 1;
         *sym_addr = pc + 2 + rel_addr;
-       sprintf (comment, "0x");
+       sprintf (comment, comment_start);
       }
       break;
 
@@ -267,10 +269,17 @@ print_insn_avr (bfd_vma addr, disassemble_info *info)
   int sym_op1 = 0, sym_op2 = 0;
   bfd_vma sym_addr1, sym_addr2;
 
+
   if (!initialized)
     {
       unsigned int nopcodes;
 
+      /* PR 4045: Try to avoid duplicating the 0x prefix that
+        objdump_print_addr() will put on addresses when there
+        is no symbol table available.  */
+      if (info->symtab_size == 0)
+       comment_start = " ";
+
       nopcodes = sizeof (avr_opcodes) / sizeof (struct avr_opcodes_s);
       
       avr_bin_masks = xmalloc (nopcodes * sizeof (unsigned int));