/* Machine independent support for QNX Neutrino /proc (process file system)
for GDB. Written by Colin Burgess at QNX Software Systems Limited.
- Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc.
Contributed by QNX Software Systems Ltd.
struct mem_attrib *attrib,
struct target_ops *);
-static void notice_signals (void);
-
static void init_procfs_ops (void);
static ptid_t do_attach (ptid_t ptid);
static int procfs_can_use_hw_breakpoint (int, int, int);
-static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type);
+static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
+ struct expression *cond);
-static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type);
+static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
+ struct expression *cond);
static int procfs_stopped_by_watchpoint (void);
#endif /* _NTO_VERSION */
}
-void
+static void
procfs_find_new_threads (struct target_ops *ops)
{
procfs_status status;
if (ptid_equal (inferior_ptid, null_ptid))
{
ourstatus->kind = TARGET_WAITKIND_STOPPED;
- ourstatus->value.sig = TARGET_SIGNAL_0;
+ ourstatus->value.sig = GDB_SIGNAL_0;
exit_signo = 0;
return null_ptid;
}
if (status.flags & _DEBUG_FLAG_SSTEP)
{
ourstatus->kind = TARGET_WAITKIND_STOPPED;
- ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+ ourstatus->value.sig = GDB_SIGNAL_TRAP;
}
/* Was it a breakpoint? */
else if (status.flags & _DEBUG_FLAG_TRACE)
{
ourstatus->kind = TARGET_WAITKIND_STOPPED;
- ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+ ourstatus->value.sig = GDB_SIGNAL_TRAP;
}
else if (status.flags & _DEBUG_FLAG_ISTOP)
{
case _DEBUG_WHY_SIGNALLED:
ourstatus->kind = TARGET_WAITKIND_STOPPED;
ourstatus->value.sig =
- target_signal_from_host (status.info.si_signo);
+ gdb_signal_from_host (status.info.si_signo);
exit_signo = 0;
break;
case _DEBUG_WHY_FAULTED:
else
{
ourstatus->value.sig =
- target_signal_from_host (status.info.si_signo);
+ gdb_signal_from_host (status.info.si_signo);
exit_signo = ourstatus->value.sig;
}
break;
case _DEBUG_WHY_REQUESTED:
/* We are assuming a requested stop is due to a SIGINT. */
ourstatus->kind = TARGET_WAITKIND_STOPPED;
- ourstatus->value.sig = TARGET_SIGNAL_INT;
+ ourstatus->value.sig = GDB_SIGNAL_INT;
exit_signo = 0;
break;
}
static void
procfs_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum target_signal signo)
+ ptid_t ptid, int step, enum gdb_signal signo)
{
int signal_to_pass;
procfs_status status;
run.flags |= _DEBUG_RUN_ARM;
- sigemptyset (&run.trace);
- notice_signals ();
- signal_to_pass = target_signal_to_host (signo);
+ signal_to_pass = gdb_signal_to_host (signo);
if (signal_to_pass)
{
devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0);
- signal_to_pass = target_signal_to_host (signo);
+ signal_to_pass = gdb_signal_to_host (signo);
if (status.why & (_DEBUG_WHY_SIGNALLED | _DEBUG_WHY_FAULTED))
{
if (signal_to_pass != status.info.si_signo)
}
}
+/* Set list of signals to be handled in the target. */
+
static void
-notice_signals (void)
+procfs_pass_signals (int numsigs, unsigned char *pass_signals)
{
int signo;
+ sigfillset (&run.trace);
+
for (signo = 1; signo < NSIG; signo++)
{
- if (signal_stop_state (target_signal_from_host (signo)) == 0
- && signal_print_state (target_signal_from_host (signo)) == 0
- && signal_pass_state (target_signal_from_host (signo)) == 1)
- sigdelset (&run.trace, signo);
- else
- sigaddset (&run.trace, signo);
+ int target_signo = gdb_signal_from_host (signo);
+ if (target_signo < numsigs && pass_signals[target_signo])
+ sigdelset (&run.trace, signo);
}
}
-/* When the user changes the state of gdb's signal handling via the
- "handle" command, this function gets called to see if any change
- in the /proc interface is required. It is also called internally
- by other /proc interface functions to initialize the state of
- the traced signal set. */
-static void
-procfs_notice_signals (ptid_t ptid)
-{
- sigemptyset (&run.trace);
- notice_signals ();
-}
-
static struct tidinfo *
procfs_thread_info (pid_t pid, short tid)
{
return NULL;
}
-char *
+static char *
procfs_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[1024];
procfs_ops.to_create_inferior = procfs_create_inferior;
procfs_ops.to_mourn_inferior = procfs_mourn_inferior;
procfs_ops.to_can_run = procfs_can_run;
- procfs_ops.to_notice_signals = procfs_notice_signals;
+ procfs_ops.to_pass_signals = procfs_pass_signals;
procfs_ops.to_thread_alive = procfs_thread_alive;
procfs_ops.to_find_new_threads = procfs_find_new_threads;
procfs_ops.to_pid_to_str = procfs_pid_to_str;
sigaddset (&set, SIGUSR1);
sigprocmask (SIG_BLOCK, &set, NULL);
- /* Set up trace and fault sets, as gdb expects them. */
- sigemptyset (&run.trace);
+ /* Initially, make sure all signals are reported. */
+ sigfillset (&run.trace);
/* Stuff some information. */
nto_cpuinfo_flags = SYSPAGE_ENTRY (cpuinfo)->flags;