Copyright year update in most files of the GDB Project.
[deliverable/binutils-gdb.git] / gdb / dwarf2loc.c
index 0e1179c00f230ff37d818d2f68589dde8090533f..313df7b490b04b36a84874a43ca0237432fad90d 100644 (file)
@@ -1,7 +1,6 @@
 /* DWARF 2 location expression support for GDB.
 
-   Copyright (C) 2003, 2005, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005, 2007-2012 Free Software Foundation, Inc.
 
    Contributed by Daniel Jacobowitz, MontaVista Software, Inc.
 
@@ -112,7 +111,10 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
 
       /* An end-of-list entry.  */
       if (low == 0 && high == 0)
-       return NULL;
+       {
+         *locexpr_length = 0;
+         return NULL;
+       }
 
       /* Otherwise, a location expression entry.  */
       low += base_address;
@@ -215,7 +217,7 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
                         const gdb_byte **start, size_t *length)
 {
   if (SYMBOL_LOCATION_BATON (framefunc) == NULL)
-    *start = NULL;
+    *length = 0;
   else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs)
     {
       struct dwarf2_loclist_baton *symbaton;
@@ -234,10 +236,10 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
          *start = symbaton->data;
        }
       else
-       *start = NULL;
+       *length = 0;
     }
 
-  if (*start == NULL)
+  if (*length == 0)
     error (_("Could not find the frame base for \"%s\"."),
           SYMBOL_NATURAL_NAME (framefunc));
 }
@@ -440,9 +442,6 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr)
   return sym;
 }
 
-/* Define VEC (CORE_ADDR) functions.  */
-DEF_VEC_I (CORE_ADDR);
-
 /* Verify function with entry point exact address ADDR can never call itself
    via its tail calls (incl. transitively).  Throw NO_ENTRY_VALUE_ERROR if it
    can call itself via tail calls.
@@ -833,7 +832,8 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame, int dwarf_reg,
   int iparams;
   struct value *val;
   struct dwarf2_locexpr_baton *dwarf_block;
-  struct call_site_parameter *parameter;
+  /* Initialize it just to avoid a GCC false warning.  */
+  struct call_site_parameter *parameter = NULL;
   CORE_ADDR target_addr;
 
   if (gdbarch != frame_unwind_arch (frame))
@@ -3258,15 +3258,11 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
 static const gdb_byte *
 disassemble_dwarf_expression (struct ui_file *stream,
                              struct gdbarch *arch, unsigned int addr_size,
-                             int offset_size,
+                             int offset_size, const gdb_byte *start,
                              const gdb_byte *data, const gdb_byte *end,
-                             int all,
+                             int indent, int all,
                              struct dwarf2_per_cu_data *per_cu)
 {
-  const gdb_byte *start = data;
-
-  fprintf_filtered (stream, _("a complex DWARF expression:\n"));
-
   while (data < end
         && (all
             || (data[0] != DW_OP_piece && data[0] != DW_OP_bit_piece)))
@@ -3281,7 +3277,8 @@ disassemble_dwarf_expression (struct ui_file *stream,
       if (!name)
        error (_("Unrecognized DWARF opcode 0x%02x at %ld"),
               op, (long) (data - 1 - start));
-      fprintf_filtered (stream, "  % 4ld: %s", (long) (data - 1 - start), name);
+      fprintf_filtered (stream, "  %*ld: %s", indent + 4,
+                       (long) (data - 1 - start), name);
 
       switch (op)
        {
@@ -3579,6 +3576,15 @@ disassemble_dwarf_expression (struct ui_file *stream,
              }
          }
          break;
+
+       case DW_OP_GNU_entry_value:
+         data = read_uleb128 (data, end, &ul);
+         fputc_filtered ('\n', stream);
+         disassemble_dwarf_expression (stream, arch, addr_size, offset_size,
+                                       start, data, data + ul, indent + 2,
+                                       all, per_cu);
+         data += ul;
+         continue;
        }
 
       fprintf_filtered (stream, "\n");
@@ -3623,11 +3629,15 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
            disassemble = 0;
        }
       if (disassemble)
-       data = disassemble_dwarf_expression (stream,
-                                            get_objfile_arch (objfile),
-                                            addr_size, offset_size, data, end,
-                                            dwarf2_always_disassemble,
-                                            per_cu);
+       {
+         fprintf_filtered (stream, _("a complex DWARF expression:\n"));
+         data = disassemble_dwarf_expression (stream,
+                                              get_objfile_arch (objfile),
+                                              addr_size, offset_size, data,
+                                              data, end, 0,
+                                              dwarf2_always_disassemble,
+                                              per_cu);
+       }
 
       if (data < end)
        {
@@ -3705,7 +3715,7 @@ locexpr_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
   unsigned int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
 
-  if (dlbaton->data == NULL || dlbaton->size == 0)
+  if (dlbaton->size == 0)
     value->optimized_out = 1;
   else
     dwarf2_compile_expr_to_ax (ax, value, gdbarch, addr_size,
@@ -3739,11 +3749,8 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame)
   CORE_ADDR pc = frame ? get_frame_address_in_block (frame) : 0;
 
   data = dwarf2_find_location_expression (dlbaton, &size, pc);
-  if (data == NULL)
-    val = allocate_optimized_out_value (SYMBOL_TYPE (symbol));
-  else
-    val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
-                                   dlbaton->per_cu);
+  val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
+                                 dlbaton->per_cu);
 
   return val;
 }
@@ -3882,7 +3889,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
   unsigned int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
 
   data = dwarf2_find_location_expression (dlbaton, &size, ax->scope);
-  if (data == NULL || size == 0)
+  if (size == 0)
     value->optimized_out = 1;
   else
     dwarf2_compile_expr_to_ax (ax, value, gdbarch, addr_size, data, data + size,
This page took 0.026329 seconds and 4 git commands to generate.