* exec.c (xfer_memory): Add attrib argument.
[deliverable/binutils-gdb.git] / gdb / procfs.c
index 86f42bf7bafbb0e71cc1699f7948816615977a7d..de863c01e1a821f8c9b3fd26001a20fc45b55fed 100644 (file)
@@ -631,7 +631,7 @@ destroy_one_procinfo (procinfo **list, procinfo *pi)
   close_procinfo_files (pi);
 
   /* Step three: free the memory. */
-  free (pi);
+  xfree (pi);
 }
 
 static void
@@ -2509,8 +2509,7 @@ proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
    It doesn't get called that often... and if I open it
    every time, I don't need to lseek it.  */
 int
-proc_iterate_over_mappings (func)
-     int (*func) (int, CORE_ADDR);
+proc_iterate_over_mappings (int (*func) (int, CORE_ADDR))
 {
   struct prmap *map;
   procinfo *pi;
@@ -2880,7 +2879,7 @@ proc_update_threads (procinfo *pi)
        malloc (sizeof (gdb_prstatus_t) * (nlwp + 1))) == 0)
     perror_with_name ("procfs: malloc failed in update_threads");
 
-  old_chain = make_cleanup (free, prstatus);
+  old_chain = make_cleanup (xfree, prstatus);
   if (ioctl (pi->ctl_fd, PIOCLSTATUS, prstatus) < 0)
     proc_error (pi, "update_threads (PIOCLSTATUS)", __LINE__);
 
@@ -3036,10 +3035,9 @@ proc_update_threads (procinfo *pi)
  */
 
 int
-proc_iterate_over_threads (pi, func, ptr)
-     procinfo *pi;
-     int (*func) (procinfo *, procinfo *, void *);
-     void     *ptr;
+proc_iterate_over_threads (procinfo *pi,
+                          int (*func) (procinfo *, procinfo *, void *),
+                          void *ptr)
 {
   procinfo *thread, *next;
   int retval = 0;
@@ -3899,13 +3897,19 @@ wait_again:
   return retval;
 }
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If DOWRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   The return value is 0 if an error occurred or no bytes were
+   transferred.  Otherwise, it will be a positive value which
+   indicates the number of bytes transferred between gdb and the
+   target.  (Note that the interface also makes provisions for
+   negative values, but this capability isn't implemented here.) */
+
 static int
-procfs_xfer_memory (memaddr, myaddr, len, dowrite, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int dowrite;
-     struct target_ops *target; /* ignored */
+procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+                   struct target_ops *target)
 {
   procinfo *pi;
   int nbytes = 0;
@@ -4789,8 +4793,12 @@ procfs_stopped_by_watchpoint (int pid)
 {
   procinfo *pi;
 
-  pi = find_procinfo_or_die (pid == -1 ? 
-                            PIDGET (inferior_pid) : PIDGET (pid), 0);
+  pi = find_procinfo (pid == -1 ? 
+                     PIDGET (inferior_pid) : PIDGET (pid), 0);
+
+  if (!pi)     /* If no process, then not stopped by watchpoint!  */
+    return 0;
+
   if (proc_flags (pi) & (PR_STOPPED | PR_ISTOP))
     {
       if (proc_why (pi) == PR_FAULTED)
This page took 0.024237 seconds and 4 git commands to generate.