Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Some more multi-fork fixes
@ 2006-01-15 19:08 Daniel Jacobowitz
  2006-01-27 20:04 ` Michael Snyder
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-01-15 19:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: msnyder

These patches allow multi-fork.exp to pass on x86_64-pc-linux-gnu, most of
the time.  I'm sorry I didn't notice the _dl_sysinfo_int80 bit earlier.

Some other problems I noticed, but did not fix:

The "follow child, print pids" test is victim of a race condition; sometimes
the "$pid done" printout from the inferior will be interleaved with the GDB
output, causing expect to mark the test as a failure.

delete-fork really ought to call waitpid after deleting the fork; otherwise
the process lives on as a zombie.

-- 
Daniel Jacobowitz
CodeSourcery

2006-01-15  Daniel Jacobowitz  <dan@codesourcery.com>

	* linux-fork.c (delete_fork_command, detach_fork_command): Use
	PIDGET.

2006-01-15  Daniel Jacobowitz  <dan@codesourcery.com>

	* gdb.base/multi-forks.c: Add copyright notice.  Include <stdlib.h>.
	* gdb.base/multi-forks.exp: Use a loop.  Allow "fork" as a stopped
	function name.

Index: linux-fork.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-fork.c,v
retrieving revision 1.2
diff -u -p -r1.2 linux-fork.c
--- linux-fork.c	4 Jan 2006 19:34:58 -0000	1.2
+++ linux-fork.c	15 Jan 2006 19:01:55 -0000
@@ -1,6 +1,6 @@
 /* GNU/Linux native-dependent code for debugging multiple forks.
 
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -379,7 +379,7 @@ delete_fork_command (char *args, int fro
   if (ptid_equal (ptid, inferior_ptid))
     error (_("Please switch to another fork/checkpoint before deleting the current one"));
 
-  if (ptrace (PTRACE_KILL, ptid, 0, 0))
+  if (ptrace (PTRACE_KILL, PIDGET (ptid), 0, 0))
     error (_("Unable to kill pid %s"), target_tid_to_str (ptid));
 
   if (from_tty)
@@ -403,7 +403,7 @@ detach_fork_command (char *args, int fro
   if (ptid_equal (ptid, inferior_ptid))
     error (_("Please switch to another fork before detaching the current one"));
 
-  if (ptrace (PTRACE_DETACH, ptid, 0, 0))
+  if (ptrace (PTRACE_DETACH, PIDGET (ptid), 0, 0))
     error (_("Unable to detach %s"), target_pid_to_str (ptid));
 
   if (from_tty)

Index: testsuite/gdb.base/multi-forks.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/multi-forks.c,v
retrieving revision 1.2
diff -u -p -r1.2 multi-forks.c
--- testsuite/gdb.base/multi-forks.c	4 Jan 2006 19:29:26 -0000	1.2
+++ testsuite/gdb.base/multi-forks.c	15 Jan 2006 19:05:35 -0000
@@ -1,3 +1,23 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2005, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA,
+   02110-1301, USA.  */
+
+#include <stdlib.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <unistd.h>
Index: testsuite/gdb.base/multi-forks.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/multi-forks.exp,v
retrieving revision 1.2
diff -u -p -r1.2 multi-forks.exp
--- testsuite/gdb.base/multi-forks.exp	4 Jan 2006 19:29:26 -0000	1.2
+++ testsuite/gdb.base/multi-forks.exp	15 Jan 2006 19:05:35 -0000
@@ -1,4 +1,4 @@
-#   Copyright 2005 Free Software Foundation, Inc.
+#   Copyright 2005, 2006 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
@@ -12,10 +12,7 @@
 # 
 # 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
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 if $tracelevel then {
 	strace $tracelevel
@@ -114,65 +111,11 @@ gdb_test "set detach off" "" "set detach
 # eventually winding up with 16 forks.
 #
 
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 1"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 1"
-gdb_test "restart 1" "_dl_sysinfo_int80.*" "restart 1"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 2"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 2"
-gdb_test "restart 2" "_dl_sysinfo_int80.*" "restart 2"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 3"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 3"
-gdb_test "restart 3" "_dl_sysinfo_int80.*" "restart 3"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 4"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 4"
-gdb_test "restart 4" "_dl_sysinfo_int80.*" "restart 4"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 5"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 5"
-gdb_test "restart 5" "_dl_sysinfo_int80.*" "restart 5"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 6"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 6"
-gdb_test "restart 6" "_dl_sysinfo_int80.*" "restart 6"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 7"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 7"
-gdb_test "restart 7" "_dl_sysinfo_int80.*" "restart 7"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 8"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 8"
-gdb_test "restart 8" "_dl_sysinfo_int80.*" "restart 8"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 9"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 9"
-gdb_test "restart 9" "_dl_sysinfo_int80.*" "restart 9"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 10"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 10"
-gdb_test "restart 10" "_dl_sysinfo_int80.*" "restart 10"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 11"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 11"
-gdb_test "restart 11" "_dl_sysinfo_int80.*" "restart 11"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 12"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 12"
-gdb_test "restart 12" "_dl_sysinfo_int80.*" "restart 12"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 13"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 13"
-gdb_test "restart 13" "_dl_sysinfo_int80.*" "restart 13"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 14"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 14"
-gdb_test "restart 14" "_dl_sysinfo_int80.*" "restart 14"
-
-gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 15"
-gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 15"
-gdb_test "restart 15" "_dl_sysinfo_int80.*" "restart 15"
+for {set i 1} {$i <= 15} {incr i} {
+  gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit $i"
+  gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork $i"
+  gdb_test "restart $i" "(_dl_sysinfo_int80|fork).*" "restart $i"
+}
 
 gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 16"
 gdb_test "info fork" " 4 .* 3 .* 2 .* 1 .*" "info fork 16"


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

* Re: Some more multi-fork fixes
  2006-01-15 19:08 Some more multi-fork fixes Daniel Jacobowitz
@ 2006-01-27 20:04 ` Michael Snyder
  2006-02-24 23:10   ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Snyder @ 2006-01-27 20:04 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> These patches allow multi-fork.exp to pass on x86_64-pc-linux-gnu, most of
> the time.  I'm sorry I didn't notice the _dl_sysinfo_int80 bit earlier.

Thanks, I'd been thinking about that...

> Some other problems I noticed, but did not fix:
> 
> The "follow child, print pids" test is victim of a race condition; sometimes
> the "$pid done" printout from the inferior will be interleaved with the GDB
> output, causing expect to mark the test as a failure.
> 
> delete-fork really ought to call waitpid after deleting the fork; otherwise
> the process lives on as a zombie.

That's fine with me too.


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

* Re: Some more multi-fork fixes
  2006-01-27 20:04 ` Michael Snyder
@ 2006-02-24 23:10   ` Daniel Jacobowitz
  2006-02-25  0:12     ` Daniel Jacobowitz
  2006-03-01 22:15     ` Michael Snyder
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-02-24 23:10 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

On Fri, Jan 27, 2006 at 12:01:02PM -0800, Michael Snyder wrote:
> >Some other problems I noticed, but did not fix:
> >
> >The "follow child, print pids" test is victim of a race condition; 
> >sometimes
> >the "$pid done" printout from the inferior will be interleaved with the GDB
> >output, causing expect to mark the test as a failure.
> >
> >delete-fork really ought to call waitpid after deleting the fork; otherwise
> >the process lives on as a zombie.
> 
> That's fine with me too.

Well, I'd been sort of hoping that you (as the developer who
contributed this huge pile of new code) would take care of its
reported bugs.

I'm up against a bit of a brick wall at the moment.  I've got
patches in my source tree to unify the single-threaded and
multi-threaded code in the Linux native layer into a single
combined target.  But since this is an inherently single-threaded
operation the multi-threaded code totally falls down - switching
forks doesn't preserve things like the LWP list, leading to
messy timeouts.  I'm going to find some minimally painful
way to make the two of them talk to each other.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Some more multi-fork fixes
  2006-02-24 23:10   ` Daniel Jacobowitz
@ 2006-02-25  0:12     ` Daniel Jacobowitz
  2006-03-10 19:50       ` Michael Snyder
  2006-03-01 22:15     ` Michael Snyder
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-02-25  0:12 UTC (permalink / raw)
  To: gdb-patches; +Cc: Michael Snyder

On Fri, Feb 24, 2006 at 05:41:15PM -0500, Daniel Jacobowitz wrote:
> I'm up against a bit of a brick wall at the moment.  I've got
> patches in my source tree to unify the single-threaded and
> multi-threaded code in the Linux native layer into a single
> combined target.  But since this is an inherently single-threaded
> operation the multi-threaded code totally falls down - switching
> forks doesn't preserve things like the LWP list, leading to
> messy timeouts.  I'm going to find some minimally painful
> way to make the two of them talk to each other.

FYI, I've got that more or less working now (as well as it was
previously). I'll post it in a bit.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Some more multi-fork fixes
  2006-02-24 23:10   ` Daniel Jacobowitz
  2006-02-25  0:12     ` Daniel Jacobowitz
@ 2006-03-01 22:15     ` Michael Snyder
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Snyder @ 2006-03-01 22:15 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Fri, Jan 27, 2006 at 12:01:02PM -0800, Michael Snyder wrote:
> 
>>>Some other problems I noticed, but did not fix:
>>>
>>>The "follow child, print pids" test is victim of a race condition; 
>>>sometimes
>>>the "$pid done" printout from the inferior will be interleaved with the GDB
>>>output, causing expect to mark the test as a failure.
>>>
>>>delete-fork really ought to call waitpid after deleting the fork; otherwise
>>>the process lives on as a zombie.
>>
>>That's fine with me too.
> 
> 
> Well, I'd been sort of hoping that you (as the developer who
> contributed this huge pile of new code) would take care of its
> reported bugs.

Sorry about that -- I should be able to give it
more time and attention now.  Just trying to catch up...

> 
> I'm up against a bit of a brick wall at the moment.  I've got
> patches in my source tree to unify the single-threaded and
> multi-threaded code in the Linux native layer into a single
> combined target.  But since this is an inherently single-threaded
> operation the multi-threaded code totally falls down - switching
> forks doesn't preserve things like the LWP list, leading to
> messy timeouts.  I'm going to find some minimally painful
> way to make the two of them talk to each other.
> 


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

* Re: Some more multi-fork fixes
  2006-02-25  0:12     ` Daniel Jacobowitz
@ 2006-03-10 19:50       ` Michael Snyder
  2006-03-10 19:54         ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Snyder @ 2006-03-10 19:50 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Fri, Feb 24, 2006 at 05:41:15PM -0500, Daniel Jacobowitz wrote:
> 
>>I'm up against a bit of a brick wall at the moment.  I've got
>>patches in my source tree to unify the single-threaded and
>>multi-threaded code in the Linux native layer into a single
>>combined target.  But since this is an inherently single-threaded
>>operation the multi-threaded code totally falls down - switching
>>forks doesn't preserve things like the LWP list, leading to
>>messy timeouts.  I'm going to find some minimally painful
>>way to make the two of them talk to each other.
> 
> 
> FYI, I've got that more or less working now (as well as it was
> previously). I'll post it in a bit.
> 

Hey Daniel, what's the status on this?


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

* Re: Some more multi-fork fixes
  2006-03-10 19:50       ` Michael Snyder
@ 2006-03-10 19:54         ` Daniel Jacobowitz
  2006-03-10 20:04           ` Michael Snyder
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-03-10 19:54 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

On Fri, Mar 10, 2006 at 11:09:43AM -0800, Michael Snyder wrote:
> Daniel Jacobowitz wrote:
> >On Fri, Feb 24, 2006 at 05:41:15PM -0500, Daniel Jacobowitz wrote:
> >
> >>I'm up against a bit of a brick wall at the moment.  I've got
> >>patches in my source tree to unify the single-threaded and
> >>multi-threaded code in the Linux native layer into a single
> >>combined target.  But since this is an inherently single-threaded
> >>operation the multi-threaded code totally falls down - switching
> >>forks doesn't preserve things like the LWP list, leading to
> >>messy timeouts.  I'm going to find some minimally painful
> >>way to make the two of them talk to each other.
> >
> >
> >FYI, I've got that more or less working now (as well as it was
> >previously). I'll post it in a bit.
> >
> 
> Hey Daniel, what's the status on this?

Sorry, didn't close the circle: I did post this.  It's in these
two:
  http://sourceware.org/ml/gdb-patches/2006-02/msg00493.html
  http://sourceware.org/ml/gdb-patches/2006-02/msg00494.html

I've still got to work out the glibc side of the fourth patch
in that series, but I don't think there's anything stopping me
from committing the others; I should do that.  Does the first
one above look good to you?

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Some more multi-fork fixes
  2006-03-10 19:54         ` Daniel Jacobowitz
@ 2006-03-10 20:04           ` Michael Snyder
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Snyder @ 2006-03-10 20:04 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Fri, Mar 10, 2006 at 11:09:43AM -0800, Michael Snyder wrote:
> 
>>Daniel Jacobowitz wrote:
>>
>>>On Fri, Feb 24, 2006 at 05:41:15PM -0500, Daniel Jacobowitz wrote:
>>>
>>>
>>>>I'm up against a bit of a brick wall at the moment.  I've got
>>>>patches in my source tree to unify the single-threaded and
>>>>multi-threaded code in the Linux native layer into a single
>>>>combined target.  But since this is an inherently single-threaded
>>>>operation the multi-threaded code totally falls down - switching
>>>>forks doesn't preserve things like the LWP list, leading to
>>>>messy timeouts.  I'm going to find some minimally painful
>>>>way to make the two of them talk to each other.
>>>
>>>
>>>FYI, I've got that more or less working now (as well as it was
>>>previously). I'll post it in a bit.
>>>
>>
>>Hey Daniel, what's the status on this?
> 
> 
> Sorry, didn't close the circle: I did post this.  It's in these
> two:
>   http://sourceware.org/ml/gdb-patches/2006-02/msg00493.html
>   http://sourceware.org/ml/gdb-patches/2006-02/msg00494.html

Ah, that's what I was looking for.

> I've still got to work out the glibc side of the fourth patch
> in that series, but I don't think there's anything stopping me
> from committing the others; I should do that.  Does the first
> one above look good to you?

Got some questions -- I'll reply in-thread.


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

end of thread, other threads:[~2006-03-10 19:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-15 19:08 Some more multi-fork fixes Daniel Jacobowitz
2006-01-27 20:04 ` Michael Snyder
2006-02-24 23:10   ` Daniel Jacobowitz
2006-02-25  0:12     ` Daniel Jacobowitz
2006-03-10 19:50       ` Michael Snyder
2006-03-10 19:54         ` Daniel Jacobowitz
2006-03-10 20:04           ` Michael Snyder
2006-03-01 22:15     ` Michael Snyder

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