Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64
@ 2007-12-19 17:42 H.J. Lu
  2007-12-19 17:51 ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2007-12-19 17:42 UTC (permalink / raw)
  To: GDB

When building gdb 6.7.50.20071219-cvs on Linux/ia64, I got

/net/gnu-6/export/gnu/src/gdb/gdb/gdb/gdbserver/linux-low.c:1751:
undefined reference to `clone'
linux-low.o: In function `linux_test_for_tracefork':
/net/gnu-6/export/gnu/src/gdb/gdb/gdb/gdbserver/linux-low.c:1784:
undefined reference to `clone'

there is no clone, only clone2, on Linux/ia64. 


H.J.


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

* Re: gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64
  2007-12-19 17:42 gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64 H.J. Lu
@ 2007-12-19 17:51 ` H.J. Lu
  2007-12-19 18:41   ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2007-12-19 17:51 UTC (permalink / raw)
  To: GDB; +Cc: drow

On Wed, Dec 19, 2007 at 09:42:32AM -0800, H.J. Lu wrote:
> When building gdb 6.7.50.20071219-cvs on Linux/ia64, I got
> 
> /net/gnu-6/export/gnu/src/gdb/gdb/gdb/gdbserver/linux-low.c:1751:
> undefined reference to `clone'
> linux-low.o: In function `linux_test_for_tracefork':
> /net/gnu-6/export/gnu/src/gdb/gdb/gdb/gdbserver/linux-low.c:1784:
> undefined reference to `clone'
> 
> there is no clone, only clone2, on Linux/ia64. 
> 

This regression was introduced by

2007-11-01  Daniel Jacobowitz  <dan@codesourcery.com>

        * linux-low.c (linux_tracefork_grandchild): New. 
        (linux_tracefork_child): Use clone.
        (linux_test_for_tracefork): Use clone; allocate and free a
stack.

Daniel, can you look into it?

Thanks.


H.J.


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

* Re: gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64
  2007-12-19 17:51 ` H.J. Lu
@ 2007-12-19 18:41   ` Daniel Jacobowitz
  2007-12-19 21:08     ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-12-19 18:41 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GDB

On Wed, Dec 19, 2007 at 09:50:49AM -0800, H.J. Lu wrote:
> This regression was introduced by
> 
> 2007-11-01  Daniel Jacobowitz  <dan@codesourcery.com>
> 
>         * linux-low.c (linux_tracefork_grandchild): New. 
>         (linux_tracefork_child): Use clone.
>         (linux_test_for_tracefork): Use clone; allocate and free a
> stack.
> 
> Daniel, can you look into it?

It is an otherwise trivial use of clone.  Could someone with access
to an ia64-linux system try adding a clone2 case?

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64
  2007-12-19 18:41   ` Daniel Jacobowitz
@ 2007-12-19 21:08     ` Andreas Schwab
  2007-12-21 15:47       ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2007-12-19 21:08 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GDB

Daniel Jacobowitz <drow@false.org> writes:

> On Wed, Dec 19, 2007 at 09:50:49AM -0800, H.J. Lu wrote:
>> This regression was introduced by
>> 
>> 2007-11-01  Daniel Jacobowitz  <dan@codesourcery.com>
>> 
>>         * linux-low.c (linux_tracefork_grandchild): New. 
>>         (linux_tracefork_child): Use clone.
>>         (linux_test_for_tracefork): Use clone; allocate and free a
>> stack.
>> 
>> Daniel, can you look into it?
>
> It is an otherwise trivial use of clone.  Could someone with access
> to an ia64-linux system try adding a clone2 case?

This seems to work:

2007-12-19  Andreas Schwab  <schwab@suse.de>

	* linux-low.c (STACK_SIZE): Define.
	(linux_tracefork_child): Use it.  Use __clone2 on ia64.
	(linux_test_for_tracefork): Likewise.

--- linux-low.c	19 Dez 2007 21:34:04 +0100	1.68
+++ linux-low.c	19 Dez 2007 22:05:14 +0100	
@@ -1743,12 +1743,20 @@ linux_tracefork_grandchild (void *arg)
   _exit (0);
 }
 
+#define STACK_SIZE 4096
+
 static int
 linux_tracefork_child (void *arg)
 {
   ptrace (PTRACE_TRACEME, 0, 0, 0);
   kill (getpid (), SIGSTOP);
-  clone (linux_tracefork_grandchild, arg, CLONE_VM | SIGCHLD, NULL);
+#ifdef __ia64__
+  __clone2 (linux_tracefork_grandchild, arg, STACK_SIZE,
+	    CLONE_VM | SIGCHLD, NULL);
+#else
+  clone (linux_tracefork_grandchild, (char *) arg + STACK_SIZE,
+	 CLONE_VM | SIGCHLD, NULL);
+#endif
   _exit (0);
 }
 
@@ -1776,13 +1784,18 @@ linux_test_for_tracefork (void)
 {
   int child_pid, ret, status;
   long second_pid;
-  char *stack = malloc (8192);
+  char *stack = malloc (STACK_SIZE * 4);
 
   linux_supports_tracefork_flag = 0;
 
   /* Use CLONE_VM instead of fork, to support uClinux (no MMU).  */
-  child_pid = clone (linux_tracefork_child, stack + 2048,
-		     CLONE_VM | SIGCHLD, stack + 6144);
+#ifdef __ia64__
+  child_pid = __clone2 (linux_tracefork_child, stack, STACK_SIZE,
+			CLONE_VM | SIGCHLD, stack + STACK_SIZE * 2);
+#else
+  child_pid = clone (linux_tracefork_child, stack + STACK_SIZE,
+		     CLONE_VM | SIGCHLD, stack + STACK_SIZE * 2);
+#endif
   if (child_pid == -1)
     perror_with_name ("clone");
 

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64
  2007-12-19 21:08     ` Andreas Schwab
@ 2007-12-21 15:47       ` H.J. Lu
  2007-12-21 15:56         ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2007-12-21 15:47 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GDB

On Wed, Dec 19, 2007 at 10:08:03PM +0100, Andreas Schwab wrote:
> Daniel Jacobowitz <drow@false.org> writes:
> 
> > On Wed, Dec 19, 2007 at 09:50:49AM -0800, H.J. Lu wrote:
> >> This regression was introduced by
> >> 
> >> 2007-11-01  Daniel Jacobowitz  <dan@codesourcery.com>
> >> 
> >>         * linux-low.c (linux_tracefork_grandchild): New. 
> >>         (linux_tracefork_child): Use clone.
> >>         (linux_test_for_tracefork): Use clone; allocate and free a
> >> stack.
> >> 
> >> Daniel, can you look into it?
> >
> > It is an otherwise trivial use of clone.  Could someone with access
> > to an ia64-linux system try adding a clone2 case?
> 
> This seems to work:
> 
> 2007-12-19  Andreas Schwab  <schwab@suse.de>
> 
> 	* linux-low.c (STACK_SIZE): Define.
> 	(linux_tracefork_child): Use it.  Use __clone2 on ia64.
> 	(linux_test_for_tracefork): Likewise.
> 

It works for me. Can we check it in?

Thanks.


H.J.


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

* Re: gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64
  2007-12-21 15:47       ` H.J. Lu
@ 2007-12-21 15:56         ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-12-21 15:56 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Andreas Schwab, GDB

On Fri, Dec 21, 2007 at 07:47:42AM -0800, H.J. Lu wrote:
> > This seems to work:
> > 
> > 2007-12-19  Andreas Schwab  <schwab@suse.de>
> > 
> > 	* linux-low.c (STACK_SIZE): Define.
> > 	(linux_tracefork_child): Use it.  Use __clone2 on ia64.
> > 	(linux_test_for_tracefork): Likewise.
> > 
> 
> It works for me. Can we check it in?
> 
> Thanks.

Yes, the patch is OK.  Thanks, Andreas.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-12-21 15:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-19 17:42 gdb 6.7.50.20071219-cvs doesn't build on Linux/ia64 H.J. Lu
2007-12-19 17:51 ` H.J. Lu
2007-12-19 18:41   ` Daniel Jacobowitz
2007-12-19 21:08     ` Andreas Schwab
2007-12-21 15:47       ` H.J. Lu
2007-12-21 15:56         ` Daniel Jacobowitz

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