Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [rfa/dejagnu] Work around cygwin / expect background problem
Date: Thu, 01 Nov 2001 15:10:00 -0000	[thread overview]
Message-ID: <3BF0135D.9000902@cygnus.com> (raw)

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

Hello,

The attached patch tweeks dejagnu/lib/remote/exp so that it uses the 
shell's background rather than the TCL background operator when trying 
to kill a GDB that's gone wallkabout.

Turns out that expect on cygwin occasionaly and mysteriously die when 
executing the TCL background.  While the cygwin problems now appear 
fixed, the problem is still out there in the field :-(

look ok (fernando I guess?),

Andrew

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

2001-11-12  Andrew Cagney  <ac131313@redhat.com>

	* lib/remote.exp (local_exec, standard_close): Use SHELL
	background instead of tcl background to background the kill
	processes.  Work around cygwin/expect problem.

Index: lib/remote.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/remote.exp,v
retrieving revision 1.2
diff -p -r1.2 remote.exp
*** remote.exp	2001/10/30 15:20:05	1.2
--- remote.exp	2001/11/12 18:12:52
*************** proc local_exec { commandline inp outp t
*** 179,185 ****
      # command in order to execute the execution. (English. Gotta love it.)
      if { ! $got_eof } {
  	verbose "killing $pid $pgid";
! 	exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill -15 $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid)" &;
      }
      # This will hang if the kill doesn't work. Nothin' to do, and it's not ok.
      catch "close -i $spawn_id";
--- 179,188 ----
      # command in order to execute the execution. (English. Gotta love it.)
      if { ! $got_eof } {
  	verbose "killing $pid $pgid";
! 	# This is very, very nasty. SH, instead of EXPECT, is used to
! 	# run this in the background since, on cygwin, a strange file
! 	# I/O error occures.
! 	exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill -15 $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid) &";
      }
      # This will hang if the kill doesn't work. Nothin' to do, and it's not ok.
      catch "close -i $spawn_id";
*************** proc standard_close { host } {
*** 314,323 ****
  	}
  	if { $pid > 0 } {
  	    verbose "doing kill, pid is $pid";
! 	    # This is very, very nasty. Then again, if after did something
! 	    # reasonable...
  	    set pgid "-[join $pid { -}]";
! 	    exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid)" &;
  	}
  	verbose "pid is $pid";
  	catch "close -i $shell_id";
--- 317,327 ----
  	}
  	if { $pid > 0 } {
  	    verbose "doing kill, pid is $pid";
! 	    # This is very, very nasty. SH, instead of EXPECT, is used to
! 	    # run this in the background since, on cygwin, a strange file
! 	    # I/O error occures.
  	    set pgid "-[join $pid { -}]";
! 	    exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid) &";
  	}
  	verbose "pid is $pid";
  	catch "close -i $shell_id";

             reply	other threads:[~2001-11-12 18:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-01 15:10 Andrew Cagney [this message]
2001-11-02  7:14 ` Fernando Nasser
2001-11-02 13:49   ` Chris Faylor
2001-11-06  1:15     ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BF0135D.9000902@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox