gdb/testsuite: gdb.base/args.exp: add KFAIL for native-extended-gdbserver
[binutils-gdb.git] / gdb / ppc-linux-tdep.c
index ecfaee391f69f929fd18223b1630154616cf77bd..1e94922f25a94edb76cef16e5ca1eb2b9434e9d1 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -52,6 +52,7 @@
 #include "linux-record.h"
 #include "record-full.h"
 #include "infrun.h"
+#include "expop.h"
 
 #include "stap-probe.h"
 #include "ax.h"
@@ -250,10 +251,10 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
                        struct type *valtype, struct regcache *regcache,
                        gdb_byte *readbuf, const gdb_byte *writebuf)
 {  
-  if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
-       || TYPE_CODE (valtype) == TYPE_CODE_UNION)
+  if ((valtype->code () == TYPE_CODE_STRUCT
+       || valtype->code () == TYPE_CODE_UNION)
       && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
-          && TYPE_VECTOR (valtype)))
+          && valtype->is_vector ()))
     return RETURN_VALUE_STRUCT_CONVENTION;
   else
     return ppc_sysv_abi_return_value (gdbarch, function, valtype, regcache,
@@ -1223,7 +1224,7 @@ ppc_linux_sigtramp_cache (struct frame_info *this_frame,
                                   fpregs + i * tdep->wordsize);
        }
       trad_frame_set_reg_addr (this_cache, tdep->ppc_fpscr_regnum,
-                         fpregs + 32 * tdep->wordsize);
+                        fpregs + 32 * tdep->wordsize);
     }
   trad_frame_set_id (this_cache, frame_id_build (base, func));
 }
@@ -1330,7 +1331,7 @@ ppc_linux_trap_reg_p (struct gdbarch *gdbarch)
 
   /* If we do, then it is safe to check the size.  */
   return register_size (gdbarch, PPC_ORIG_R3_REGNUM) > 0
-         && register_size (gdbarch, PPC_TRAP_REGNUM) > 0;
+        && register_size (gdbarch, PPC_TRAP_REGNUM) > 0;
 }
 
 /* Return the current system call's number present in the
@@ -1674,7 +1675,7 @@ ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
 /* Implementation of `gdbarch_stap_parse_special_token', as defined in
    gdbarch.h.  */
 
-static int
+static expr::operation_up
 ppc_stap_parse_special_token (struct gdbarch *gdbarch,
                              struct stap_parse_info *p)
 {
@@ -1686,7 +1687,6 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
       const char *s = p->arg;
       char *regname;
       int len;
-      struct stoken str;
 
       while (isdigit (*s))
        ++s;
@@ -1695,7 +1695,7 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
        {
          /* It is a register displacement indeed.  Returning 0 means we are
             deferring the treatment of this case to the generic parser.  */
-         return 0;
+         return {};
        }
 
       len = s - p->arg;
@@ -1710,22 +1710,14 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
        error (_("Invalid register name `%s' on expression `%s'."),
               regname, p->saved_arg);
 
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-      str.ptr = regname;
-      str.length = len;
-      write_exp_string (&p->pstate, str);
-      write_exp_elt_opcode (&p->pstate, OP_REGISTER);
-
       p->arg = s;
-    }
-  else
-    {
-      /* All the other tokens should be handled correctly by the generic
-        parser.  */
-      return 0;
+
+      return expr::make_operation<expr::register_operation> (regname);
     }
 
-  return 1;
+  /* All the other tokens should be handled correctly by the generic
+     parser.  */
+  return {};
 }
 
 /* Initialize linux_record_tdep if not initialized yet.
@@ -1961,9 +1953,9 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
    length LEN in bits.  If non-NULL, NAME is the name of its type.
    If no suitable type is found, return NULL.  */
 
-const struct floatformat **
+static const struct floatformat **
 ppc_floatformat_for_type (struct gdbarch *gdbarch,
-                          const char *name, int len)
+                         const char *name, int len)
 {
   if (len == 128 && name)
     {
@@ -1983,7 +1975,7 @@ ppc_floatformat_for_type (struct gdbarch *gdbarch,
 
 static void
 ppc_linux_init_abi (struct gdbarch_info info,
-                    struct gdbarch *gdbarch)
+                   struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct tdesc_arch_data *tdesc_data = info.tdesc_data;
@@ -1993,7 +1985,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
   static const char *const stap_register_indirection_suffixes[] = { ")",
                                                                    NULL };
 
-  linux_init_abi (info, gdbarch);
+  linux_init_abi (info, gdbarch, 0);
 
   /* PPC GNU/Linux uses either 64-bit or 128-bit long doubles; where
      128-bit, they can be either IBM long double or IEEE quad long double.
@@ -2038,12 +2030,12 @@ ppc_linux_init_abi (struct gdbarch_info info,
       set_gdbarch_return_value (gdbarch, ppc_linux_return_value);
 
       set_gdbarch_memory_remove_breakpoint (gdbarch,
-                                            ppc_linux_memory_remove_breakpoint);
+                                           ppc_linux_memory_remove_breakpoint);
 
       /* Shared library handling.  */
       set_gdbarch_skip_trampoline_code (gdbarch, ppc_skip_trampoline_code);
       set_solib_svr4_fetch_link_map_offsets
-        (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+       (gdbarch, svr4_ilp32_fetch_link_map_offsets);
 
       /* Setting the correct XML syscall filename.  */
       set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC);
@@ -2095,7 +2087,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
       /* Shared library handling.  */
       set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
       set_solib_svr4_fetch_link_map_offsets
-        (gdbarch, svr4_lp64_fetch_link_map_offsets);
+       (gdbarch, svr4_lp64_fetch_link_map_offsets);
 
       /* Setting the correct XML syscall filename.  */
       set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC64);
@@ -2119,21 +2111,21 @@ ppc_linux_init_abi (struct gdbarch_info info,
 
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
-                                             svr4_fetch_objfile_link_map);
+                                            svr4_fetch_objfile_link_map);
 
   if (tdesc_data)
     {
       const struct tdesc_feature *feature;
 
       /* If we have target-described registers, then we can safely
-         reserve a number for PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM
+        reserve a number for PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM
         (whether they are described or not).  */
       gdb_assert (gdbarch_num_regs (gdbarch) <= PPC_ORIG_R3_REGNUM);
       set_gdbarch_num_regs (gdbarch, PPC_TRAP_REGNUM + 1);
 
       /* If they are present, then assign them to the reserved number.  */
       feature = tdesc_find_feature (info.target_desc,
-                                    "org.gnu.gdb.power.linux");
+                                   "org.gnu.gdb.power.linux");
       if (feature != NULL)
        {
          tdesc_numbered_register (feature, tdesc_data,
@@ -2143,9 +2135,6 @@ ppc_linux_init_abi (struct gdbarch_info info,
        }
     }
 
-  set_gdbarch_displaced_step_location (gdbarch,
-                                      linux_displaced_step_location);
-
   /* Support reverse debugging.  */
   set_gdbarch_process_record (gdbarch, ppc_process_record);
   set_gdbarch_process_record_signal (gdbarch, ppc_linux_record_signal);
@@ -2155,17 +2144,18 @@ ppc_linux_init_abi (struct gdbarch_info info,
   ppc_init_linux_record_tdep (&ppc64_linux_record_tdep, 8);
 }
 
+void _initialize_ppc_linux_tdep ();
 void
-_initialize_ppc_linux_tdep (void)
+_initialize_ppc_linux_tdep ()
 {
   /* Register for all sub-families 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);
+                        ppc_linux_init_abi);
   gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX,
-                         ppc_linux_init_abi);
+                        ppc_linux_init_abi);
   gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX,
-                         ppc_linux_init_abi);
+                        ppc_linux_init_abi);
 
   /* Initialize the Linux target descriptions.  */
   initialize_tdesc_powerpc_32l ();