2002-08-20 Michael Snyder <msnyder@redhat.com>
[deliverable/binutils-gdb.git] / gdb / hppah-nat.c
index 03157ed2ecab04cb7b479b87a117122c4a3c251f..aab5e96ccf3b478c9c31b736dee03879ee309f7e 100644 (file)
@@ -1,5 +1,6 @@
 /* Native support code for HPUX PA-RISC.
 /* Native support code for HPUX PA-RISC.
-   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1998, 1999
+   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1998, 1999, 2000, 2001
    Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
 #include "target.h"
 #include <sys/ptrace.h>
 #include "gdbcore.h"
 #include "target.h"
 #include <sys/ptrace.h>
 #include "gdbcore.h"
-#include <wait.h>
+#include "gdb_wait.h"
+#include "regcache.h"
 #include <signal.h>
 
 extern CORE_ADDR text_end;
 
 #include <signal.h>
 
 extern CORE_ADDR text_end;
 
-static void fetch_register PARAMS ((int));
+static void fetch_register (int);
 
 void
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno == -1)
     for (regno = 0; regno < NUM_REGS; regno++)
 {
   if (regno == -1)
     for (regno = 0; regno < NUM_REGS; regno++)
@@ -54,8 +55,7 @@ fetch_inferior_registers (regno)
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
 {
   register unsigned int regaddr;
   char buf[80];
@@ -108,7 +108,8 @@ store_inferior_registers (regno)
        addr = (HPPAH_OFFSETOF (save_state_t, ss_narrow)
                + (REGISTER_BYTE (regno) - REGISTER_BYTE (1)));
       else
        addr = (HPPAH_OFFSETOF (save_state_t, ss_narrow)
                + (REGISTER_BYTE (regno) - REGISTER_BYTE (1)));
       else
-       internal_error ("hppah-nat.c (write_register): unexpected register size");
+       internal_error (__FILE__, __LINE__,
+                       "hppah-nat.c (write_register): unexpected register size");
 
 #ifdef GDB_TARGET_IS_HPPA_20W
       /* Unbelieveable.  The PC head and tail must be written in 64bit hunks
 
 #ifdef GDB_TARGET_IS_HPPA_20W
       /* Unbelieveable.  The PC head and tail must be written in 64bit hunks
@@ -125,7 +126,8 @@ store_inferior_registers (regno)
          /* Set the priv level (stored in the low two bits of the PC.  */
          temp |= 0x3;
 
          /* Set the priv level (stored in the low two bits of the PC.  */
          temp |= 0x3;
 
-         ttrace_write_reg_64 (inferior_pid, (CORE_ADDR)addr, (CORE_ADDR)&temp);
+         ttrace_write_reg_64 (PIDGET (inferior_ptid), (CORE_ADDR)addr,
+                              (CORE_ADDR)&temp);
 
          /* If we fail to write the PC, give a true error instead of
             just a warning.  */
 
          /* If we fail to write the PC, give a true error instead of
             just a warning.  */
@@ -150,7 +152,8 @@ store_inferior_registers (regno)
       for (i = 0; i < len; i += sizeof (int))
        {
          errno = 0;
       for (i = 0; i < len; i += sizeof (int))
        {
          errno = 0;
-         call_ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) addr + i,
+         call_ptrace (PT_WUREGS, PIDGET (inferior_ptid),
+                      (PTRACE_ARG3_TYPE) addr + i,
                       *(int *) &registers[REGISTER_BYTE (regno) + i]);
          if (errno != 0)
            {
                       *(int *) &registers[REGISTER_BYTE (regno) + i]);
          if (errno != 0)
            {
@@ -178,8 +181,7 @@ store_inferior_registers (regno)
 
 /* Fetch a register's value from the process's U area.  */
 static void
 
 /* Fetch a register's value from the process's U area.  */
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   char buf[MAX_REGISTER_RAW_SIZE];
   unsigned int addr, len, offset;
 {
   char buf[MAX_REGISTER_RAW_SIZE];
   unsigned int addr, len, offset;
@@ -225,7 +227,8 @@ fetch_register (regno)
            + (REGISTER_BYTE (regno) - REGISTER_BYTE (1)));
 
   else
            + (REGISTER_BYTE (regno) - REGISTER_BYTE (1)));
 
   else
-    internal_error ("hppa-nat.c (fetch_register): unexpected register size");
+    internal_error (__FILE__, __LINE__,
+                   "hppa-nat.c (fetch_register): unexpected register size");
 
   for (i = 0; i < len; i += sizeof (int))
     {
 
   for (i = 0; i < len; i += sizeof (int))
     {
@@ -233,7 +236,7 @@ fetch_register (regno)
       /* Copy an int from the U area to buf.  Fill the least
          significant end if len != raw_size.  */
       * (int *) &buf[offset + i] =
       /* Copy an int from the U area to buf.  Fill the least
          significant end if len != raw_size.  */
       * (int *) &buf[offset + i] =
-         call_ptrace (PT_RUREGS, inferior_pid,
+         call_ptrace (PT_RUREGS, PIDGET (inferior_ptid),
                       (PTRACE_ARG3_TYPE) addr + i, 0);
       if (errno != 0)
        {
                       (PTRACE_ARG3_TYPE) addr + i, 0);
       if (errno != 0)
        {
@@ -265,15 +268,12 @@ fetch_register (regno)
    Returns the length copied, which is either the LEN argument or zero.
    This xfer function does not do partial moves, since child_ops
    doesn't allow memory operations to cross below us in the target stack
    Returns the length copied, which is either the LEN argument or zero.
    This xfer function does not do partial moves, since child_ops
    doesn't allow memory operations to cross below us in the target stack
-   anyway.  */
+   anyway.  TARGET is ignored.  */
 
 int
 
 int
-child_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;        /* ignored */
+child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+                  struct mem_attrib *mem,
+                  struct target_ops *target)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -299,14 +299,15 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
        {
          /* Need part of initial word -- fetch it.  */
          buffer[0] = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
        {
          /* Need part of initial word -- fetch it.  */
          buffer[0] = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
-                                  inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
+                                  PIDGET (inferior_ptid),
+                                  (PTRACE_ARG3_TYPE) addr, 0);
        }
 
       if (count > 1)           /* FIXME, avoid if even boundary */
        {
          buffer[count - 1]
            = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
        }
 
       if (count > 1)           /* FIXME, avoid if even boundary */
        {
          buffer[count - 1]
            = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
-                          inferior_pid,
+                          PIDGET (inferior_ptid),
                           (PTRACE_ARG3_TYPE) (addr
                                               + (count - 1) * sizeof (int)),
                           0);
                           (PTRACE_ARG3_TYPE) (addr
                                               + (count - 1) * sizeof (int)),
                           0);
@@ -328,7 +329,7 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
          errno = 0;
          pt_request = (addr < text_end) ? PT_WIUSER : PT_WDUSER;
          pt_status = call_ptrace (pt_request,
          errno = 0;
          pt_request = (addr < text_end) ? PT_WIUSER : PT_WDUSER;
          pt_status = call_ptrace (pt_request,
-                                  inferior_pid,
+                                  PIDGET (inferior_ptid),
                                   (PTRACE_ARG3_TYPE) addr,
                                   buffer[i]);
 
                                   (PTRACE_ARG3_TYPE) addr,
                                   buffer[i]);
 
@@ -340,14 +341,14 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
              errno = 0;
              pt_request = (pt_request == PT_WIUSER) ? PT_WDUSER : PT_WIUSER;
              pt_status = call_ptrace (pt_request,
              errno = 0;
              pt_request = (pt_request == PT_WIUSER) ? PT_WDUSER : PT_WIUSER;
              pt_status = call_ptrace (pt_request,
-                                      inferior_pid,
+                                      PIDGET (inferior_ptid),
                                       (PTRACE_ARG3_TYPE) addr,
                                       buffer[i]);
 
              /* No, we still fail.  Okay, time to punt. */
              if ((pt_status == -1) && errno)
                {
                                       (PTRACE_ARG3_TYPE) addr,
                                       buffer[i]);
 
              /* No, we still fail.  Okay, time to punt. */
              if ((pt_status == -1) && errno)
                {
-                 free (buffer);
+                 xfree (buffer);
                  return 0;
                }
            }
                  return 0;
                }
            }
@@ -360,10 +361,11 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
        {
          errno = 0;
          buffer[i] = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
        {
          errno = 0;
          buffer[i] = call_ptrace (addr < text_end ? PT_RIUSER : PT_RDUSER,
-                                  inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
+                                  PIDGET (inferior_ptid),
+                                  (PTRACE_ARG3_TYPE) addr, 0);
          if (errno)
            {
          if (errno)
            {
-             free (buffer);
+             xfree (buffer);
              return 0;
            }
          QUIT;
              return 0;
            }
          QUIT;
@@ -372,13 +374,13 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
       /* Copy appropriate bytes out of the buffer.  */
       memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
     }
       /* Copy appropriate bytes out of the buffer.  */
       memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
     }
-  free (buffer);
+  xfree (buffer);
   return len;
 }
 
 
 void
   return len;
 }
 
 
 void
-child_post_follow_inferior_by_clone ()
+child_post_follow_inferior_by_clone (void)
 {
   int status;
 
 {
   int status;
 
@@ -391,16 +393,13 @@ child_post_follow_inferior_by_clone ()
      At this point, the clone has attached to the child.  Because of
      the SIGSTOP, we must now deliver a SIGCONT to the child, or it
      won't behave properly. */
      At this point, the clone has attached to the child.  Because of
      the SIGSTOP, we must now deliver a SIGCONT to the child, or it
      won't behave properly. */
-  status = kill (inferior_pid, SIGCONT);
+  status = kill (PIDGET (inferior_ptid), SIGCONT);
 }
 
 
 void
 }
 
 
 void
-child_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child)
-     int parent_pid;
-     int followed_parent;
-     int child_pid;
-     int followed_child;
+child_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
+                        int followed_child)
 {
   /* Are we a debugger that followed the parent of a vfork?  If so,
      then recall that the child's vfork event was delivered to us
 {
   /* Are we a debugger that followed the parent of a vfork?  If so,
      then recall that the child's vfork event was delivered to us
@@ -438,14 +437,14 @@ child_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child)
 /* Format a process id, given PID.  Be sure to terminate
    this with a null--it's going to be printed via a "%s".  */
 char *
 /* Format a process id, given PID.  Be sure to terminate
    this with a null--it's going to be printed via a "%s".  */
 char *
-hppa_pid_to_str (pid)
-     pid_t pid;
+child_pid_to_str (ptid_t ptid)
 {
   /* Static because address returned */
   static char buf[30];
 {
   /* Static because address returned */
   static char buf[30];
+  pid_t pid = PIDGET (ptid);
 
 
-  /* Extra NULLs for paranoia's sake */
-  sprintf (buf, "process %d\0\0\0\0", pid);
+  /* Extra NUL for paranoia's sake */
+  sprintf (buf, "process %d%c", pid, '\0');
 
   return buf;
 }
 
   return buf;
 }
@@ -456,14 +455,16 @@ hppa_pid_to_str (pid)
    Note: This is a core-gdb tid, not the actual system tid.
    See infttrace.c for details.  */
 char *
    Note: This is a core-gdb tid, not the actual system tid.
    See infttrace.c for details.  */
 char *
-hppa_tid_to_str (tid)
-     pid_t tid;
+hppa_tid_to_str (ptid_t ptid)
 {
   /* Static because address returned */
   static char buf[30];
 {
   /* Static because address returned */
   static char buf[30];
+  /* This seems strange, but when I did the ptid conversion, it looked
+     as though a pid was always being passed.  - Kevin Buettner  */
+  pid_t tid = PIDGET (ptid);
 
   /* Extra NULLs for paranoia's sake */
 
   /* Extra NULLs for paranoia's sake */
-  sprintf (buf, "system thread %d\0\0\0\0", tid);
+  sprintf (buf, "system thread %d%c", tid, '\0');
 
   return buf;
 }
 
   return buf;
 }
@@ -492,7 +493,7 @@ startup_semaphore_t;
 
 static startup_semaphore_t startup_semaphore;
 
 
 static startup_semaphore_t startup_semaphore;
 
-extern int parent_attach_all PARAMS ((int, PTRACE_ARG3_TYPE, int));
+extern int parent_attach_all (int, PTRACE_ARG3_TYPE, int);
 
 #ifdef PT_SETTRC
 /* This function causes the caller's process to be traced by its
 
 #ifdef PT_SETTRC
 /* This function causes the caller's process to be traced by its
@@ -515,10 +516,7 @@ extern int parent_attach_all PARAMS ((int, PTRACE_ARG3_TYPE, int));
    child_acknowledge_created_inferior.)  */
 
 int
    child_acknowledge_created_inferior.)  */
 
 int
-parent_attach_all (pid, addr, data)
-     int pid;
-     PTRACE_ARG3_TYPE addr;
-     int data;
+parent_attach_all (int pid, PTRACE_ARG3_TYPE addr, int data)
 {
   int pt_status = 0;
 
 {
   int pt_status = 0;
 
@@ -555,8 +553,7 @@ parent_attach_all (pid, addr, data)
 #endif
 
 int
 #endif
 
 int
-hppa_require_attach (pid)
-     int pid;
+hppa_require_attach (int pid)
 {
   int pt_status;
   CORE_ADDR pc;
 {
   int pt_status;
   CORE_ADDR pc;
@@ -589,9 +586,7 @@ hppa_require_attach (pid)
 }
 
 int
 }
 
 int
-hppa_require_detach (pid, signal)
-     int pid;
-     int signal;
+hppa_require_detach (int pid, int signal)
 {
   errno = 0;
   call_ptrace (PT_DETACH, pid, (PTRACE_ARG3_TYPE) 1, signal);
 {
   errno = 0;
   call_ptrace (PT_DETACH, pid, (PTRACE_ARG3_TYPE) 1, signal);
@@ -604,61 +599,45 @@ hppa_require_detach (pid, signal)
    dummy versions, which perform no useful work.  */
 
 void
    dummy versions, which perform no useful work.  */
 
 void
-hppa_enable_page_protection_events (pid)
-     int pid;
+hppa_enable_page_protection_events (int pid)
 {
 }
 
 void
 {
 }
 
 void
-hppa_disable_page_protection_events (pid)
-     int pid;
+hppa_disable_page_protection_events (int pid)
 {
 }
 
 int
 {
 }
 
 int
-hppa_insert_hw_watchpoint (pid, start, len, type)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
-     int type;
+hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 int
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 int
-hppa_remove_hw_watchpoint (pid, start, len, type)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
-     enum bptype type;
+hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
+                          enum bptype type)
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 int
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 int
-hppa_can_use_hw_watchpoint (type, cnt, ot)
-     enum bptype type;
-     int cnt;
-     enum bptype ot;
+hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot)
 {
   return 0;
 }
 
 int
 {
   return 0;
 }
 
 int
-hppa_range_profitable_for_hw_watchpoint (pid, start, len)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
+hppa_range_profitable_for_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len)
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 char *
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 char *
-hppa_pid_or_tid_to_str (id)
-     pid_t id;
+hppa_pid_or_tid_to_str (ptid_t id)
 {
   /* In the ptrace world, there are only processes. */
 {
   /* In the ptrace world, there are only processes. */
-  return hppa_pid_to_str (id);
+  return child_pid_to_str (id);
 }
 
 /* This function has no meaning in a non-threaded world.  Thus, we
 }
 
 /* This function has no meaning in a non-threaded world.  Thus, we
@@ -666,15 +645,13 @@ hppa_pid_or_tid_to_str (id)
    hppa-tdep.c. */
 
 pid_t
    hppa-tdep.c. */
 
 pid_t
-hppa_switched_threads (pid)
-     pid_t pid;
+hppa_switched_threads (pid_t pid)
 {
   return (pid_t) 0;
 }
 
 void
 {
   return (pid_t) 0;
 }
 
 void
-hppa_ensure_vforking_parent_remains_stopped (pid)
-     int pid;
+hppa_ensure_vforking_parent_remains_stopped (int pid)
 {
   /* This assumes that the vforked parent is presently stopped, and
      that the vforked child has just delivered its first exec event.
 {
   /* This assumes that the vforked parent is presently stopped, and
      that the vforked child has just delivered its first exec event.
@@ -686,18 +663,19 @@ hppa_ensure_vforking_parent_remains_stopped (pid)
 }
 
 int
 }
 
 int
-hppa_resume_execd_vforking_child_to_get_parent_vfork ()
+hppa_resume_execd_vforking_child_to_get_parent_vfork (void)
 {
   return 1;                    /* Yes, the child must be resumed. */
 }
 
 void
 {
   return 1;                    /* Yes, the child must be resumed. */
 }
 
 void
-require_notification_of_events (pid)
-     int pid;
+require_notification_of_events (int pid)
 {
 #if defined(PT_SET_EVENT_MASK)
   int pt_status;
   ptrace_event_t ptrace_events;
 {
 #if defined(PT_SET_EVENT_MASK)
   int pt_status;
   ptrace_event_t ptrace_events;
+  int nsigs;
+  int signum;
 
   /* Instruct the kernel as to the set of events we wish to be
      informed of.  (This support does not exist before HPUX 10.0.
 
   /* Instruct the kernel as to the set of events we wish to be
      informed of.  (This support does not exist before HPUX 10.0.
@@ -709,7 +687,29 @@ require_notification_of_events (pid)
      the kernel to keep certain signals hidden from us, we do it
      by calling sigdelset (ptrace_events.pe_signals, signal) for
      each such signal here, before doing PT_SET_EVENT_MASK.  */
      the kernel to keep certain signals hidden from us, we do it
      by calling sigdelset (ptrace_events.pe_signals, signal) for
      each such signal here, before doing PT_SET_EVENT_MASK.  */
-  sigemptyset (&ptrace_events.pe_signals);
+  /* RM: The above comment is no longer true. We start with ignoring
+     all signals, and then add the ones we are interested in. We could
+     do it the other way: start by looking at all signals and then
+     deleting the ones that we aren't interested in, except that
+     multiple gdb signals may be mapped to the same host signal
+     (eg. TARGET_SIGNAL_IO and TARGET_SIGNAL_POLL both get mapped to
+     signal 22 on HPUX 10.20) We want to be notified if we are
+     interested in either signal.  */
+  sigfillset (&ptrace_events.pe_signals);
+
+  /* RM: Let's not bother with signals we don't care about */
+  nsigs = (int) TARGET_SIGNAL_LAST;
+  for (signum = nsigs; signum > 0; signum--)
+    {
+      if ((signal_stop_state (signum)) ||
+         (signal_print_state (signum)) ||
+         (!signal_pass_state (signum)))
+       {
+         if (target_signal_to_host_p (signum))
+           sigdelset (&ptrace_events.pe_signals,
+                      target_signal_to_host (signum));
+       }
+    }
 
   ptrace_events.pe_set_event = 0;
 
 
   ptrace_events.pe_set_event = 0;
 
@@ -734,8 +734,7 @@ require_notification_of_events (pid)
 }
 
 void
 }
 
 void
-require_notification_of_exec_events (pid)
-     int pid;
+require_notification_of_exec_events (int pid)
 {
 #if defined(PT_SET_EVENT_MASK)
   int pt_status;
 {
 #if defined(PT_SET_EVENT_MASK)
   int pt_status;
@@ -776,8 +775,7 @@ require_notification_of_exec_events (pid)
    ID of the child process, after the debugger has forked.  */
 
 void
    ID of the child process, after the debugger has forked.  */
 
 void
-child_acknowledge_created_inferior (pid)
-     int pid;
+child_acknowledge_created_inferior (int pid)
 {
   /* We need a memory home for a constant.  */
   int tc_magic_parent = PT_VERSION;
 {
   /* We need a memory home for a constant.  */
   int tc_magic_parent = PT_VERSION;
@@ -824,22 +822,19 @@ child_acknowledge_created_inferior (pid)
 }
 
 void
 }
 
 void
-child_post_startup_inferior (pid)
-     int pid;
+child_post_startup_inferior (ptid_t ptid)
 {
 {
-  require_notification_of_events (pid);
+  require_notification_of_events (PIDGET (ptid));
 }
 
 void
 }
 
 void
-child_post_attach (pid)
-     int pid;
+child_post_attach (int pid)
 {
   require_notification_of_events (pid);
 }
 
 int
 {
   require_notification_of_events (pid);
 }
 
 int
-child_insert_fork_catchpoint (pid)
-     int pid;
+child_insert_fork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -853,8 +848,7 @@ child_insert_fork_catchpoint (pid)
 }
 
 int
 }
 
 int
-child_remove_fork_catchpoint (pid)
-     int pid;
+child_remove_fork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -868,8 +862,7 @@ child_remove_fork_catchpoint (pid)
 }
 
 int
 }
 
 int
-child_insert_vfork_catchpoint (pid)
-     int pid;
+child_insert_vfork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -883,8 +876,7 @@ child_insert_vfork_catchpoint (pid)
 }
 
 int
 }
 
 int
-child_remove_vfork_catchpoint (pid)
-     int pid;
+child_remove_vfork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -898,9 +890,7 @@ child_remove_vfork_catchpoint (pid)
 }
 
 int
 }
 
 int
-child_has_forked (pid, childpid)
-     int pid;
-     int *childpid;
+child_has_forked (int pid, int *childpid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
@@ -931,9 +921,7 @@ child_has_forked (pid, childpid)
 }
 
 int
 }
 
 int
-child_has_vforked (pid, childpid)
-     int pid;
-     int *childpid;
+child_has_vforked (int pid, int *childpid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
@@ -965,15 +953,14 @@ child_has_vforked (pid, childpid)
 }
 
 int
 }
 
 int
-child_can_follow_vfork_prior_to_exec ()
+child_can_follow_vfork_prior_to_exec (void)
 {
   /* ptrace doesn't allow this. */
   return 0;
 }
 
 int
 {
   /* ptrace doesn't allow this. */
   return 0;
 }
 
 int
-child_insert_exec_catchpoint (pid)
-     int pid;
+child_insert_exec_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.   */
 #if !defined(PT_SET_EVENT_MASK)
 {
   /* This request is only available on HPUX 10.0 and later.   */
 #if !defined(PT_SET_EVENT_MASK)
@@ -988,8 +975,7 @@ child_insert_exec_catchpoint (pid)
 }
 
 int
 }
 
 int
-child_remove_exec_catchpoint (pid)
-     int pid;
+child_remove_exec_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -1004,9 +990,7 @@ child_remove_exec_catchpoint (pid)
 }
 
 int
 }
 
 int
-child_has_execd (pid, execd_pathname)
-     int pid;
-     char **execd_pathname;
+child_has_execd (int pid, char **execd_pathname)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
@@ -1039,16 +1023,13 @@ child_has_execd (pid, execd_pathname)
 }
 
 int
 }
 
 int
-child_reported_exec_events_per_exec_call ()
+child_reported_exec_events_per_exec_call (void)
 {
   return 2;                    /* ptrace reports the event twice per call. */
 }
 
 int
 {
   return 2;                    /* ptrace reports the event twice per call. */
 }
 
 int
-child_has_syscall_event (pid, kind, syscall_id)
-     int pid;
-     enum target_waitkind *kind;
-     int *syscall_id;
+child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
 {
   /* This request is only available on HPUX 10.30 and later, via
      the ttrace interface.  */
 {
   /* This request is only available on HPUX 10.30 and later, via
      the ttrace interface.  */
@@ -1059,8 +1040,7 @@ child_has_syscall_event (pid, kind, syscall_id)
 }
 
 char *
 }
 
 char *
-child_pid_to_exec_file (pid)
-     int pid;
+child_pid_to_exec_file (int pid)
 {
   static char exec_file_buffer[1024];
   int pt_status;
 {
   static char exec_file_buffer[1024];
   int pt_status;
@@ -1068,7 +1048,7 @@ child_pid_to_exec_file (pid)
   char four_chars[4];
   int name_index;
   int i;
   char four_chars[4];
   int name_index;
   int i;
-  int saved_inferior_pid;
+  ptid_t saved_inferior_ptid;
   boolean done;
 
 #ifdef PT_GET_PROCESS_PATHNAME
   boolean done;
 
 #ifdef PT_GET_PROCESS_PATHNAME
@@ -1090,19 +1070,19 @@ child_pid_to_exec_file (pid)
   name_index = 0;
   done = 0;
 
   name_index = 0;
   done = 0;
 
-  /* On the chance that pid != inferior_pid, set inferior_pid
-     to pid, so that (grrrr!) implicit uses of inferior_pid get
+  /* On the chance that pid != inferior_ptid, set inferior_ptid
+     to pid, so that (grrrr!) implicit uses of inferior_ptid get
      the right id.  */
 
      the right id.  */
 
-  saved_inferior_pid = inferior_pid;
-  inferior_pid = pid;
+  saved_inferior_ptid = inferior_ptid;
+  inferior_ptid = pid_to_ptid (pid);
 
   /* Try to grab a null-terminated string. */
   while (!done)
     {
       if (target_read_memory (top_of_stack, four_chars, 4) != 0)
        {
 
   /* Try to grab a null-terminated string. */
   while (!done)
     {
       if (target_read_memory (top_of_stack, four_chars, 4) != 0)
        {
-         inferior_pid = saved_inferior_pid;
+         inferior_ptid = saved_inferior_ptid;
          return NULL;
        }
       for (i = 0; i < 4; i++)
          return NULL;
        }
       for (i = 0; i < 4; i++)
@@ -1117,16 +1097,16 @@ child_pid_to_exec_file (pid)
 
   if (exec_file_buffer[0] == '\0')
     {
 
   if (exec_file_buffer[0] == '\0')
     {
-      inferior_pid = saved_inferior_pid;
+      inferior_ptid = saved_inferior_ptid;
       return NULL;
     }
 
       return NULL;
     }
 
-  inferior_pid = saved_inferior_pid;
+  inferior_ptid = saved_inferior_ptid;
   return exec_file_buffer;
 }
 
 void
   return exec_file_buffer;
 }
 
 void
-pre_fork_inferior ()
+pre_fork_inferior (void)
 {
   int status;
 
 {
   int status;
 
@@ -1152,8 +1132,7 @@ pre_fork_inferior ()
    return "TRUE".  */
 
 int
    return "TRUE".  */
 
 int
-child_thread_alive (pid)
-     int pid;
+child_thread_alive (ptid_t ptid)
 {
   return 1;
 }
 {
   return 1;
 }
This page took 0.03268 seconds and 4 git commands to generate.