* objcopy.c (setup_section): Set elf_group_id.
[deliverable/binutils-gdb.git] / binutils / dwarf.c
index 42ddd94233217034d7eca9a84380ddf794da5f39..983a3c76a5f093c40795446f41ed19166fa180a5 100644 (file)
@@ -164,6 +164,30 @@ byte_get_signed (unsigned char *field, int size)
     }
 }
 
+static int
+size_of_encoded_value (int encoding)
+{
+  switch (encoding & 0x7)
+    {
+    default:   /* ??? */
+    case 0:    return eh_addr_size;
+    case 2:    return 2;
+    case 3:    return 4;
+    case 4:    return 8;
+    }
+}
+
+static dwarf_vma
+get_encoded_value (unsigned char *data, int encoding)
+{
+  int size = size_of_encoded_value (encoding);
+
+  if (encoding & DW_EH_PE_signed)
+    return byte_get_signed (data, size);
+  else
+    return byte_get (data, size);
+}
+
 /* Print a dwarf_vma value (typically an address, offset or length) in
    hexadecimal format, followed by a space.  The length of the value (and
    hence the precision displayed) is determined by the byte_size parameter.  */
@@ -651,7 +675,8 @@ static int
 decode_location_expression (unsigned char * data,
                            unsigned int pointer_size,
                            unsigned long length,
-                           unsigned long cu_offset)
+                           unsigned long cu_offset,
+                           struct dwarf_section * section)
 {
   unsigned op;
   unsigned int bytes_read;
@@ -989,6 +1014,21 @@ decode_location_expression (unsigned char * data,
          printf ("DW_OP_GNU_uninit");
          /* FIXME: Is there data associated with this OP ?  */
          break;
+       case DW_OP_GNU_encoded_addr:
+         {
+           int encoding;
+           dwarf_vma addr;
+       
+           encoding = *data++;
+           addr = get_encoded_value (data, encoding);
+           if ((encoding & 0x70) == DW_EH_PE_pcrel)
+             addr += section->address + (data - section->start);
+           data += size_of_encoded_value (encoding);
+
+           printf ("DW_OP_GNU_encoded_addr: fmt:%02x addr:", encoding);
+           print_dwarf_vma (addr, pointer_size);
+         }
+         break;
 
          /* HP extensions.  */
        case DW_OP_HP_is_value:
@@ -1508,7 +1548,7 @@ read_and_display_attr_value (unsigned long attribute,
          need_frame_base = decode_location_expression (block_start,
                                                        pointer_size,
                                                        uvalue,
-                                                       cu_offset);
+                                                       cu_offset, section);
          printf (")");
          if (need_frame_base && !have_frame_base)
            printf (_(" [without DW_AT_frame_base]"));
@@ -3186,7 +3226,7 @@ display_debug_loc (struct dwarf_section *section, void *file)
              need_frame_base = decode_location_expression (start,
                                                            pointer_size,
                                                            length,
-                                                           cu_offset);
+                                                           cu_offset, section);
              putchar (')');
 
              if (need_frame_base && !has_frame_base)
@@ -3756,30 +3796,6 @@ frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs)
   printf ("\n");
 }
 
-static int
-size_of_encoded_value (int encoding)
-{
-  switch (encoding & 0x7)
-    {
-    default:   /* ??? */
-    case 0:    return eh_addr_size;
-    case 2:    return 2;
-    case 3:    return 4;
-    case 4:    return 8;
-    }
-}
-
-static dwarf_vma
-get_encoded_value (unsigned char *data, int encoding)
-{
-  int size = size_of_encoded_value (encoding);
-
-  if (encoding & DW_EH_PE_signed)
-    return byte_get_signed (data, size);
-  else
-    return byte_get (data, size);
-}
-
 #define GET(N) byte_get (start, N); start += N
 #define LEB()  read_leb128 (start, & length_return, 0); start += length_return
 #define SLEB() read_leb128 (start, & length_return, 1); start += length_return
@@ -4379,7 +4395,8 @@ display_debug_frames (struct dwarf_section *section,
              if (! do_debug_frames_interp)
                {
                  printf ("  DW_CFA_def_cfa_expression (");
-                 decode_location_expression (start, eh_addr_size, ul, 0);
+                 decode_location_expression (start, eh_addr_size, ul, 0,
+                                             section);
                  printf (")\n");
                }
              fc->cfa_exp = 1;
@@ -4394,7 +4411,7 @@ display_debug_frames (struct dwarf_section *section,
                  printf ("  DW_CFA_expression: %s (",
                          regname (reg, 0));
                  decode_location_expression (start, eh_addr_size,
-                                             ul, 0);
+                                             ul, 0, section);
                  printf (")\n");
                }
              fc->col_type[reg] = DW_CFA_expression;
@@ -4408,7 +4425,8 @@ display_debug_frames (struct dwarf_section *section,
                {
                  printf ("  DW_CFA_val_expression: %s (",
                          regname (reg, 0));
-                 decode_location_expression (start, eh_addr_size, ul, 0);
+                 decode_location_expression (start, eh_addr_size, ul, 0,
+                                             section);
                  printf (")\n");
                }
              fc->col_type[reg] = DW_CFA_val_expression;
This page took 0.024716 seconds and 4 git commands to generate.