-/* Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2012 Free Software Foundation, Inc.
This file is part of GDB.
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
-#include <sys/wait.h>
+#include "gdb_wait.h"
#include <signal.h>
int using_threads = 1;
case PTRACE_GETLOADINFO:
return "PTRACE_GETLOADINFO";
break;
+ case PTRACE_GETTRACESIG:
+ return "PTRACE_GETTRACESIG";
+ break;
+#ifdef PTRACE_GETTHREADLIST
case PTRACE_GETTHREADLIST:
return "PTRACE_GETTHREADLIST";
break;
+#endif
}
return "<unknown-request>";
}
static int
lynx_create_inferior (char *program, char **allargs)
{
- struct process_info *new_process;
int pid;
lynx_debug ("lynx_create_inferior ()");
_exit (0177);
}
- new_process = add_process (pid, 0);
+ add_process (pid, 0);
/* Do not add the process thread just yet, as we do not know its tid.
We will add it later, during the wait for the STOP event corresponding
to the lynx_ptrace (PTRACE_TRACEME) call above. */
static int
lynx_attach (unsigned long pid)
{
- struct process_info *new_process;
ptid_t ptid = lynx_ptid_build (pid, 0);
if (lynx_ptrace (PTRACE_ATTACH, ptid, 0, 0, 0) != 0)
error ("Cannot attach to process %lu: %s (%d)\n", pid,
strerror (errno), errno);
- new_process = add_process (pid, 1);
+ add_process (pid, 1);
add_thread (ptid, NULL);
return 0;
for non-threaded applications where the new-thread events are not
generated. */
if (!find_thread_ptid (new_ptid))
- add_thread (new_ptid, NULL);
+ {
+ lynx_debug ("New thread: (pid = %d, tid = %d)",
+ lynx_ptid_get_pid (new_ptid), lynx_ptid_get_tid (new_ptid));
+ add_thread (new_ptid, NULL);
+ }
if (WIFSTOPPED (wstat))
{
status->kind = TARGET_WAITKIND_STOPPED;
- status->value.integer = target_signal_from_host (WSTOPSIG (wstat));
+ status->value.integer = gdb_signal_from_host (WSTOPSIG (wstat));
lynx_debug ("process stopped with signal: %d",
status->value.integer);
}
else if (WIFSIGNALED (wstat))
{
status->kind = TARGET_WAITKIND_SIGNALLED;
- status->value.integer = target_signal_from_host (WTERMSIG (wstat));
+ status->value.integer = gdb_signal_from_host (WTERMSIG (wstat));
lynx_debug ("process terminated with code: %d",
status->value.integer);
}
in fact get here. But if we do, handle the event the best
we can. */
status->kind = TARGET_WAITKIND_STOPPED;
- status->value.integer = target_signal_from_host (0);
+ status->value.integer = gdb_signal_from_host (0);
lynx_debug ("unknown event ????");
}
breakpoint events (Eg. new-thread events). Handle those other types
of events, and resume the execution if necessary. */
if (status->kind == TARGET_WAITKIND_STOPPED
- && status->value.integer == TARGET_SIGNAL_TRAP)
+ && status->value.integer == GDB_SIGNAL_TRAP)
{
const int realsig = lynx_ptrace (PTRACE_GETTRACESIG, new_ptid, 0, 0, 0);