From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19391 invoked by alias); 7 Dec 2005 18:01:58 -0000 Received: (qmail 19377 invoked by uid 22791); 7 Dec 2005 18:01:57 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,FORGED_RCVD_HELO X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 07 Dec 2005 18:01:55 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id jB7I1qsr016322 for ; Wed, 7 Dec 2005 13:01:52 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id jB7I1qV17267 for ; Wed, 7 Dec 2005 13:01:52 -0500 Received: from localhost.localdomain (vpn50-83.rdu.redhat.com [172.16.50.83]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id jB7I1pUQ016615 for ; Wed, 7 Dec 2005 13:01:52 -0500 Received: from ironwood.lan (ironwood.lan [192.168.64.8]) by localhost.localdomain (8.12.11/8.12.10) with ESMTP id jB7I1k01005099 for ; Wed, 7 Dec 2005 11:01:46 -0700 Date: Wed, 07 Dec 2005 18:01:00 -0000 From: Kevin Buettner To: rda@sources.redhat.com Subject: [commit] Add SIGSTOP explanatory message to ``break_program'' methods Message-ID: <20051207110146.511e6902@ironwood.lan> Organization: Red Hat X-Mailer: Sylpheed-Claws 0.9.12cvs173.1 (GTK+ 2.4.14; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact rda-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: rda-owner@sourceware.org X-SW-Source: 2005-q4/txt/msg00010.txt.bz2 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); }