* objdump.c (SFILE): Add size field.
[deliverable/binutils-gdb.git] / gdb / i386aix-nat.c
index 6b4297f9cb462d7d844f72300adcb4279d473e9d..20e656e704caed0c2f688ef8a8c13ee32e8c1cd3 100644 (file)
@@ -15,7 +15,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "frame.h"
@@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <fcntl.h>
 
 #include <sys/file.h>
-#include <sys/stat.h>
+#include "gdb_stat.h"
 
 #include <stddef.h>
 #include <sys/ptrace.h>
@@ -43,15 +43,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Does AIX define this in <errno.h>?  */
 extern int errno;
 
-#ifndef NO_SYS_REG_H
+#ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>
 #endif
 
-#include "ieee-float.h"
+#include "floatformat.h"
 
 #include "target.h"
 
-extern struct ext_format ext_format_i387;
+static void fetch_core_registers PARAMS ((char *, unsigned, int, CORE_ADDR));
+
 \f
 /* this table must line up with REGISTER_NAMES in tm-i386v.h */
 /* symbols like 'EAX' come from <sys/reg.h> */
@@ -127,46 +128,46 @@ print_387_status (status, ep)
   if (status != 0) 
     {
       if (bothstatus)
-       printf ("u: ");
+       printf_unfiltered ("u: ");
       print_387_status_word (status);
     }
   
   if (ep->status != 0) 
     {
       if (bothstatus)
-       printf ("e: ");
+       printf_unfiltered ("e: ");
       print_387_status_word (ep->status);
     }
   
   print_387_control_word (ep->control);
-  printf ("last exception: ");
-  printf ("opcode %s; ", local_hex_string(ep->opcode));
-  printf ("pc %s:", local_hex_string(ep->code_seg));
-  printf ("%s; ", local_hex_string(ep->eip));
-  printf ("operand %s", local_hex_string(ep->operand_seg));
-  printf (":%s\n", local_hex_string(ep->operand));
-  
-  top = 7- ((ep->status >> 11) & 7);
-  
-  printf ("regno  tag  msb              lsb  value\n");
+  printf_unfiltered ("last exception: ");
+  printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode));
+  printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg));
+  printf_unfiltered ("%s; ", local_hex_string(ep->eip));
+  printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg));
+  printf_unfiltered (":%s\n", local_hex_string(ep->operand));
+
+  top = ((ep->status >> 11) & 7);
+
+  printf_unfiltered ("regno  tag  msb              lsb  value\n");
   for (fpreg = 7; fpreg >= 0; fpreg--) 
     {
       double val;
-      
-      printf ("%s %d: ", fpreg == top ? "=>" : "  ", fpreg);
-      
+
+      printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : "  ", fpreg);
+
       switch ((ep->tag >> ((7 - fpreg) * 2)) & 3) 
        {
-       case 0: printf ("valid "); break;
-       case 1: printf ("zero  "); break;
-       case 2: printf ("trap  "); break;
-       case 3: printf ("empty "); break;
+       case 0: printf_unfiltered ("valid "); break;
+       case 1: printf_unfiltered ("zero  "); break;
+       case 2: printf_unfiltered ("trap  "); break;
+       case 3: printf_unfiltered ("empty "); break;
        }
       for (i = 9; i >= 0; i--)
-       printf ("%02x", ep->regs[fpreg][i]);
+       printf_unfiltered ("%02x", ep->regs[fpreg][i]);
       
       i387_to_double ((char *)ep->regs[fpreg], (char *)&val);
-      printf ("  %#g\n", val);
+      printf_unfiltered ("  %#g\n", val);
     }
 }
 
@@ -177,6 +178,10 @@ i386_float_info ()
 {
   struct env387 fps;
   int fpsaved = 0;
+  /* We need to reverse the order of the registers.  Apparently AIX stores
+     the highest-numbered ones first.  */
+  struct env387 fps_fixed;
+  int i;
 
   if (inferior_pid)
     {
@@ -195,7 +200,7 @@ i386_float_info ()
   
   if (fpsaved == 0) 
     {
-      printf ("no floating point status saved\n");
+      printf_unfiltered ("no floating point status saved\n");
       return;
     }
 
@@ -210,8 +215,10 @@ i386_float_info ()
                  MIN(10, sizeof(fps) - offset));
        }
     } 
-
-  print_387_status (0, (struct env387 *)&fps);
+  fps_fixed = fps;
+  for (i = 0; i < 8; ++i)
+    memcpy (fps_fixed.regs[i], fps.regs[7 - i], 10);
+  print_387_status (0, &fps_fixed);
 }
 
 /* Fetch one register.  */
@@ -307,12 +314,12 @@ static int core_regmap[] =
   CD_DS, CD_ES, CD_FS, CD_GS,
 };
 
-void
+static void
 fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
      char *core_reg_sect;
      unsigned core_reg_size;
      int which;
-     unsigned int reg_addr;    /* ignored */
+     CORE_ADDR reg_addr;       /* ignored */
 {
 
   if (which == 0)
@@ -333,6 +340,23 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
       if (core_reg_size >= sizeof (core_env387))
        memcpy (&core_env387, core_reg_sect, core_reg_size);
       else
-       fprintf (stderr, "Couldn't read float regs from core file\n");
+       fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
     }
 }
+
+\f
+/* Register that we are able to handle i386aix core file formats.
+   FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns i386aix_core_fns =
+{
+  bfd_target_unknown_flavour,
+  fetch_core_registers,
+  NULL
+};
+
+void
+_initialize_core_i386aix ()
+{
+  add_core_fns (&i386aix_core_fns);
+}
This page took 0.026249 seconds and 4 git commands to generate.