From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4891 invoked by alias); 19 Nov 2010 21:57:37 -0000 Received: (qmail 4882 invoked by uid 22791); 19 Nov 2010 21:57:35 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 19 Nov 2010 21:57:29 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAJLvRUN023748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Nov 2010 16:57:28 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAJLvRQm021753; Fri, 19 Nov 2010 16:57:27 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id oAJLvQnx011341; Fri, 19 Nov 2010 16:57:27 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 923573784F6; Fri, 19 Nov 2010 14:57:26 -0700 (MST) From: Tom Tromey To: gdb-patches@sourceware.org Subject: Ping: unconditionally print detaching message Date: Fri, 19 Nov 2010 21:57:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00271.txt.bz2 While going through the Fedora patch backlog I ran into this: http://sources.redhat.com/ml/gdb-patches/2007-12/msg00087.html This has just one reply, from Daniel, asking Jan to see what the other maintainers think. We've had this message on in Fedora for quite a while. I find it mildly useful in that it can occasionally remind me that I am debugging the wrong process. So, I would like to propose that an updated version of it go in. I've appended the current patch we are using. It occurred to me that perhaps we could instead have a setting for this. I am ambivalent about that but if that is what people want, I will implement it. Tom 2008-03-01 Jan Kratochvil Port to GDB-6.8pre. Remove the `[' character from the GDB-6.8 default message. Index: gdb-7.0.50.20100115/gdb/linux-nat.c =================================================================== --- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:22:31.000000000 +0100 +++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:23:28.000000000 +0100 @@ -724,7 +724,7 @@ holding the child stopped. Try \"set de remove_breakpoints_pid (GET_PID (inferior_ptid)); } - if (info_verbose || debug_linux_nat) + if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat) { target_terminal_ours (); fprintf_filtered (gdb_stdlog, Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.c 2010-01-15 03:22:52.000000000 +0100 @@ -0,0 +1,57 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2007 Free Software Foundation, Inc. + + 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. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + +#include +#include +#include +#include +#include + +static void func (void) +{ +} + +int main (void) +{ + pid_t child; + + child = fork (); + switch (child) + { + case -1: + abort (); + case 0: + func (); + break; + default: + { +/* We do not test the switching to the other fork by GDB `fork 1'. */ +#if 0 + pid_t got; + + got = waitpid (child, NULL, 0); + assert (got == child); +#endif + break; + } + } + return 0; +} Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp 2010-01-15 03:22:52.000000000 +0100 @@ -0,0 +1,36 @@ +# Copyright 2007 Free Software Foundation, Inc. + +# 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. + +set testfile fork-detach +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested "Couldn't compile test program" + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_run_cmd +# `Starting program: .*' prefix is available since gdb-6.7. +gdb_test "" \ + "Detaching after fork from child process.*Program exited normally\\..*" \ + "Info message caught"