"complete" command and completion word break characters
[deliverable/binutils-gdb.git] / gdb / sh64-tdep.c
index 97e5a587f1eadb533a30ffaf5ec124c040461244..5aeb235b077c29306ad9905f684cde7f2c2f3c8f 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for Renesas Super-H, for GDB.
 
-   Copyright (C) 1993-2016 Free Software Foundation, Inc.
+   Copyright (C) 1993-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -125,7 +125,7 @@ enum
 static const char *
 sh64_register_name (struct gdbarch *gdbarch, int reg_nr)
 {
-  static char *register_names[] =
+  static const char *register_names[] =
   {
     /* SH MEDIA MODE (ISA 32) */
     /* general registers (64-bit) 0-63 */
@@ -306,8 +306,6 @@ sh64_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
     }
 }
 
-GDBARCH_BREAKPOINT_FROM_PC (sh64)
-
 /* Prologue looks like
    [mov.l       <regs>,@-r15]...
    [sts.l       pr,@-r15]
@@ -1530,12 +1528,12 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int base_regnum;
   int offset = 0;
-  gdb_byte temp_buffer[MAX_REGISTER_SIZE];
   enum register_status status;
 
   if (reg_nr >= DR0_REGNUM 
       && reg_nr <= DR_LAST_REGNUM)
     {
+      gdb_byte temp_buffer[8];
       base_regnum = sh64_dr_reg_base_num (gdbarch, reg_nr);
 
       /* Build the value in the provided buffer.  */ 
@@ -1582,6 +1580,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
   else if (reg_nr >= R0_C_REGNUM 
           && reg_nr <= T_C_REGNUM)
     {
+      gdb_byte temp_buffer[8];
       base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
 
       /* Build the value in the provided buffer.  */ 
@@ -1609,6 +1608,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
   else if (reg_nr >= DR0_C_REGNUM 
           && reg_nr <= DR_LAST_C_REGNUM)
     {
+      gdb_byte temp_buffer[8];
       base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
 
       /* DR_C regs are double precision registers obtained by
@@ -1641,8 +1641,8 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
     {
       int fpscr_base_regnum;
       int sr_base_regnum;
-      unsigned int fpscr_value;
-      unsigned int sr_value;
+      ULONGEST fpscr_value;
+      ULONGEST sr_value;
       unsigned int fpscr_c_value;
       unsigned int fpscr_c_part1_value;
       unsigned int fpscr_c_part2_value;
@@ -1664,18 +1664,14 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
             21-31     reserved
        */
       /* *INDENT-ON* */
-      /* Get FPSCR into a local buffer.  */
-      status = regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
+      /* Get FPSCR as an int.  */
+      status = regcache->raw_read (fpscr_base_regnum, &fpscr_value);
       if (status != REG_VALID)
        return status;
-      /* Get value as an int.  */
-      fpscr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
-      /* Get SR into a local buffer */
-      status = regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
+      /* Get SR as an int.  */
+      status = regcache->raw_read (sr_base_regnum, &sr_value);
       if (status != REG_VALID)
        return status;
-      /* Get value as an int.  */
-      sr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
       /* Build the new value.  */
       fpscr_c_part1_value = fpscr_value & 0x3fffd;
       fpscr_c_part2_value = (sr_value & 0x7000) << 6;
@@ -1706,11 +1702,11 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int base_regnum, portion;
   int offset;
-  gdb_byte temp_buffer[MAX_REGISTER_SIZE];
 
   if (reg_nr >= DR0_REGNUM
       && reg_nr <= DR_LAST_REGNUM)
     {
+      gdb_byte temp_buffer[8];
       base_regnum = sh64_dr_reg_base_num (gdbarch, reg_nr);
       /* We must pay attention to the endianness.  */
       sh64_register_convert_to_raw (gdbarch, register_type (gdbarch, reg_nr),
@@ -1754,6 +1750,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
   else if (reg_nr >= R0_C_REGNUM 
           && reg_nr <= T_C_REGNUM)
     {
+      gdb_byte temp_buffer[8];
       base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
       /* reg_nr is 32 bit here, and base_regnum is 64 bits.  */
       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
@@ -1781,6 +1778,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
   else if (reg_nr >= DR0_C_REGNUM 
           && reg_nr <= DR_LAST_C_REGNUM)
     {
+      gdb_byte temp_buffer[8];
       base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
       for (portion = 0; portion < 2; portion++)
        {
@@ -1815,10 +1813,10 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
     {      
       int fpscr_base_regnum;
       int sr_base_regnum;
-      unsigned int fpscr_value;
-      unsigned int sr_value;
-      unsigned int old_fpscr_value;
-      unsigned int old_sr_value;
+      ULONGEST fpscr_value;
+      ULONGEST sr_value;
+      ULONGEST old_fpscr_value;
+      ULONGEST old_sr_value;
       unsigned int fpscr_c_value;
       unsigned int fpscr_mask;
       unsigned int sr_mask;
@@ -1849,19 +1847,15 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
       fpscr_value = fpscr_c_value & fpscr_mask;
       sr_value = (fpscr_value & sr_mask) >> 6;
       
-      regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
-      old_fpscr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
+      regcache->raw_read (fpscr_base_regnum, &old_fpscr_value);
       old_fpscr_value &= 0xfffc0002;
       fpscr_value |= old_fpscr_value;
-      store_unsigned_integer (temp_buffer, 4, byte_order, fpscr_value);
-      regcache_raw_write (regcache, fpscr_base_regnum, temp_buffer);
-      
-      regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
-      old_sr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
+      regcache->raw_write (fpscr_base_regnum, fpscr_value);
+
+      regcache->raw_read (sr_base_regnum, &old_sr_value);
       old_sr_value &= 0xffff8fff;
       sr_value |= old_sr_value;
-      store_unsigned_integer (temp_buffer, 4, byte_order, sr_value);
-      regcache_raw_write (regcache, sr_base_regnum, temp_buffer);
+      regcache->raw_write (sr_base_regnum, sr_value);
     }
 
   else if (reg_nr == FPUL_C_REGNUM)
@@ -1951,7 +1945,7 @@ sh64_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file,
   fprintf_filtered (file, "\t(raw ");
   print_hex_chars (file, raw_buffer,
                   register_size (gdbarch, regnum),
-                  gdbarch_byte_order (gdbarch));
+                  gdbarch_byte_order (gdbarch), true);
   fprintf_filtered (file, ")");
   fprintf_filtered (file, "\n");
 }
@@ -2032,15 +2026,16 @@ static void
 sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
                  struct frame_info *frame, int regnum)
 {
-  unsigned char raw_buffer[MAX_REGISTER_SIZE];
   struct value_print_options opts;
+  struct value *val;
 
   fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
   print_spaces_filtered (15 - strlen (gdbarch_register_name
                                      (gdbarch, regnum)), file);
 
   /* Get the data in raw format.  */
-  if (!deprecated_frame_register_read (frame, regnum, raw_buffer))
+  val = get_frame_register_value (frame, regnum);
+  if (value_optimized_out (val) || !value_entirely_available (val))
     {
       fprintf_filtered (file, "*value not available*\n");
       return;
@@ -2048,13 +2043,15 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
 
   get_formatted_print_options (&opts, 'x');
   opts.deref_ref = 1;
-  val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
-            file, 0, NULL, &opts, current_language);
+  val_print (register_type (gdbarch, regnum),
+            0, 0,
+            file, 0, val, &opts, current_language);
   fprintf_filtered (file, "\t");
   get_formatted_print_options (&opts, 0);
   opts.deref_ref = 1;
-  val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
-            file, 0, NULL, &opts, current_language);
+  val_print (register_type (gdbarch, regnum),
+            0, 0,
+            file, 0, val, &opts, current_language);
   fprintf_filtered (file, "\n");
 }
 
@@ -2370,7 +2367,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* None found, create a new architecture from the information
      provided.  */
-  tdep = XNEW (struct gdbarch_tdep);
+  tdep = XCNEW (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
   /* Determine the ABI */
@@ -2413,9 +2410,8 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read);
   set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write);
 
-  SET_GDBARCH_BREAKPOINT_MANIPULATION (sh64);
-
-  set_gdbarch_print_insn (gdbarch, print_insn_sh);
+  set_gdbarch_breakpoint_kind_from_pc (gdbarch, sh64_breakpoint_kind_from_pc);
+  set_gdbarch_sw_breakpoint_from_kind (gdbarch, sh64_sw_breakpoint_from_kind);
   set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
 
   set_gdbarch_return_value (gdbarch, sh64_return_value);
This page took 0.028185 seconds and 4 git commands to generate.