* amd64-tdep.c (amd64_frame_cache): Fix comment.
[deliverable/binutils-gdb.git] / gdb / ppc-linux-tdep.c
index 4bb8326b0499b0d399f7bd16da816fc8cd166e61..84eb742d8e27e2d58fa66fecbef8bd28301cda48 100644 (file)
@@ -596,13 +596,19 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
    structures, no matter their size, are put in memory.  Vectors,
    which were added later, do get returned in a register though.  */
 
-static int     
-ppc_linux_use_struct_convention (int gcc_p, struct type *value_type)
+static enum return_value_convention
+ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype,
+                       struct regcache *regcache, void *readbuf,
+                       const void *writebuf)
 {  
-  if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8)
-      && TYPE_VECTOR (value_type))
-    return 0;                            
-  return 1;
+  if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
+       || TYPE_CODE (valtype) == TYPE_CODE_UNION)
+      && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
+          && TYPE_VECTOR (valtype)))
+    return RETURN_VALUE_STRUCT_CONVENTION;
+  else
+    return ppc_sysv_abi_return_value (gdbarch, valtype, regcache, readbuf,
+                                     writebuf);
 }
 
 /* Fetch (and possibly build) an appropriate link_map_offsets
@@ -936,13 +942,11 @@ ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
                                        CORE_ADDR addr,
                                        struct target_ops *targ)
 {
-  struct obj_section *s;
-
-  s = find_pc_section (addr);
+  struct section_table *s = target_section_by_addr (targ, addr);
 
   /* Check if ADDR points to a function descriptor.  */
   if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
-    return read_memory_unsigned_integer (addr, 8);
+    return get_target_memory_unsigned (targ, addr, 8);
 
   return addr;
 }
@@ -1045,12 +1049,11 @@ ppc_linux_init_abi (struct gdbarch_info info,
         (well ignoring vectors that is).  When this was corrected, it
         wasn't fixed for GNU/Linux native platform.  Use the
         PowerOpen struct convention.  */
-      set_gdbarch_use_struct_convention (gdbarch, ppc_linux_use_struct_convention);
+      set_gdbarch_return_value (gdbarch, ppc_linux_return_value);
 
       /* Note: kevinb/2002-04-12: See note in rs6000_gdbarch_init regarding
         *_push_arguments().  The same remarks hold for the methods below.  */
-      set_gdbarch_frameless_function_invocation (gdbarch,
-        ppc_linux_frameless_function_invocation);
+      set_gdbarch_deprecated_frameless_function_invocation (gdbarch, ppc_linux_frameless_function_invocation);
       set_gdbarch_deprecated_frame_chain (gdbarch, ppc_linux_frame_chain);
       set_gdbarch_deprecated_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
 
@@ -1079,13 +1082,22 @@ ppc_linux_init_abi (struct gdbarch_info info,
       set_gdbarch_in_solib_call_trampoline
         (gdbarch, ppc64_in_solib_call_trampoline);
       set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
+
+      /* PPC64 malloc's entry-point is called ".malloc".  */
+      set_gdbarch_name_of_malloc (gdbarch, ".malloc");
     }
 }
 
 void
 _initialize_ppc_linux_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_LINUX,
-                         ppc_linux_init_abi);
+  /* Register for all sub-familes of the POWER/PowerPC: 32-bit and
+     64-bit PowerPC, and the older rs6k.  */
+  gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_LINUX,
+                         ppc_linux_init_abi);
+  gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX,
+                         ppc_linux_init_abi);
+  gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX,
+                         ppc_linux_init_abi);
   add_core_fns (&ppc_linux_regset_core_fns);
 }
This page took 0.025779 seconds and 4 git commands to generate.