+2009-11-30 Kevin Buettner <kevinb@redhat.com>
+
+ * diagnostics.h, diagnostics.c (print_sigint_message): New function.
+ * linux-target.c (linux_process_rcmd): Add monitor commands
+ "interrupt-with-SIGSTOP and interrupt-with-SIGINT".
+ * server.h (struct child_process): Add new field
+ interrupt_with_SIGSTOP.
+ * thread-db.c (thread_db_break_program): Interrupt using either
+ SIGSTOP or SIGINT depending upon user's preference.
+
2009-11-23 Kevin Buettner <kevinb@redhat.com>
* ptrace-target.c (syscall.h): Include.
}
}
+/* Print out a helpful message regarding SIGINT to the GDB console using
+ an "O" packet. This message will be printed at most once per session. */
+void
+print_sigint_message (struct gdbserv *serv)
+{
+ static int once = 0;
+
+ if (!once)
+ {
+ output_O_packet (serv, "\n"
+ "RDA has sent SIGINT to the inferior process. If the process does not\n"
+ "stop in a timely fashion, it is possible that SIGINT is being blocked.\n"
+ "If that's the case, consider using SIGSTOP to interrupt the process\n"
+ "instead. The monitor command \"monitor interrupt-with-SIGSTOP\" may\n"
+ "be used to turn on RDA's internal flag for effecting this behavior.\n");
+ once = 1;
+ }
+}
an "O" packet. This message will only be printed at most once per
session. */
void print_sigstop_message (struct gdbserv *serv);
+
+/* Print out a helpful message regarding SIGINT to the GDB console using
+ an "O" packet. This message will only be printed at most once per
+ session. */
+void print_sigint_message (struct gdbserv *serv);
debug_lwp_pool = 0;
gdbserv_output_string_as_bytes (serv, "All RDA diagnostics disabled.\n");
}
+ else if (strcmp (cmd, "interrupt-with-SIGSTOP") == 0)
+ {
+ process->interrupt_with_SIGSTOP = 1;
+ gdbserv_output_string_as_bytes (serv,
+ "RDA will use SIGSTOP to perform user requested interrupts.\n");
+ }
+ else if (strcmp (cmd, "interrupt-with-SIGINT") == 0)
+ {
+ process->interrupt_with_SIGSTOP = 0;
+ gdbserv_output_string_as_bytes (serv,
+ "RDA will use SIGINT to perform user requested interrupts.\n");
+ }
else
gdbserv_output_string_as_bytes (serv,
"Unrecognized monitor command.\n"
" monitor thread-db-noisy\n"
" monitor thread-db-quiet\n"
" monitor lwp-pool-noisy\n"
- " monitor lwp-pool-quiet\n");
+ " monitor lwp-pool-quiet\n"
+ " monitor interrupt-with-SIGSTOP\n"
+ " monitor interrupt-with-SIGINT\n");
}
/* This function is called from gdbloop_poll when a new incoming
long signal_to_send;
int debug_backend;
int debug_informational;
+ int interrupt_with_SIGSTOP;
int running;
#if defined(_MIPSEL) || defined(_MIPSEB) || defined(AM33_2_0_LINUX_TARGET)
/* We always send the signal to the main thread. It's not correct
to use process->pid; that's whatever thread last reported a
status, and it may well have been exiting.
+
+ We send either SIGSTOP or SIGINT depending upon user preference -
+ a GDB monitor command may be used to change the signal used. SIGINT
+ has the advantage of allowing the user to continue in the usual
+ manner via GDB's continue command. SIGSTOP may be preferred in some
+ settings because it cannot be blocked or ignored. When SIGSTOP is
+ used, it is slightly more difficult to continue without sending
+ another SISSTOP. */
+
+ if (process->interrupt_with_SIGSTOP)
+ {
+ if (process->debug_backend)
+ fprintf (stderr, " -- send SIGSTOP to child %d\n", proc_handle.pid);
+
+ /* Tell the GDB user that SIGSTOP has been sent to the inferior. */
+ print_sigstop_message (serv);
- We send SIGSTOP, rather than some other signal such as SIGINT,
- because SIGSTOP cannot be blocked or ignored. On Linux, using
- a signal that can be blocked means that the process never gets
- interrupted, since it's the kernel which does the blocking. */
- if (process->debug_backend)
- fprintf (stderr, " -- send SIGSTOP to child %d\n", proc_handle.pid);
+ kill (proc_handle.pid, SIGSTOP);
+ }
+ else
+ {
+ if (process->debug_backend)
+ fprintf (stderr, " -- send SIGINT to child %d\n", proc_handle.pid);
- /* Tell the GDB user that SIGSTOP has been sent to the inferior. */
- print_sigstop_message (serv);
+ /* Tell the GDB user that SIGINT has been sent to the inferior. */
+ print_sigint_message (serv);
- kill (proc_handle.pid, SIGSTOP);
+ kill (proc_handle.pid, SIGINT);
+ }
}
/* Function: check_child_state