From 2455069d930b37918b92281be109444d1e38dc6d Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 27 Apr 2011 13:29:15 +0000 Subject: * target.h (struct target_ops): Remove to_notice_signals; add to_pass_signals. (target_notice_signals): Remove. (target_pass_signals): Add prototype. * target.c (update_current_target): Remove to_notice_signals; mention to_pass_signals. (target_pass_signals): New function. (debug_to_notice_signals): Remove. (setup_target_debug): Do not install debug_to_notice_signals. * infrun.c (signal_pass): New global. (resume): Call target_pass_signals. (handle_inferior_event): Report all signals while stepping over non-steppable watchpoint. Reset trap_expected to ensure breakpoints are re-inserted when stepping over a signal handler. (signal_cache_update): New function. (signal_stop_update): Call it. (signal_print_update): Likewise. (signal_pass_update): Likewise. (handle_command): Call signal_cache_update and target_pass_signals instead of target_notice_signals. (_initialize_infrun): Initialize signal_pass. * linux-nat.c (pass_mask): New global. (linux_nat_pass_signals): New function. (linux_nat_create_inferior): Report all signals initially. (linux_nat_attach): Likewise. (linux_nat_resume): Use pass_mask to decide whether to directly handle an inferior signal. (linux_nat_wait_1): Likewise. (linux_nat_add_target): Install to_pass_signals callback. * nto-procfs.c (notice_signals): Remove. (procfs_resume): Do not call notice_signals. (procfs_notice_signals): Remove. (procfs_pass_signals): New function. (init_procfs_ops): Install to_pass_signals callback instead of to_notice_signals callback. (_initialize_procfs): Report all signals initially. * procfs.c (procfs_notice_signals): Remove. (procfs_pass_signals): New function. (procfs_target): Install to_pass_signals callback instead of to_notice_signals callback. (register_gdb_signals): Remove. (procfs_debug_inferior): Report all signals initially. (procfs_init_inferior): Remove redundant register_gdb_signals call. * remote.c (remote_pass_signals): Add numsigs and pass_signals parameters; use them instead of calling signal_..._state routines. (remote_notice_signals): Remove. (remote_start_remote): Report all signals initially. (remote_resume): Do not call remote_pass_signals. (_initialize_remote): Install to_pass_signals callback instead of to_notice_signals callback. --- gdb/nto-procfs.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'gdb/nto-procfs.c') diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 3519f33..3824775 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -64,8 +64,6 @@ static int procfs_xfer_memory (CORE_ADDR, gdb_byte *, int, int, 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); @@ -985,8 +983,6 @@ procfs_resume (struct target_ops *ops, run.flags |= _DEBUG_RUN_ARM; - sigemptyset (&run.trace); - notice_signals (); signal_to_pass = target_signal_to_host (signo); if (signal_to_pass) @@ -1334,34 +1330,23 @@ procfs_store_registers (struct target_ops *ops, } } +/* 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 = target_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) { @@ -1426,7 +1411,7 @@ init_procfs_ops (void) 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; @@ -1458,8 +1443,8 @@ _initialize_procfs (void) 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; -- cgit v1.1