public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
* [commit] Add SIGSTOP explanatory message to ``break_program''  methods
@ 2005-12-07 18:01 Kevin Buettner
  0 siblings, 0 replies; only message in thread
From: Kevin Buettner @ 2005-12-07 18:01 UTC (permalink / raw)
  To: rda

I've just committed the patch below.

It causes the ``break_program'' methods to output a message to the GDB
console which explains that SIGSTOP has been sent to the inferior
process.  This message also tells the GDB user how the process might
be continued.  It will only be sent once per session.

	* Makefile.am (EXTRA_rda_SOURCES): Add diagnostics.c.
	* configure.in (TARGET_MODULES): Add diagnostics.o.
	* Makefile.in, configure: Regenerate.
	* diagnostics.c: New file.
	* diagnostics.h (output_O_packet, print_sigstop_message): New
	functions.
	* ptrace-target.c (diagnostics.h): Include.
	(ptrace_break_program): Call print_sigstop_message().
	* thread_db.c (thread_db_break_program): Likewise.

Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/rda/unix/Makefile.am,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.am
--- Makefile.am	30 Jun 2005 03:24:18 -0000	1.4
+++ Makefile.am	7 Dec 2005 17:48:04 -0000
@@ -10,7 +10,7 @@ INCLUDES = -I$(srcdir) -I$(srcdir)/../in
 
 rda_SOURCES = server.c 
 EXTRA_rda_SOURCES = linux-target.c solaris-target.c \
-	ptrace-target.c dummy-target.c stock-breakpoints.c
+	ptrace-target.c dummy-target.c stock-breakpoints.c diagnostics.c
 TARGET_MODULES = @TARGET_MODULES@
 rda_LDADD = $(TARGET_MODULES) ../lib/librda.la
 rda_DEPENDENCIES = $(server_OBJECTS) $(TARGET_MODULES) ../lib/librda.la
Index: configure.in
===================================================================
RCS file: /cvs/src/src/rda/unix/configure.in,v
retrieving revision 1.9
diff -u -p -r1.9 configure.in
--- configure.in	24 Aug 2005 01:14:35 -0000	1.9
+++ configure.in	7 Dec 2005 17:48:04 -0000
@@ -127,6 +127,8 @@ case "$target" in
   ;;
 esac
 
+TARGET_MODULES="$TARGET_MODULES diagnostics.o"
+
 AC_SUBST(TARGET_MODULES)
 
 case "$target" in
Index: diagnostics.c
===================================================================
RCS file: diagnostics.c
diff -N diagnostics.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ diagnostics.c	7 Dec 2005 17:48:04 -0000
@@ -0,0 +1,56 @@
+/* diagnostics.c - Functions and variables used in RDA diagnostics.
+
+   Copyright 2005 Red Hat, Inc.
+
+   This file is part of RDA, the Red Hat Debug Agent (and library).
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+   
+   Alternative licenses for RDA may be arranged by contacting Red Hat,
+   Inc.  */
+
+#include "config.h"
+#include "gdbserv.h"
+#include "gdbserv-output.h"
+
+/* Output an "O" packet.  */
+void
+output_O_packet (struct gdbserv *serv, char *message)
+{
+  gdbserv_output_attach (serv);
+  gdbserv_output_char (serv, 'O');
+  gdbserv_output_string_as_bytes (serv, message);
+  gdbserv_output_packet (serv);
+  gdbserv_output_discard (serv);
+}
+
+/* Print out a helpful message regarding SIGSTOP to the GDB console using
+   an "O" packet.  This message will be printed at most once per session.  */
+void
+print_sigstop_message (struct gdbserv *serv)
+{
+  static int once = 0;
+
+  if (!once)
+    {
+      output_O_packet (serv, "\n"
+      "RDA has sent SIGSTOP to the inferior process.  If you wish to continue\n"
+      "without sending this signal, make sure that \"handle SIGSTOP nopass\" has\n"
+      "been set or use \"signal 0\" to continue.\n");
+      once = 1;
+    }
+}
+
Index: diagnostics.h
===================================================================
RCS file: /cvs/src/src/rda/unix/diagnostics.h,v
retrieving revision 1.1
diff -u -p -r1.1 diagnostics.h
--- diagnostics.h	8 Nov 2005 21:58:36 -0000	1.1
+++ diagnostics.h	7 Dec 2005 17:48:04 -0000
@@ -31,3 +31,11 @@ extern int debug_lwp_pool;
 /* Fetch the PC value for a given pid.  */
 struct gdbserv;
 extern unsigned long debug_get_pc (struct gdbserv *serv, pid_t pid);
+
+/* Output an "O" packet.  */
+void output_O_packet (struct gdbserv *serv, char *message);
+
+/* Print out a helpful message regarding SIGSTOP to the GDB console using
+   an "O" packet.  This message will only be printed at most once per
+   session.  */
+void print_sigstop_message (struct gdbserv *serv);
Index: ptrace-target.c
===================================================================
RCS file: /cvs/src/src/rda/unix/ptrace-target.c,v
retrieving revision 1.11
diff -u -p -r1.11 ptrace-target.c
--- ptrace-target.c	2 Dec 2005 20:52:04 -0000	1.11
+++ ptrace-target.c	7 Dec 2005 17:48:05 -0000
@@ -47,6 +47,8 @@
 #include "server.h"
 #include "ptrace-target.h"
 #include "lwp-ctrl.h"
+#include "diagnostics.h"
+
 /* This is unix ptrace gdbserv target that uses the RDA library to implement
    a remote gdbserver on a unix ptrace host.  It controls the process
    to be debugged on the linux host, allowing GDB to pull the strings
@@ -447,6 +449,7 @@ ptrace_break_program (struct gdbserv *se
      because SIGSTOP cannot be blocked or ignored.  */
   if (process->debug_backend)
     fprintf (stderr, " -- send SIGSTOP to child %d\n", process->pid);
+  print_sigstop_message (serv);
   kill (process->pid, SIGSTOP);
 }
 
Index: thread-db.c
===================================================================
RCS file: /cvs/src/src/rda/unix/thread-db.c,v
retrieving revision 1.18
diff -u -p -r1.18 thread-db.c
--- thread-db.c	2 Dec 2005 20:52:04 -0000	1.18
+++ thread-db.c	7 Dec 2005 17:48:05 -0000
@@ -2081,6 +2081,10 @@ thread_db_break_program (struct gdbserv 
      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);
+
+  /* Tell the GDB user that SIGSTOP has been sent to the inferior.  */
+  print_sigstop_message (serv);
+
   kill (proc_handle.pid, SIGSTOP);
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-07 18:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07 18:01 [commit] Add SIGSTOP explanatory message to ``break_program'' methods Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).