Check file exists before completion tests
[deliverable/binutils-gdb.git] / gdb / dwarf2loc.c
index 2879ead5e754994be4b4c650fb4379a39dbe7e85..e91b764065d1b4d09c0af858c55e88c0cd95c3ed 100644 (file)
@@ -1,6 +1,6 @@
 /* DWARF 2 location expression support for GDB.
 
-   Copyright (C) 2003-2013 Free Software Foundation, Inc.
+   Copyright (C) 2003-2014 Free Software Foundation, Inc.
 
    Contributed by Daniel Jacobowitz, MontaVista Software, Inc.
 
@@ -39,7 +39,7 @@
 #include "dwarf2loc.h"
 #include "dwarf2-frame.h"
 
-#include "gdb_string.h"
+#include <string.h>
 #include "gdb_assert.h"
 
 extern int dwarf2_always_disassemble;
@@ -313,7 +313,7 @@ struct dwarf_expr_baton
 /* Using the frame specified in BATON, return the value of register
    REGNUM, treated as a pointer.  */
 static CORE_ADDR
-dwarf_expr_read_reg (void *baton, int dwarf_regnum)
+dwarf_expr_read_addr_from_reg (void *baton, int dwarf_regnum)
 {
   struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
   struct gdbarch *gdbarch = get_frame_arch (debaton->frame);
@@ -555,7 +555,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
                           "at %s in %s"),
                         paddress (call_site_gdbarch, call_site->pc),
                         (msym.minsym == NULL ? "???"
-                         : SYMBOL_PRINT_NAME (msym.minsym)));
+                         : MSYMBOL_PRINT_NAME (msym.minsym)));
                        
          }
        if (caller_frame == NULL)
@@ -569,7 +569,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
                           "available at %s in %s"),
                         paddress (call_site_gdbarch, call_site->pc),
                         (msym.minsym == NULL ? "???"
-                         : SYMBOL_PRINT_NAME (msym.minsym)));
+                         : MSYMBOL_PRINT_NAME (msym.minsym)));
                        
          }
        caller_arch = get_frame_arch (caller_frame);
@@ -588,23 +588,24 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
     case FIELD_LOC_KIND_PHYSNAME:
       {
        const char *physname;
-       struct minimal_symbol *msym;
+       struct bound_minimal_symbol msym;
 
        physname = FIELD_STATIC_PHYSNAME (call_site->target);
 
        /* Handle both the mangled and demangled PHYSNAME.  */
        msym = lookup_minimal_symbol (physname, NULL, NULL);
-       if (msym == NULL)
+       if (msym.minsym == NULL)
          {
-           msym = lookup_minimal_symbol_by_pc (call_site->pc - 1).minsym;
+           msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
            throw_error (NO_ENTRY_VALUE_ERROR,
                         _("Cannot find function \"%s\" for a call site target "
                           "at %s in %s"),
                         physname, paddress (call_site_gdbarch, call_site->pc),
-                        msym == NULL ? "???" : SYMBOL_PRINT_NAME (msym));
+                        (msym.minsym == NULL ? "???"
+                         : MSYMBOL_PRINT_NAME (msym.minsym)));
                        
          }
-       return SYMBOL_VALUE_ADDRESS (msym);
+       return BMSYMBOL_VALUE_ADDRESS (msym);
       }
 
     case FIELD_LOC_KIND_PHYSADDR:
@@ -700,7 +701,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
                             "function \"%s\" at %s can call itself via tail "
                             "calls"),
                           (msym.minsym == NULL ? "???"
-                           : SYMBOL_PRINT_NAME (msym.minsym)),
+                           : MSYMBOL_PRINT_NAME (msym.minsym)),
                           paddress (gdbarch, verify_addr));
            }
 
@@ -728,7 +729,7 @@ tailcall_dump (struct gdbarch *gdbarch, const struct call_site *call_site)
 
   fprintf_unfiltered (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr),
                      (msym.minsym == NULL ? "???"
-                      : SYMBOL_PRINT_NAME (msym.minsym)));
+                      : MSYMBOL_PRINT_NAME (msym.minsym)));
 
 }
 
@@ -968,10 +969,10 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
                     "callers or callees between caller function \"%s\" at %s "
                     "and callee function \"%s\" at %s"),
                   (msym_caller.minsym == NULL
-                   ? "???" : SYMBOL_PRINT_NAME (msym_caller.minsym)),
+                   ? "???" : MSYMBOL_PRINT_NAME (msym_caller.minsym)),
                   paddress (gdbarch, caller_pc),
                   (msym_callee.minsym == NULL
-                   ? "???" : SYMBOL_PRINT_NAME (msym_callee.minsym)),
+                   ? "???" : MSYMBOL_PRINT_NAME (msym_callee.minsym)),
                   paddress (gdbarch, callee_pc));
     }
 
@@ -1073,7 +1074,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
                   gdbarch_bfd_arch_info (gdbarch)->printable_name,
                   paddress (gdbarch, func_addr),
                   (msym.minsym == NULL ? "???"
-                   : SYMBOL_PRINT_NAME (msym.minsym)),
+                   : MSYMBOL_PRINT_NAME (msym.minsym)),
                   gdbarch_bfd_arch_info (caller_gdbarch)->printable_name);
     }
 
@@ -1086,7 +1087,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
                                           "requires caller of %s (%s)"),
                   paddress (gdbarch, func_addr),
                   (msym.minsym == NULL ? "???"
-                   : SYMBOL_PRINT_NAME (msym.minsym)));
+                   : MSYMBOL_PRINT_NAME (msym.minsym)));
     }
   caller_pc = get_frame_pc (caller_frame);
   call_site = call_site_for_pc (gdbarch, caller_pc);
@@ -1102,9 +1103,9 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
                   _("DW_OP_GNU_entry_value resolving expects callee %s at %s "
                     "but the called frame is for %s at %s"),
                   (target_msym == NULL ? "???"
-                                       : SYMBOL_PRINT_NAME (target_msym)),
+                                       : MSYMBOL_PRINT_NAME (target_msym)),
                   paddress (gdbarch, target_addr),
-                  func_msym == NULL ? "???" : SYMBOL_PRINT_NAME (func_msym),
+                  func_msym == NULL ? "???" : MSYMBOL_PRINT_NAME (func_msym),
                   paddress (gdbarch, func_addr));
     }
 
@@ -1128,7 +1129,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
       throw_error (NO_ENTRY_VALUE_ERROR, _("Cannot find matching parameter "
                                           "at DW_TAG_GNU_call_site %s at %s"),
                   paddress (gdbarch, caller_pc),
-                  msym == NULL ? "???" : SYMBOL_PRINT_NAME (msym)); 
+                  msym == NULL ? "???" : MSYMBOL_PRINT_NAME (msym)); 
     }
 
   *per_cu_return = call_site->per_cu;
@@ -1414,14 +1415,14 @@ allocate_piece_closure (struct dwarf2_per_cu_data *per_cu,
                        int n_pieces, struct dwarf_expr_piece *pieces,
                        int addr_size)
 {
-  struct piece_closure *c = XZALLOC (struct piece_closure);
+  struct piece_closure *c = XCNEW (struct piece_closure);
   int i;
 
   c->refc = 1;
   c->per_cu = per_cu;
   c->n_pieces = n_pieces;
   c->addr_size = addr_size;
-  c->pieces = XCALLOC (n_pieces, struct dwarf_expr_piece);
+  c->pieces = XCNEWVEC (struct dwarf_expr_piece, n_pieces);
 
   memcpy (c->pieces, pieces, n_pieces * sizeof (struct dwarf_expr_piece));
   for (i = 0; i < n_pieces; ++i)
@@ -1709,7 +1710,7 @@ read_pieced_value (struct value *v)
                    if (optim)
                      set_value_optimized_out (v, 1);
                    if (unavail)
-                     mark_value_bytes_unavailable (v, offset, this_size);
+                     mark_value_bits_unavailable (v, offset, this_size_bits);
                  }
              }
            else
@@ -1893,9 +1894,10 @@ write_pieced_value (struct value *to, struct value *from)
                                                   &optim, &unavail))
                      {
                        if (optim)
-                         error (_("Can't do read-modify-write to "
-                                  "update bitfield; containing word has been "
-                                  "optimized out"));
+                         throw_error (OPTIMIZED_OUT_ERROR,
+                                      _("Can't do read-modify-write to "
+                                        "update bitfield; containing word "
+                                        "has been optimized out"));
                        if (unavail)
                          throw_error (NOT_AVAILABLE_ERROR,
                                       _("Can't do read-modify-write to update "
@@ -2194,7 +2196,7 @@ static const struct lval_funcs pieced_value_funcs = {
 
 static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
 {
-  dwarf_expr_read_reg,
+  dwarf_expr_read_addr_from_reg,
   dwarf_expr_get_reg_value,
   dwarf_expr_read_mem,
   dwarf_expr_frame_base,
@@ -2441,7 +2443,7 @@ struct needs_frame_baton
 
 /* Reads from registers do require a frame.  */
 static CORE_ADDR
-needs_frame_read_reg (void *baton, int regnum)
+needs_frame_read_addr_from_reg (void *baton, int regnum)
 {
   struct needs_frame_baton *nf_baton = baton;
 
@@ -2541,7 +2543,7 @@ needs_get_addr_index (void *baton, unsigned int index)
 
 static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs =
 {
-  needs_frame_read_reg,
+  needs_frame_read_addr_from_reg,
   needs_frame_get_reg_value,
   needs_frame_read_mem,
   needs_frame_frame_base,
This page took 0.050769 seconds and 4 git commands to generate.