gdb: remove duplicate declaration of 'find_thread_ptid'
[deliverable/binutils-gdb.git] / gdb / rs6000-aix-tdep.c
index 4528cb2ea0600afc12fe467ec8113dd6cbd7b2e2..02d492b337719b7526c877b5e18e9cfe7e05eccb 100644 (file)
@@ -1,6 +1,6 @@
 /* Native support code for PPC AIX, for GDB the GNU debugger.
 
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2021 Free Software Foundation, Inc.
 
    Free Software Foundation, Inc.
 
@@ -37,7 +37,7 @@
 #include "solib.h"
 #include "solib-aix.h"
 #include "target-float.h"
-#include "xml-utils.h"
+#include "gdbsupport/xml-utils.h"
 #include "trad-frame.h"
 #include "frame-unwind.h"
 
@@ -84,7 +84,7 @@ aix_sighandle_frame_cache (struct frame_info *this_frame,
   (*this_cache) = this_trad_cache;
 
   base = get_frame_register_unsigned (this_frame,
-                                      gdbarch_sp_regnum (gdbarch));
+                                     gdbarch_sp_regnum (gdbarch));
   base_orig = base;
 
   if (tdep->wordsize == 4)
@@ -111,10 +111,10 @@ aix_sighandle_frame_cache (struct frame_info *this_frame,
 
   if (tdep->wordsize == 4)
     trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum,
-                             base_orig + 0x38 + 52 + 8);
+                            base_orig + 0x38 + 52 + 8);
   else
     trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum,
-                             base_orig + 0x70 + 320);
+                            base_orig + 0x70 + 320);
 
   trad_frame_set_id (this_trad_cache, frame_id_build (base, func));
   trad_frame_set_this_base (this_trad_cache, base);
@@ -141,7 +141,7 @@ aix_sighandle_frame_prev_register (struct frame_info *this_frame,
   return trad_frame_get_register (this_trad_cache, this_frame, regnum);
 }
 
-int
+static int
 aix_sighandle_frame_sniffer (const struct frame_unwind *self,
                             struct frame_info *this_frame,
                             void **this_prologue_cache)
@@ -285,7 +285,8 @@ static CORE_ADDR
 rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                        struct regcache *regcache, CORE_ADDR bp_addr,
                        int nargs, struct value **args, CORE_ADDR sp,
-                       int struct_return, CORE_ADDR struct_addr)
+                       function_call_return_method return_method,
+                       CORE_ADDR struct_addr)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -316,7 +317,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
      (which will be passed in r3) is used for struct return address.
      In that case we should advance one word and start from r4
      register to copy parameters.  */
-  if (struct_return)
+  if (return_method == return_method_struct)
     {
       regcache_raw_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
                                   struct_addr);
@@ -348,7 +349,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       type = check_typedef (value_type (arg));
       len = TYPE_LENGTH (type);
 
-      if (TYPE_CODE (type) == TYPE_CODE_FLT)
+      if (type->code () == TYPE_CODE_FLT)
        {
          /* Floating point arguments are passed in fpr's, as well as gpr's.
             There are 13 fpr's reserved for passing parameters.  At this point
@@ -378,7 +379,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              memcpy (word,
                      ((char *) value_contents (arg)) + argbytes,
                      (len - argbytes) > reg_size
-                       ? reg_size : len - argbytes);
+                       ? reg_size : len - argbytes);
              regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
              ++ii, argbytes += reg_size;
 
@@ -441,16 +442,16 @@ ran_out_of_registers_for_arguments:
       sp -= space;
 
       /* This is another instance we need to be concerned about
-         securing our stack space.  If we write anything underneath %sp
-         (r1), we might conflict with the kernel who thinks he is free
-         to use this area.  So, update %sp first before doing anything
-         else.  */
+        securing our stack space.  If we write anything underneath %sp
+        (r1), we might conflict with the kernel who thinks he is free
+        to use this area.  So, update %sp first before doing anything
+        else.  */
 
       regcache_raw_write_signed (regcache,
                                 gdbarch_sp_regnum (gdbarch), sp);
 
       /* If the last argument copied into the registers didn't fit there 
-         completely, push the rest of it into stack.  */
+        completely, push the rest of it into stack.  */
 
       if (argbytes)
        {
@@ -471,8 +472,8 @@ ran_out_of_registers_for_arguments:
 
 
          /* Float types should be passed in fpr's, as well as in the
-             stack.  */
-         if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
+            stack.  */
+         if (type->code () == TYPE_CODE_FLT && f_argno < 13)
            {
 
              gdb_assert (len <= 8);
@@ -526,7 +527,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
 
   /* AltiVec extension: Functions that declare a vector data type as a
      return value place that return value in VR2.  */
-  if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
+  if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ()
       && TYPE_LENGTH (valtype) == 16)
     {
       if (readbuf)
@@ -542,16 +543,16 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
      allocated buffer into which the callee is assumed to store its
      return value.  All explicit parameters are appropriately
      relabeled.  */
-  if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
-      || TYPE_CODE (valtype) == TYPE_CODE_UNION
-      || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+  if (valtype->code () == TYPE_CODE_STRUCT
+      || valtype->code () == TYPE_CODE_UNION
+      || valtype->code () == TYPE_CODE_ARRAY)
     return RETURN_VALUE_STRUCT_CONVENTION;
 
   /* Scalar floating-point values are returned in FPR1 for float or
      double, and in FPR1:FPR2 for quadword precision.  Fortran
      complex*8 and complex*16 are returned in FPR1:FPR2, and
      complex*32 is returned in FPR1:FPR4.  */
-  if (TYPE_CODE (valtype) == TYPE_CODE_FLT
+  if (valtype->code () == TYPE_CODE_FLT
       && (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8))
     {
       struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
@@ -607,7 +608,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
 
   if (TYPE_LENGTH (valtype) == 8)
     {
-      gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_FLT);
+      gdb_assert (valtype->code () != TYPE_CODE_FLT);
       gdb_assert (tdep->wordsize == 4);
 
       if (readbuf)
@@ -669,23 +670,22 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
       CORE_ADDR pc = 0;
       struct obj_section *pc_section;
 
-      TRY
-        {
-          pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
-        }
-      CATCH (e, RETURN_MASK_ERROR)
-        {
-          /* An error occured during reading.  Probably a memory error
-             due to the section not being loaded yet.  This address
-             cannot be a function descriptor.  */
-          return addr;
-        }
-      END_CATCH
+      try
+       {
+         pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
+       }
+      catch (const gdb_exception_error &e)
+       {
+         /* An error occured during reading.  Probably a memory error
+            due to the section not being loaded yet.  This address
+            cannot be a function descriptor.  */
+         return addr;
+       }
 
       pc_section = find_pc_section (pc);
 
       if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
-        return pc;
+       return pc;
     }
 
   return addr;
@@ -731,7 +731,7 @@ branch_dest (struct regcache *regcache, int opcode, int instr,
 
       if (ext_op == 16)                /* br conditional register */
        {
-          dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
+         dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
 
          /* If we are about to return from a signal handler, dest is
             something like 0x3c90.  The current frame is a signal handler
@@ -749,14 +749,14 @@ branch_dest (struct regcache *regcache, int opcode, int instr,
 
       else if (ext_op == 528)  /* br cond to count reg */
        {
-          dest = regcache_raw_get_unsigned (regcache,
+         dest = regcache_raw_get_unsigned (regcache,
                                            tdep->ppc_ctr_regnum) & ~3;
 
          /* If we are about to execute a system call, dest is something
             like 0x22fc or 0x3b00.  Upon completion the system call
             will return to the address in the link register.  */
          if (dest < AIX_TEXT_SEGMENT_BASE)
-            dest = regcache_raw_get_unsigned (regcache,
+           dest = regcache_raw_get_unsigned (regcache,
                                              tdep->ppc_lr_regnum) & ~3;
        }
       else
@@ -878,11 +878,11 @@ struct ld_info_desc
 #define pinfo(type,member)                  \
   {                                         \
     struct type ldi = {0};                  \
-                                            \
+                                           \
     printf ("  {%d, %d},\t/* %s */\n",      \
-            offsetof (struct type, member), \
-            sizeof (ldi.member),            \
-            #member);                       \
+           offsetof (struct type, member), \
+           sizeof (ldi.member),            \
+           #member);                       \
   }                                         \
   while (0)
 
@@ -1087,7 +1087,7 @@ rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
   else
     {
       if (len > len_avail - offset)
-        len = len_avail - offset;
+       len = len_avail - offset;
       memcpy (readbuf, buf + offset, len);
     }
 
@@ -1110,7 +1110,7 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
   if (ldinfo_sec == NULL)
     error (_("cannot find .ldinfo section from core file: %s"),
           bfd_errmsg (bfd_get_error ()));
-  ldinfo_size = bfd_get_section_size (ldinfo_sec);
+  ldinfo_size = bfd_section_size (ldinfo_sec);
 
   gdb::byte_vector ldinfo_buf (ldinfo_size);
 
@@ -1132,10 +1132,12 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step);
 
   /* Displaced stepping is currently not supported in combination with
-     software single-stepping.  */
+     software single-stepping.  These override the values set by
+     rs6000_gdbarch_init.  */
   set_gdbarch_displaced_step_copy_insn (gdbarch, NULL);
   set_gdbarch_displaced_step_fixup (gdbarch, NULL);
-  set_gdbarch_displaced_step_location (gdbarch, NULL);
+  set_gdbarch_displaced_step_prepare (gdbarch, NULL);
+  set_gdbarch_displaced_step_finish (gdbarch, NULL);
 
   set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call);
   set_gdbarch_return_value (gdbarch, rs6000_return_value);
@@ -1177,19 +1179,20 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
   frame_unwind_append_unwinder (gdbarch, &aix_sighandle_frame_unwind);
 }
 
+void _initialize_rs6000_aix_tdep ();
 void
-_initialize_rs6000_aix_tdep (void)
+_initialize_rs6000_aix_tdep ()
 {
   gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
-                                  bfd_target_xcoff_flavour,
-                                  rs6000_aix_osabi_sniffer);
+                                 bfd_target_xcoff_flavour,
+                                 rs6000_aix_osabi_sniffer);
   gdbarch_register_osabi_sniffer (bfd_arch_powerpc,
-                                  bfd_target_xcoff_flavour,
-                                  rs6000_aix_osabi_sniffer);
+                                 bfd_target_xcoff_flavour,
+                                 rs6000_aix_osabi_sniffer);
 
   gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_AIX,
-                          rs6000_aix_init_osabi);
+                         rs6000_aix_init_osabi);
   gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_AIX,
-                          rs6000_aix_init_osabi);
+                         rs6000_aix_init_osabi);
 }
 
This page took 0.027795 seconds and 4 git commands to generate.