testsuite/ChangeLog
[deliverable/binutils-gdb.git] / gdb / procfs.c
index 37074b2aac322a598c67c1bf4e4010705dae6935..b569bac86f9acca2ae133489d74100e897810f55 100644 (file)
@@ -162,6 +162,7 @@ static int
 procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
                   gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
 {
+  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
   gdb_byte *ptr = *readptr;
 
   if (endptr == ptr)
@@ -170,11 +171,11 @@ procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
   if (endptr - ptr < 8 * 2)
     return -1;
 
-  *typep = extract_unsigned_integer (ptr, 4);
+  *typep = extract_unsigned_integer (ptr, 4, byte_order);
   ptr += 8;
   /* The size of data is always 64-bit.  If the application is 32-bit,
      it will be zero extended, as expected.  */
-  *valp = extract_unsigned_integer (ptr, 8);
+  *valp = extract_unsigned_integer (ptr, 8, byte_order);
   ptr += 8;
 
   *readptr = ptr;
@@ -2504,7 +2505,7 @@ proc_set_current_signal (procinfo *pi, int signo)
     /* Use char array to avoid alignment issues.  */
     char sinfo[sizeof (gdb_siginfo_t)];
   } arg;
-  gdb_siginfo_t *mysinfo;
+  gdb_siginfo_t mysinfo;
   ptid_t wait_ptid;
   struct target_waitstatus wait_status;
 
@@ -2529,7 +2530,6 @@ proc_set_current_signal (procinfo *pi, int signo)
 #endif
 
   /* The pointer is just a type alias.  */
-  mysinfo = (gdb_siginfo_t *) &arg.sinfo;
   get_last_target_status (&wait_ptid, &wait_status);
   if (ptid_equal (wait_ptid, inferior_ptid)
       && wait_status.kind == TARGET_WAITKIND_STOPPED
@@ -2544,16 +2544,17 @@ proc_set_current_signal (procinfo *pi, int signo)
     /* Use the siginfo associated with the signal being
        redelivered.  */
 #ifdef NEW_PROC_API
-    memcpy (mysinfo, &pi->prstatus.pr_lwp.pr_info, sizeof (gdb_siginfo_t));
+    memcpy (arg.sinfo, &pi->prstatus.pr_lwp.pr_info, sizeof (gdb_siginfo_t));
 #else
-    memcpy (mysinfo, &pi->prstatus.pr_info, sizeof (gdb_siginfo_t));
+    memcpy (arg.sinfo, &pi->prstatus.pr_info, sizeof (gdb_siginfo_t));
 #endif
   else
     {
-      mysinfo->si_signo = signo;
-      mysinfo->si_code  = 0;
-      mysinfo->si_pid   = getpid ();       /* ?why? */
-      mysinfo->si_uid   = getuid ();       /* ?why? */
+      mysinfo.si_signo = signo;
+      mysinfo.si_code  = 0;
+      mysinfo.si_pid   = getpid ();       /* ?why? */
+      mysinfo.si_uid   = getuid ();       /* ?why? */
+      memcpy (arg.sinfo, &mysinfo, sizeof (gdb_siginfo_t));
     }
 
 #ifdef NEW_PROC_API
@@ -2596,16 +2597,16 @@ proc_clear_current_signal (procinfo *pi)
       /* Use char array to avoid alignment issues.  */
       char sinfo[sizeof (gdb_siginfo_t)];
     } arg;
-    gdb_siginfo_t *mysinfo;
+    gdb_siginfo_t mysinfo;
 
     arg.cmd = PCSSIG;
     /* The pointer is just a type alias.  */
-    mysinfo = (gdb_siginfo_t *) &arg.sinfo;
-    mysinfo->si_signo = 0;
-    mysinfo->si_code  = 0;
-    mysinfo->si_errno = 0;
-    mysinfo->si_pid   = getpid ();       /* ?why? */
-    mysinfo->si_uid   = getuid ();       /* ?why? */
+    mysinfo.si_signo = 0;
+    mysinfo.si_code  = 0;
+    mysinfo.si_errno = 0;
+    mysinfo.si_pid   = getpid ();       /* ?why? */
+    mysinfo.si_uid   = getuid ();       /* ?why? */
+    memcpy (arg.sinfo, &mysinfo, sizeof (gdb_siginfo_t));
 
     win = (write (pi->ctl_fd, (void *) &arg, sizeof (arg)) == sizeof (arg));
   }
@@ -2916,25 +2917,25 @@ proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
     procfs_ctl_t cmd;
     char watch[sizeof (prwatch_t)];
   } arg;
-  prwatch_t *pwatch;
+  prwatch_t pwatch;
 
-  pwatch            = (prwatch_t *) &arg.watch;
   /* NOTE: cagney/2003-02-01: Even more horrible hack.  Need to
      convert a target address into something that can be stored in a
      native data structure.  */
 #ifdef PCAGENT /* Horrible hack: only defined on Solaris 2.6+ */
-  pwatch->pr_vaddr  = (uintptr_t) procfs_address_to_host_pointer (addr);
+  pwatch.pr_vaddr  = (uintptr_t) procfs_address_to_host_pointer (addr);
 #else
-  pwatch->pr_vaddr  = (caddr_t) procfs_address_to_host_pointer (addr);
+  pwatch.pr_vaddr  = (caddr_t) procfs_address_to_host_pointer (addr);
 #endif
-  pwatch->pr_size   = len;
-  pwatch->pr_wflags = wflags;
+  pwatch.pr_size   = len;
+  pwatch.pr_wflags = wflags;
 #if defined(NEW_PROC_API) && defined (PCWATCH)
   arg.cmd = PCWATCH;
+  memcpy (arg.watch, &pwatch, sizeof (prwatch_t));
   return (write (pi->ctl_fd, &arg, sizeof (arg)) == sizeof (arg));
 #else
 #if defined (PIOCSWATCH)
-  return (ioctl (pi->ctl_fd, PIOCSWATCH, pwatch) >= 0);
+  return (ioctl (pi->ctl_fd, PIOCSWATCH, &pwatch) >= 0);
 #else
   return 0;    /* Fail */
 #endif
@@ -4473,7 +4474,7 @@ invalidate_cache (procinfo *parent, procinfo *pi, void *ptr)
       if (!proc_set_gregs (pi))        /* flush gregs cache */
        proc_warn (pi, "target_resume, set_gregs",
                   __LINE__);
-  if (gdbarch_fp0_regnum (current_gdbarch) >= 0)
+  if (gdbarch_fp0_regnum (target_gdbarch) >= 0)
     if (pi->fpregs_dirty)
       if (parent == NULL ||
          proc_get_current_thread (parent) != pi->tid)
@@ -4803,7 +4804,7 @@ procfs_mourn_inferior (struct target_ops *ops)
 
   if (dbx_link_bpt != NULL)
     {
-      deprecated_remove_raw_breakpoint (dbx_link_bpt);
+      deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt);
       dbx_link_bpt_addr = 0;
       dbx_link_bpt = NULL;
     }
@@ -5352,7 +5353,7 @@ static int
 procfs_insert_watchpoint (CORE_ADDR addr, int len, int type)
 {
   if (!target_have_steppable_watchpoint
-      && !gdbarch_have_nonsteppable_watchpoint (current_gdbarch))
+      && !gdbarch_have_nonsteppable_watchpoint (target_gdbarch))
     {
       /* When a hardware watchpoint fires off the PC will be left at
         the instruction following the one which caused the
@@ -5592,7 +5593,7 @@ remove_dbx_link_breakpoint (void)
   if (dbx_link_bpt_addr == 0)
     return;
 
-  if (deprecated_remove_raw_breakpoint (dbx_link_bpt) != 0)
+  if (deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt) != 0)
     warning (_("Unable to remove __dbx_link breakpoint."));
 
   dbx_link_bpt_addr = 0;
@@ -5664,7 +5665,8 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
     {
       /* Insert the breakpoint.  */
       dbx_link_bpt_addr = sym_addr;
-      dbx_link_bpt = deprecated_insert_raw_breakpoint (sym_addr);
+      dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch,
+                                                      sym_addr);
       if (dbx_link_bpt == NULL)
         {
           warning (_("Failed to insert dbx_link breakpoint."));
@@ -5756,7 +5758,7 @@ info_mappings_callback (struct prmap *map, int (*ignore) (), void *unused)
   pr_off = map->pr_off;
 #endif
 
-  if (gdbarch_addr_bit (current_gdbarch) == 32)
+  if (gdbarch_addr_bit (target_gdbarch) == 32)
     printf_filtered ("\t%#10lx %#10lx %#10lx %#10x %7s\n",
                     (unsigned long) map->pr_vaddr,
                     (unsigned long) map->pr_vaddr + map->pr_size - 1,
@@ -5787,7 +5789,7 @@ info_proc_mappings (procinfo *pi, int summary)
     return;    /* No output for summary mode. */
 
   printf_filtered (_("Mapped address spaces:\n\n"));
-  if (gdbarch_ptr_bit (current_gdbarch) == 32)
+  if (gdbarch_ptr_bit (target_gdbarch) == 32)
     printf_filtered ("\t%10s %10s %10s %10s %7s\n",
                     "Start Addr",
                     "  End Addr",
This page took 0.028408 seconds and 4 git commands to generate.