Move gdbserver tdesc header funcs to c file
[deliverable/binutils-gdb.git] / gdb / sparc64-tdep.c
index 6a1d9631bbe223799c78fd8053ce2ffe320370e0..6f3ca198b3eeaab7976132ac5d0443127bba4c24 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for UltraSPARC.
 
-   Copyright (C) 2003-2017 Free Software Foundation, Inc.
+   Copyright (C) 2003-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -341,7 +341,7 @@ adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt)
    for "SIZE" number of bytes.  */
 
 static int
-adi_read_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
+adi_read_versions (CORE_ADDR vaddr, size_t size, gdb_byte *tags)
 {
   int fd = adi_tag_fd ();
   if (fd == -1)
@@ -383,7 +383,7 @@ adi_write_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
    at "VADDR" with number of "CNT".  */
 
 static void
-adi_print_versions (CORE_ADDR vaddr, size_t cnt, unsigned char *tags)
+adi_print_versions (CORE_ADDR vaddr, size_t cnt, gdb_byte *tags)
 {
   int v_idx = 0;
   const int maxelts = 8;  /* # of elements per line */
@@ -415,21 +415,17 @@ static void
 do_examine (CORE_ADDR start, int bcnt)
 {
   CORE_ADDR vaddr = adi_normalize_address (start);
-  struct cleanup *cleanup;
 
   CORE_ADDR vstart = adi_align_address (vaddr);
   int cnt = adi_convert_byte_count (vaddr, bcnt, vstart);
-  unsigned char *buf = (unsigned char *) xmalloc (cnt);
-  cleanup = make_cleanup (xfree, buf);
-  int read_cnt = adi_read_versions (vstart, cnt, buf);
+  gdb::def_vector<gdb_byte> buf (cnt);
+  int read_cnt = adi_read_versions (vstart, cnt, buf.data ());
   if (read_cnt == -1)
     error (_("No ADI information"));
   else if (read_cnt < cnt)
     error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr));
 
-  adi_print_versions (vstart, cnt, buf);
-
-  do_cleanups (cleanup);
+  adi_print_versions (vstart, cnt, buf.data ());
 }
 
 static void
@@ -456,7 +452,7 @@ do_assign (CORE_ADDR start, size_t bcnt, int version)
      adi (examine|x)/count <addr> */
 
 static void
-adi_examine_command (char *args, int from_tty)
+adi_examine_command (const char *args, int from_tty)
 {
   /* make sure program is active and adi is available */
   if (!target_has_execution)
@@ -468,7 +464,7 @@ adi_examine_command (char *args, int from_tty)
   pid_t pid = ptid_get_pid (inferior_ptid);
   sparc64_adi_info *proc = get_adi_info_proc (pid);
   int cnt = 1;
-  char *p = args;
+  const char *p = args;
   if (p && *p == '/')
     {
       p++;
@@ -491,7 +487,7 @@ adi_examine_command (char *args, int from_tty)
      adi (assign|a)/count <addr> = <version>  */
 
 static void
-adi_assign_command (char *args, int from_tty)
+adi_assign_command (const char *args, int from_tty)
 {
   /* make sure program is active and adi is available */
   if (!target_has_execution)
@@ -500,7 +496,7 @@ adi_assign_command (char *args, int from_tty)
   if (!adi_available ())
     error (_("No ADI information"));
 
-  char *exp = args;
+  const char *exp = args;
   if (exp == 0)
     error_no_arg (_("Usage: adi assign|a[/count] <addr> = <version>"));
 
@@ -511,7 +507,7 @@ adi_assign_command (char *args, int from_tty)
     error (_("Usage: adi assign|a[/count] <addr> = <version>"));
 
   size_t cnt = 1;
-  char *p = args;
+  const char *p = args;
   if (exp && *exp == '/')
     {
       p = exp + 1;
@@ -903,7 +899,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
 
 static enum register_status
 sparc64_pseudo_register_read (struct gdbarch *gdbarch,
-                             struct regcache *regcache,
+                             readable_regcache *regcache,
                              int regnum, gdb_byte *buf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -914,27 +910,27 @@ sparc64_pseudo_register_read (struct gdbarch *gdbarch,
   if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D30_REGNUM)
     {
       regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC64_D0_REGNUM);
-      status = regcache_raw_read (regcache, regnum, buf);
+      status = regcache->raw_read (regnum, buf);
       if (status == REG_VALID)
-       status = regcache_raw_read (regcache, regnum + 1, buf + 4);
+       status = regcache->raw_read (regnum + 1, buf + 4);
       return status;
     }
   else if (regnum >= SPARC64_D32_REGNUM && regnum <= SPARC64_D62_REGNUM)
     {
       regnum = SPARC64_F32_REGNUM + (regnum - SPARC64_D32_REGNUM);
-      return regcache_raw_read (regcache, regnum, buf);
+      return regcache->raw_read (regnum, buf);
     }
   else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q28_REGNUM)
     {
       regnum = SPARC_F0_REGNUM + 4 * (regnum - SPARC64_Q0_REGNUM);
 
-      status = regcache_raw_read (regcache, regnum, buf);
+      status = regcache->raw_read (regnum, buf);
       if (status == REG_VALID)
-       status = regcache_raw_read (regcache, regnum + 1, buf + 4);
+       status = regcache->raw_read (regnum + 1, buf + 4);
       if (status == REG_VALID)
-       status = regcache_raw_read (regcache, regnum + 2, buf + 8);
+       status = regcache->raw_read (regnum + 2, buf + 8);
       if (status == REG_VALID)
-       status = regcache_raw_read (regcache, regnum + 3, buf + 12);
+       status = regcache->raw_read (regnum + 3, buf + 12);
 
       return status;
     }
@@ -942,9 +938,9 @@ sparc64_pseudo_register_read (struct gdbarch *gdbarch,
     {
       regnum = SPARC64_F32_REGNUM + 2 * (regnum - SPARC64_Q32_REGNUM);
 
-      status = regcache_raw_read (regcache, regnum, buf);
+      status = regcache->raw_read (regnum, buf);
       if (status == REG_VALID)
-       status = regcache_raw_read (regcache, regnum + 1, buf + 8);
+       status = regcache->raw_read (regnum + 1, buf + 8);
 
       return status;
     }
@@ -955,7 +951,7 @@ sparc64_pseudo_register_read (struct gdbarch *gdbarch,
     {
       ULONGEST state;
 
-      status = regcache_raw_read_unsigned (regcache, SPARC64_STATE_REGNUM, &state);
+      status = regcache->raw_read (SPARC64_STATE_REGNUM, &state);
       if (status != REG_VALID)
        return status;
 
@@ -1211,7 +1207,7 @@ static void
 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
                               const gdb_byte *valbuf, int element, int bitpos)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int len = TYPE_LENGTH (type);
 
   gdb_assert (element < 16);
@@ -1303,7 +1299,7 @@ static void
 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
                                 gdb_byte *valbuf, int bitpos)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
     {
@@ -1372,7 +1368,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
                         struct value **args, CORE_ADDR sp,
                         int struct_return, CORE_ADDR struct_addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   /* Number of extended words in the "parameter array".  */
   int num_elements = 0;
   int element = 0;
@@ -1883,7 +1879,7 @@ sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
                        struct regcache *regcache,
                        int regnum, const void *gregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
   const gdb_byte *regs = (const gdb_byte *) gregs;
@@ -2000,7 +1996,7 @@ sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
                         const struct regcache *regcache,
                         int regnum, void *gregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
   gdb_byte *regs = (gdb_byte *) gregs;
@@ -2110,7 +2106,7 @@ sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
                         struct regcache *regcache,
                         int regnum, const void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
   const gdb_byte *regs = (const gdb_byte *) fpregs;
   int i;
 
@@ -2148,7 +2144,7 @@ sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
                          const struct regcache *regcache,
                          int regnum, void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
   gdb_byte *regs = (gdb_byte *) fpregs;
   int i;
 
This page took 0.028291 seconds and 4 git commands to generate.