opcodes: xtensa: display loaded literal value
authorMax Filippov <jcmvbkbc@gmail.com>
Fri, 23 Apr 2021 09:03:36 +0000 (02:03 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Fri, 23 Apr 2021 10:29:39 +0000 (03:29 -0700)
Display literal value loaded with l32r opcode as a part of disassembly.
This significantly simplifies reading of disassembly output.

2020-04-23  Max Filippov  <jcmvbkbc@gmail.com>
opcodes/
* xtensa-dis.c (print_xtensa_operand): For PC-relative operand
of l32r fetch and display referenced literal value.

opcodes/ChangeLog
opcodes/xtensa-dis.c

index c26cddffd605a554574c74d7ad122450a75e1ca0..bf495d02a07de4eca04fb1f979a874ec4ecde428 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-23  Max Filippov  <jcmvbkbc@gmail.com>
+
+       * xtensa-dis.c (print_xtensa_operand): For PC-relative operand
+       of l32r fetch and display referenced literal value.
+
 2021-04-23  Max Filippov  <jcmvbkbc@gmail.com>
 
        * xtensa-dis.c (print_insn_xtensa): Set info->bytes_per_chunk
index e38fc39f4e7ef5496c0f1dc737582b0f1ca0cabc..cfa058f96c711dbbe65bbc315512c96bf75391c1 100644 (file)
@@ -194,7 +194,8 @@ print_xtensa_operand (bfd_vma memaddr,
                      unsigned operand_val)
 {
   xtensa_isa isa = xtensa_default_isa;
-  int signed_operand_val;
+  int signed_operand_val, status;
+  bfd_byte litbuf[4];
 
   if (show_raw_fields)
     {
@@ -216,6 +217,23 @@ print_xtensa_operand (bfd_vma memaddr,
                                            &operand_val, memaddr);
          info->target = operand_val;
          (*info->print_address_func) (info->target, info);
+         /*  Also display value loaded by L32R (but not if reloc exists,
+             those tend to be wrong):  */
+         if ((info->flags & INSN_HAS_RELOC) == 0
+             && !strcmp ("l32r", xtensa_opcode_name (isa, opc)))
+           status = (*info->read_memory_func) (operand_val, litbuf, 4, info);
+         else
+           status = -1;
+
+         if (status == 0)
+           {
+             unsigned literal = bfd_get_bits (litbuf, 32,
+                                              info->endian == BFD_ENDIAN_BIG);
+
+             (*info->fprintf_func) (info->stream, " (");
+             (*info->print_address_func) (literal, info);
+             (*info->fprintf_func) (info->stream, ")");
+           }
        }
       else
        {
This page took 0.025021 seconds and 4 git commands to generate.