Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* lib/libgloss.exp: wrap _exit.
@ 2002-03-25 17:29 Hans-Peter Nilsson
  2002-03-25 18:50 ` [DejaGnu] " Rob Savoye
  0 siblings, 1 reply; 6+ messages in thread
From: Hans-Peter Nilsson @ 2002-03-25 17:29 UTC (permalink / raw)
  To: dejagnu; +Cc: gdb-patches

The gcc test-suite, namely g++.old-deja/g++.mike/p755.C and
g++.old-deja/g++.mike/p755a.C calls _exit (0), not exit (0), in
order to avoid running destructors.  Since _exit isn't wrapped,
those tests will fail on targets needing testglue wrappers after
<URL:http://mail.gnu.org/pipermail/bug-dejagnu/2001-November/000125.html>
(a.k.a
<URL:http://sources.redhat.com/ml/gdb-patches/2001-11/msg00195.html>)
was applied.  I think it should be valid to call _exit in the
test-suite for the purpose, and so it should be properly
"wrapped".  I don't know what to do about those strange targets
already wrapping _exit instead of exit, but at least nothing
will change there with this patch.  The patch is against the
sourceware repo, but applies with no fuzz to the savannah repo.

(BTW, the sourceware and savannah dejagnu repos seem to be
drifting apart.)

2002-03-26  Hans-Peter Nilsson  <hp@bitrange.com>

	* lib/libgloss.exp (build_wrapper): Wrap _exit too, unless
	wrap_m68k_aout, uses_underscores or is_vxworks are defined in
	target_info.

	* testglue.c [!VXWORKS && !UNDERSCORES && !WRAP_M68K_AOUT]
	(REAL__EXIT): Define.
	[!UNDERSCORES && !WRAP_M68K_AOUT] (ORIG__EXIT): Define.
	[REAL__EXIT] (REAL__EXIT): Prototype.
	[ORIG__EXIT] (ORIG__EXIT): New function wrapper.
	(done_exit_message): New static variable.
	(ORIG_EXIT): Set done_exit_message.

Index: testglue.c
===================================================================
RCS file: /cvs/src/src/dejagnu/testglue.c,v
retrieving revision 1.1.1.1
diff -p -c -r1.1.1.1 testglue.c
*** testglue.c	1999/11/09 01:28:42	1.1.1.1
--- testglue.c	2002/03/26 00:39:29
***************
*** 12,18 ****
     because currently GNU ld doesn't deal well with a.out targets and
     the -wrap option. When GNU ld is fixed, this should definitely be
     removed. Note that we actually wrap __exit, not _exit on a target
!    that has UNDERSCORES defined. */

  #ifdef WRAP_M68K_AOUT
  #define REAL_EXIT(code) asm ( "trap %0" : : "i" (0) );
--- 12,19 ----
     because currently GNU ld doesn't deal well with a.out targets and
     the -wrap option. When GNU ld is fixed, this should definitely be
     removed. Note that we actually wrap __exit, not _exit on a target
!    that has UNDERSCORES defined.  On non-UNDERSCORE targets, we
!    wrap _exit separately; it's actually a different function.  */

  #ifdef WRAP_M68K_AOUT
  #define REAL_EXIT(code) asm ( "trap %0" : : "i" (0) );
***************
*** 29,37 ****
--- 30,42 ----
  #define ORIG_MAIN _wrap__main
  #else
  #define REAL_EXIT __real_exit
+ #ifndef VXWORKS
+ #define REAL__EXIT __real__exit
+ #endif
  #define REAL_MAIN __real_main
  #define REAL_ABORT __real_abort
  #define ORIG_EXIT __wrap_exit
+ #define ORIG__EXIT __wrap__exit
  #define ORIG_ABORT __wrap_abort
  #define ORIG_MAIN __wrap_main
  #endif
*************** extern void REAL_EXIT ();
*** 42,48 ****
--- 47,57 ----
  extern void REAL_ABORT ();
  extern int REAL_MAIN (int argc, char **argv, char **envp);
  #endif
+ #ifdef REAL__EXIT
+ extern void REAL__EXIT ();
+ #endif

+ static int done_exit_message = 0;
  int ___constval = 1;

  #ifdef VXWORKS
*************** ORIG_EXIT (code)
*** 81,89 ****
--- 90,121 ----
    ptr = write_int (code, buf + strlen(buf));
    *(ptr++) = '\n';
    write (1, buf, ptr-buf);
+   done_exit_message = 1;
    REAL_EXIT (code);
    while (___constval);
  }
+
+ #ifdef ORIG__EXIT
+ void
+ ORIG__EXIT (code)
+      int code;
+ {
+   char buf[30];
+   char *ptr;
+
+   /* Since exit may call _exit, we need to avoid a second message.  */
+   if (! done_exit_message)
+     {
+       strcpy (buf, "\n*** EXIT code ");
+       ptr = write_int (code, buf + strlen(buf));
+       *(ptr++) = '\n';
+       write (1, buf, ptr-buf);
+     }
+
+   REAL__EXIT (code);
+   while (___constval);
+ }
+ #endif

  void
  ORIG_ABORT ()
Index: lib/libgloss.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/libgloss.exp,v
retrieving revision 1.6
diff -p -c -r1.6 libgloss.exp
*** libgloss.exp	2002/02/09 02:09:06	1.6
--- libgloss.exp	2002/03/26 00:39:29
*************** proc build_wrapper { gluefile } {
*** 820,827 ****
  	set flags "";
  	if [target_info exists is_vxworks] {
  	    set flags "additional_flags=-DVXWORKS";
  	}
- 	set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort";
      }
      if [target_info exists wrap_compile_flags] {
  	lappend flags "additional_flags=[target_info wrap_compile_flags]";
--- 820,829 ----
  	set flags "";
  	if [target_info exists is_vxworks] {
  	    set flags "additional_flags=-DVXWORKS";
+ 	    set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort";
+ 	} else {
+ 	    set result "-Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort";
  	}
      }
      if [target_info exists wrap_compile_flags] {
  	lappend flags "additional_flags=[target_info wrap_compile_flags]";

brgds, H-P


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

* Re: [DejaGnu] lib/libgloss.exp: wrap _exit.
  2002-03-25 17:29 lib/libgloss.exp: wrap _exit Hans-Peter Nilsson
@ 2002-03-25 18:50 ` Rob Savoye
  2002-03-25 23:49   ` Hans-Peter Nilsson
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Savoye @ 2002-03-25 18:50 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: dejagnu, gdb-patches

On Mon, Mar 25, 2002 at 08:29:54PM -0500, Hans-Peter Nilsson wrote:

> was applied.  I think it should be valid to call _exit in the
> test-suite for the purpose, and so it should be properly
> "wrapped".  I don't know what to do about those strange targets

  Thanks, I just checked this into CVS on savannah. 

> (BTW, the sourceware and savannah dejagnu repos seem to be
> drifting apart.)
 
  I usually try to sync up with RedHat's branch occasionally, but it does
look like I need to go merge in a few patches. I see a few things in the
savannah branch that RedHat needs to merge in as well. I'm not 100% sure what
to do with the divergance, since the savannah CVS repository is the main one.

	- rob -


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

* Re: [DejaGnu] lib/libgloss.exp: wrap _exit.
  2002-03-25 18:50 ` [DejaGnu] " Rob Savoye
@ 2002-03-25 23:49   ` Hans-Peter Nilsson
  2002-03-26  9:44     ` Rob Savoye
  0 siblings, 1 reply; 6+ messages in thread
From: Hans-Peter Nilsson @ 2002-03-25 23:49 UTC (permalink / raw)
  To: Rob Savoye; +Cc: dejagnu, gdb-patches

On Mon, 25 Mar 2002, Rob Savoye wrote:
> On Mon, Mar 25, 2002 at 08:29:54PM -0500, Hans-Peter Nilsson wrote:
> > (BTW, the sourceware and savannah dejagnu repos seem to be
> > drifting apart.)
>
>   I usually try to sync up with RedHat's branch occasionally, but it does
> look like I need to go merge in a few patches. I see a few things in the
> savannah branch that RedHat needs to merge in as well. I'm not 100% sure what
> to do with the divergance, since the savannah CVS repository is the main one.

Oh, that remark was directed to the gdb people, which according
to MAINTAINERS (in the src repo) are the closest of kin on the
sourceware side:  "Generic patches to
gdb-patches@sources.redhat.com".  (BTW, that entry is
out-of-date, listing sourceforge as main site.)

brgds, H-P


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

* Re: [DejaGnu] lib/libgloss.exp: wrap _exit.
  2002-03-25 23:49   ` Hans-Peter Nilsson
@ 2002-03-26  9:44     ` Rob Savoye
  2002-03-26 10:24       ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Savoye @ 2002-03-26  9:44 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: dejagnu, gdb-patches

On Tue, Mar 26, 2002 at 02:49:32AM -0500, Hans-Peter Nilsson wrote:

> Oh, that remark was directed to the gdb people, which according
> to MAINTAINERS (in the src repo) are the closest of kin on the
> sourceware side:  "Generic patches to
> gdb-patches@sources.redhat.com".  (BTW, that entry is
> out-of-date, listing sourceforge as main site.)
  
  Here's a patch:

Index: MAINTAINERS
===================================================================
RCS file: /cvs/src/src/MAINTAINERS,v
retrieving revision 1.14
diff -u -B -b -w -r1.14 MAINTAINERS
--- MAINTAINERS	2001/12/05 10:07:09	1.14
+++ MAINTAINERS	2002/03/26 17:41:15
@@ -30,8 +30,8 @@
 	in via a merge.
 
 dejagnu/
-	Notify http://dejagnu.sourceforge.net/ of generic changes.
-	Generic patches to gdb-patches@sources.redhat.com;
+	Notify http://www.gnu.org/software/dejagnu/ of generic changes.
+	Generic patches to bug-dejagnu@gnu.org;
 	Other dependents of dejagnu include sid@, binutils@, gcc@, etc.
 
 gdb/; mmalloc/; readline/; sim/; GDB's part of include/ & dejagnu/

	- rob -


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

* Re: [DejaGnu] lib/libgloss.exp: wrap _exit.
  2002-03-26  9:44     ` Rob Savoye
@ 2002-03-26 10:24       ` Andrew Cagney
  2002-04-07 12:16         ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2002-03-26 10:24 UTC (permalink / raw)
  To: Rob Savoye; +Cc: Hans-Peter Nilsson, dejagnu, gdb-patches

>  dejagnu/
> -	Notify http://dejagnu.sourceforge.net/ of generic changes.
> -	Generic patches to gdb-patches@sources.redhat.com;
> +	Notify http://www.gnu.org/software/dejagnu/ of generic changes.
> +	Generic patches to bug-dejagnu@gnu.org;
>  	Other dependents of dejagnu include sid@, binutils@, gcc@, etc.

FYI, the gdb-patches@ reference is for changes being committed to the 
local (on sources) not official (on savana) version of dejagnu.  I 
believe that reference should also.  I'll update the top level 
MAINTAINERS file accordingly.

Andrew


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

* Re: [DejaGnu] lib/libgloss.exp: wrap _exit.
  2002-03-26 10:24       ` Andrew Cagney
@ 2002-04-07 12:16         ` Andrew Cagney
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2002-04-07 12:16 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Rob Savoye, Hans-Peter Nilsson, dejagnu, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

>  dejagnu/
> -    Notify http://dejagnu.sourceforge.net/ of generic changes.
> -    Generic patches to gdb-patches@sources.redhat.com;
> +    Notify http://www.gnu.org/software/dejagnu/ of generic changes.
> +    Generic patches to bug-dejagnu@gnu.org;
>      Other dependents of dejagnu include sid@, binutils@, gcc@, etc.
> 
> FYI, the gdb-patches@ reference is for changes being committed to the local (on sources) not official (on savana) version of dejagnu.  I believe that reference should also.  I'll update the top level MAINTAINERS file accordingly.
> 
> Andrew 

FYI,  I've checked into the src repository.  Hopefully it helps.

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 943 bytes --]

2002-04-07  Andrew Cagney  <ac131313@redhat.com>

	* MAINTAINERS: Update dejagnu/

Index: MAINTAINERS
===================================================================
RCS file: /cvs/src/src/MAINTAINERS,v
retrieving revision 1.16
diff -u -r1.16 MAINTAINERS
--- MAINTAINERS	16 Jan 2002 23:20:25 -0000	1.16
+++ MAINTAINERS	7 Apr 2002 19:14:10 -0000
@@ -33,9 +33,12 @@
 		gdb-patches@sources.redhat.com
 
 dejagnu/
-	Notify http://dejagnu.sourceforge.net/ of generic changes.
-	Generic patches to gdb-patches@sources.redhat.com;
-	Other dependents of dejagnu include sid@, binutils@, gcc@, etc.
+	Send all patches to:
+	http://www.gnu.org/software/dejagnu/
+	mail:bug-dejagnu@gnu.org
+	For changes to the local repostory, send them to
+	gdb-patches@sources.redhat.com when generic; and sid@,
+	binutils@, gcc@, etc. for sub-components.
 
 gdb/; mmalloc/; readline/; sim/; GDB's part of include/ & dejagnu/
 	gdb: http://sources.redhat.com/gdb/

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

end of thread, other threads:[~2002-04-07 19:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-25 17:29 lib/libgloss.exp: wrap _exit Hans-Peter Nilsson
2002-03-25 18:50 ` [DejaGnu] " Rob Savoye
2002-03-25 23:49   ` Hans-Peter Nilsson
2002-03-26  9:44     ` Rob Savoye
2002-03-26 10:24       ` Andrew Cagney
2002-04-07 12:16         ` Andrew Cagney

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