]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/compile/compile-object-load.c
Default gdb_bfd_open's fd parameter to -1
[thirdparty/binutils-gdb.git] / gdb / compile / compile-object-load.c
index 8106a56902f8d60e9c522066c64991e994af1763..76a9418dac0e6b5c99e69383105770f6a0025488 100644 (file)
@@ -402,6 +402,9 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
   int nblocks = 0;
   int block_loop = 0;
 
+  lookup_name_info func_matcher (GCC_FE_WRAPPER_FUNCTION,
+                                symbol_name_match_type::SEARCH_NAME);
+
   bv = SYMTAB_BLOCKVECTOR (func_sym->owner.symtab);
   nblocks = BLOCKVECTOR_NBLOCKS (bv);
 
@@ -433,13 +436,11 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
       if (function != NULL
          && (BLOCK_SUPERBLOCK (function_block)
              == BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK))
-         && (strcmp_iw (function->linkage_name (),
-                        GCC_FE_WRAPPER_FUNCTION)
-             == 0))
+         && symbol_matches_search_name (function, func_matcher))
        break;
     }
   if (block_loop == nblocks)
-    error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
+    error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_VAL);
 
   gdb_type = SYMBOL_TYPE (gdb_val_sym);
   gdb_type = check_typedef (gdb_type);
@@ -451,7 +452,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
     error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
   gdb_ptr_type = SYMBOL_TYPE (gdb_ptr_type_sym);
   gdb_ptr_type = check_typedef (gdb_ptr_type);
-  if (TYPE_CODE (gdb_ptr_type) != TYPE_CODE_PTR)
+  if (gdb_ptr_type->code () != TYPE_CODE_PTR)
     error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
   gdb_type_from_ptr = check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type));
 
@@ -463,14 +464,14 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
       return gdb_type;
     }
 
-  if (TYPE_CODE (gdb_type) != TYPE_CODE_PTR)
+  if (gdb_type->code () != TYPE_CODE_PTR)
     error (_("Invalid type code %d of symbol \"%s\" "
             "in compiled module \"%s\"."),
-          TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_VAL,
+          gdb_type_from_ptr->code (), COMPILE_I_EXPR_VAL,
           objfile_name (objfile));
   
   retval = gdb_type_from_ptr;
-  switch (TYPE_CODE (gdb_type_from_ptr))
+  switch (gdb_type_from_ptr->code ())
     {
     case TYPE_CODE_ARRAY:
       gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_type_from_ptr);
@@ -480,7 +481,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
     default:
       error (_("Invalid type code %d of symbol \"%s\" "
               "in compiled module \"%s\"."),
-            TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_PTR_TYPE,
+            gdb_type_from_ptr->code (), COMPILE_I_EXPR_PTR_TYPE,
             objfile_name (objfile));
     }
   if (!types_deeply_equal (gdb_type_from_ptr,
@@ -508,17 +509,17 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
     return NULL;
 
   regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0));
-  if (TYPE_CODE (regsp_type) != TYPE_CODE_PTR)
+  if (regsp_type->code () != TYPE_CODE_PTR)
     error (_("Invalid type code %d of first parameter of function \"%s\" "
             "in compiled module \"%s\"."),
-          TYPE_CODE (regsp_type), GCC_FE_WRAPPER_FUNCTION,
+          regsp_type->code (), GCC_FE_WRAPPER_FUNCTION,
           objfile_name (objfile));
 
   regs_type = check_typedef (TYPE_TARGET_TYPE (regsp_type));
-  if (TYPE_CODE (regs_type) != TYPE_CODE_STRUCT)
+  if (regs_type->code () != TYPE_CODE_STRUCT)
     error (_("Invalid type code %d of dereferenced first parameter "
             "of function \"%s\" in compiled module \"%s\"."),
-          TYPE_CODE (regs_type), GCC_FE_WRAPPER_FUNCTION,
+          regs_type->code (), GCC_FE_WRAPPER_FUNCTION,
           objfile_name (objfile));
 
   return regs_type;
@@ -554,10 +555,10 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
               reg_name, pulongest (reg_bitpos), pulongest (reg_bitsize));
       reg_offset = reg_bitpos / 8;
 
-      if (TYPE_CODE (reg_type) != TYPE_CODE_INT
-         && TYPE_CODE (reg_type) != TYPE_CODE_PTR)
+      if (reg_type->code () != TYPE_CODE_INT
+         && reg_type->code () != TYPE_CODE_PTR)
        error (_("Invalid register \"%s\" type code %d"), reg_name,
-              TYPE_CODE (reg_type));
+              reg_type->code ());
 
       regnum = compile_register_name_demangle (gdbarch, reg_name);
 
@@ -603,7 +604,7 @@ compile_object_load (const compile_file_names &file_names,
   gdb::unique_xmalloc_ptr<char> filename
     (tilde_expand (file_names.object_file ()));
 
-  gdb_bfd_ref_ptr abfd (gdb_bfd_open (filename.get (), gnutarget, -1));
+  gdb_bfd_ref_ptr abfd (gdb_bfd_open (filename.get (), gnutarget));
   if (abfd == NULL)
     error (_("\"%s\": could not open as compiled module: %s"),
           filename.get (), bfd_errmsg (bfd_get_error ()));
@@ -645,10 +646,10 @@ compile_object_load (const compile_file_names &file_names,
     error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
           GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
   func_type = SYMBOL_TYPE (func_sym);
-  if (TYPE_CODE (func_type) != TYPE_CODE_FUNC)
+  if (func_type->code () != TYPE_CODE_FUNC)
     error (_("Invalid type code %d of function \"%s\" in compiled "
             "module \"%s\"."),
-          TYPE_CODE (func_type), GCC_FE_WRAPPER_FUNCTION,
+          func_type->code (), GCC_FE_WRAPPER_FUNCTION,
           objfile_name (objfile));
 
   switch (scope)