Add support for DW_OP_GNU_variable_value to readelf
authorKevin Buettner <kevinb@redhat.com>
Mon, 30 Jul 2018 22:35:45 +0000 (15:35 -0700)
committerKevin Buettner <kevinb@redhat.com>
Wed, 8 Aug 2018 15:10:36 +0000 (08:10 -0700)
As indicated by the subject, this patch adds support for the DWARF
expression opcode DW_OP_GNU_variable_value to readelf.

It's pretty much a copy/paste of DW_OP_call_ref with the obvious name
changes for the printf statements.  The FIXME comment comes from that
copy/paste.

binutils/ChangeLog:

* dwarf.c (decode_location_expresion): Add case for
DW_OP_GNU_variable_value.

binutils/ChangeLog
binutils/dwarf.c

index 9fce7b672136d54153878556ed873fb090b0defd..6ed758b9b778218462d22f1f3c662c99dcb1953b 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-08  Kevin Buettner  <kevinb@redhat.com>
+
+       * dwarf.c (decode_location_expresion): Add case for
+       DW_OP_GNU_variable_value.
+
 2018-08-06  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * readelf.c (display_arc_attribute): Print Tag_ARC_ATR_version.
index 81060bfa462a2f53bed78566660e6db1c2418101..ad961b8c9d0758704f05023f3a73f441b43fd3c4 100644 (file)
@@ -1575,6 +1575,25 @@ decode_location_expression (unsigned char * data,
          data += bytes_read;
          printf ("DW_OP_GNU_const_index <0x%s>", dwarf_vmatoa ("x", uvalue));
          break;
+       case DW_OP_GNU_variable_value:
+         /* FIXME: Strictly speaking for 64-bit DWARF3 files
+            this ought to be an 8-byte wide computation.  */
+         if (dwarf_version == -1)
+           {
+             printf (_("(DW_OP_GNU_variable_value in frame info)"));
+             /* No way to tell where the next op is, so just bail.  */
+             return need_frame_base;
+           }
+         if (dwarf_version == 2)
+           {
+             SAFE_BYTE_GET_AND_INC (uvalue, data, pointer_size, end);
+           }
+         else
+           {
+             SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
+           }
+         printf ("DW_OP_GNU_variable_value: <0x%s>", dwarf_vmatoa ("x", uvalue));
+         break;
 
          /* HP extensions.  */
        case DW_OP_HP_is_value: