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. */
/* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
merged back in. */
#include <sys/proc.h>
#include <sys/dir.h>
#include <sys/ioctl.h>
-#include <sys/stat.h>
+#include "gdb_stat.h"
+#ifdef _SEQUENT_
#include <sys/ptrace.h>
+#else
+/* Dynix has only machine/ptrace.h, which is already included by sys/user.h */
+/* Dynix has no mptrace call */
+#define mptrace ptrace
+#endif
#include "gdbcore.h"
#include <fcntl.h>
#include <sgtty.h>
int regno;
{
struct pt_regset regs;
- int reg_tmp, i;
- extern char registers[];
-
+ int i;
+
+ /* FIXME: Fetching the registers is a kludge to initialize all elements
+ in the fpu and fpa status. This works for normal debugging, but
+ might cause problems when calling functions in the inferior.
+ At least fpu_control and fpa_pcr (probably more) should be added
+ to the registers array to solve this properly. */
+ mptrace (XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
+
regs.pr_eax = *(int *)®isters[REGISTER_BYTE(0)];
regs.pr_ebx = *(int *)®isters[REGISTER_BYTE(5)];
regs.pr_ecx = *(int *)®isters[REGISTER_BYTE(2)];
regs.pr_fpa.fpa_regs[i] =
*(int *)®isters[REGISTER_BYTE(FP1_REGNUM+i)];
}
+ memcpy (regs.pr_fpu.fpu_stack[0], ®isters[REGISTER_BYTE(ST0_REGNUM)], 10);
+ memcpy (regs.pr_fpu.fpu_stack[1], ®isters[REGISTER_BYTE(ST1_REGNUM)], 10);
+ memcpy (regs.pr_fpu.fpu_stack[2], ®isters[REGISTER_BYTE(ST2_REGNUM)], 10);
+ memcpy (regs.pr_fpu.fpu_stack[3], ®isters[REGISTER_BYTE(ST3_REGNUM)], 10);
+ memcpy (regs.pr_fpu.fpu_stack[4], ®isters[REGISTER_BYTE(ST4_REGNUM)], 10);
+ memcpy (regs.pr_fpu.fpu_stack[5], ®isters[REGISTER_BYTE(ST5_REGNUM)], 10);
+ memcpy (regs.pr_fpu.fpu_stack[6], ®isters[REGISTER_BYTE(ST6_REGNUM)], 10);
+ memcpy (regs.pr_fpu.fpu_stack[7], ®isters[REGISTER_BYTE(ST7_REGNUM)], 10);
mptrace (XPT_WREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
}
{
int i;
struct pt_regset regs;
- extern char registers[];
registers_fetched ();
- mptrace (XPT_RREGS, (pid), (regaddr), 0);
+ mptrace (XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
*(int *)®isters[REGISTER_BYTE(EAX_REGNUM)] = regs.pr_eax;
*(int *)®isters[REGISTER_BYTE(EBX_REGNUM)] = regs.pr_ebx;
*(int *)®isters[REGISTER_BYTE(ECX_REGNUM)] = regs.pr_ecx;
the OS knows what it is doing. */
#ifdef FPA_PCR_CC_C1
if (pcr_tmp & FPA_PCR_CC_C1) printf_unfiltered(" C1");
-#endif
-#ifdef FPA_PCR_CC_C0
- if (pcr_tmp & FPA_PCR_CC_C1) printf_unfiltered(" C0");
+#else
+ if (pcr_tmp & FPA_PCR_CC_C0) printf_unfiltered(" C0");
#endif
switch (pcr_tmp)
break;
#ifdef FPA_PCR_CC_C1
case FPA_PCR_CC_C1:
-#endif
-#ifdef FPA_PCR_CC_C0
+#else
case FPA_PCR_CC_C0:
#endif
printf_unfiltered(" (Less than)");
sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \
sigmask(SIGURG) | sigmask(SIGPOLL)
-
+#ifdef ATTACH_DETACH
/*
* Thanks to XPT_MPDEBUGGER, we have to mange child_wait().
*/
#endif
do {
- if (attach_flag)
- set_sigint_trap(); /* Causes SIGINT to be passed on to the
- attached process. */
+ set_sigint_trap(); /* Causes SIGINT to be passed on to the
+ attached process. */
save_errno = errno;
got_sigchld = 0;
sigsuspend(&set);
}
- if (attach_flag)
- clear_sigint_trap();
+ clear_sigint_trap();
rv = mptrace(XPT_STOPSTAT, 0, (char *)&pt, 0);
if (-1 == rv) {
return pid;
}
+#else /* !ATTACH_DETACH */
+/*
+ * Simple child_wait() based on inftarg.c child_wait() for use until
+ * the MPDEBUGGER child_wait() works properly. This will go away when
+ * that is fixed.
+ */
+child_wait (pid, ourstatus)
+ int pid;
+ struct target_waitstatus *ourstatus;
+{
+ int save_errno;
+ int status;
+
+ do {
+ pid = wait (&status);
+ save_errno = errno;
+
+ if (pid == -1)
+ {
+ if (save_errno == EINTR)
+ continue;
+ fprintf (stderr, "Child process unexpectedly missing: %s.\n",
+ safe_strerror (save_errno));
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+ return -1;
+ }
+ } while (pid != inferior_pid); /* Some other child died or stopped */
+ store_waitstatus (ourstatus, status);
+ return pid;
+}
+#endif /* ATTACH_DETACH */
\f
{
if (inferior_pid == 0)
return;
- /*
- * Don't use PT_KILL, since the child will stop again with a PTS_EXIT.
- * Just hit him with SIGKILL (so he stops) and detach.
- */
+
+ /* For MPDEBUGGER, don't use PT_KILL, since the child will stop
+ again with a PTS_EXIT. Just hit him with SIGKILL (so he stops)
+ and detach. */
+
kill (inferior_pid, SIGKILL);
+#ifdef ATTACH_DETACH
detach(SIGKILL);
+#else /* ATTACH_DETACH */
+ ptrace(PT_KILL, inferior_pid, 0, 0);
+ wait((int *)NULL);
+#endif /* ATTACH_DETACH */
target_mourn_inferior ();
}
child_resume (pid, step, signal)
int pid;
int step;
- int signal;
+ enum target_signal signal;
{
errno = 0;
for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
- ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ ptrace (PT_WDATA, inferior_pid, (PTRACE_ARG3_TYPE) addr,
buffer[i]);
if (errno)
{
void
_initialize_symm_nat ()
{
+#ifdef ATTACH_DETACH
/*
* the MPDEBUGGER is necessary for process tree debugging and attach
* to work, but it alters the behavior of debugged processes, so other
fatal("_initialize_symm_nat(): sigaction(SIGCHLD): %s",
safe_strerror(errno));
}
+#endif
}