Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Ping: unconditionally print detaching message
@ 2010-11-19 21:57 Tom Tromey
  2010-11-19 22:16 ` Joel Brobecker
  2010-12-07  7:56 ` Jan Kratochvil
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2010-11-19 21:57 UTC (permalink / raw)
  To: gdb-patches

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  <jan.kratochvil@redhat.com>

	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 <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <assert.h>
+#include <stdlib.h>
+
+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"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ping: unconditionally print detaching message
  2010-11-19 21:57 Ping: unconditionally print detaching message Tom Tromey
@ 2010-11-19 22:16 ` Joel Brobecker
  2010-12-06 21:56   ` Tom Tromey
  2010-12-07  7:56 ` Jan Kratochvil
  1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2010-11-19 22:16 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> 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.

FWIW:

I don't really have an opinion either way. Some people are going
to find it annoying if they are too many forks going on (unlikely?),
while some others might have their life saved by it (but that's
provided we keep the number of warnings small).

> 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.

We could introduce message without a setting for now - the fewer,
the better (IMO).  And if people complain about it, then introduce
one to prevent from being printed if the user so wishes...

-- 
Joel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ping: unconditionally print detaching message
  2010-11-19 22:16 ` Joel Brobecker
@ 2010-12-06 21:56   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2010-12-06 21:56 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Tom> It occurred to me that perhaps we could instead have a setting for this.
Tom> I am ambivalent about that but if that is what people want, I will
Tom> implement it.

Joel> We could introduce message without a setting for now - the fewer,
Joel> the better (IMO).  And if people complain about it, then introduce
Joel> one to prevent from being printed if the user so wishes...

It looks like we already changed it once, so this would be the second
time.

Why is "set print inferior-events" off by default?
It seems like we could resolve this by turning it on by default
and perhaps making this patch consult that setting.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ping: unconditionally print detaching message
  2010-11-19 21:57 Ping: unconditionally print detaching message Tom Tromey
  2010-11-19 22:16 ` Joel Brobecker
@ 2010-12-07  7:56 ` Jan Kratochvil
  2010-12-07 18:14   ` Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2010-12-07  7:56 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Fri, 19 Nov 2010 22:57:26 +0100, Tom Tromey wrote:
> 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.

I wrote the patch because the user did not notice any new process there and so
that should be some solution for it.

But TBH I just got used to the message in Fedora, it is being printed zillions
times during debugging sessions and I even have no clue why.

$ ./gdb -q -nx -ex r --args ./gdb -nx -q
Reading symbols from .../gdb/gdb...done.
Starting program: .../gdb/gdb -nx -q
[Thread debugging using libthread_db enabled]
Detaching after fork from child process 4015.
(gdb) _

BTW I have found out now this one message is due to `iconv -l'.

So if it should be printed there should be IMO printed even the command
+ arguments.

But the right way would be rather to use `set detach-on-fork off' by default
when it would be working transparently enough.  Therefore this message is no
longer the right solution but just a temporary GDB deficiency workaround now.

So I am fine with dropping it (incl. Fedora) rather than trying to figure out
some new message format/options.


Thanks,
Jan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ping: unconditionally print detaching message
  2010-12-07  7:56 ` Jan Kratochvil
@ 2010-12-07 18:14   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2010-12-07 18:14 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> So if it should be printed there should be IMO printed even the command
Jan> + arguments.

Yeah, that would be nice, if it isn't too hard.

Jan> But the right way would be rather to use `set detach-on-fork off'
Jan> by default when it would be working transparently enough.
Jan> Therefore this message is no longer the right solution but just a
Jan> temporary GDB deficiency workaround now.

I do think this would be good.  But, we seem to be quite a ways from it.

What do you think of the "set print inferior" proposal I sent the other
day?

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-07 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-19 21:57 Ping: unconditionally print detaching message Tom Tromey
2010-11-19 22:16 ` Joel Brobecker
2010-12-06 21:56   ` Tom Tromey
2010-12-07  7:56 ` Jan Kratochvil
2010-12-07 18:14   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox