( ESNUG 362 Item 5 ) --------------------------------------------- [11/30/00]

Subject: ( ESNUG 359 #8 )  Other UNIX Tips & Tricks For Those Long EDA Runs

> I got hit by a little gotcha recently that I thought I should share.
>
> I've got into the habbit of using the "dc_shell | tee logfile" syntax for
> interactive debugging so I can have a logfile for the session.  One nice
> thing about interactive sessions, is that a control-C will allow you to
> checkpoint, or stop something that is compiling into oblivion & see what's
> wrong.  This may be very obvious to some, but I found out the hard way
> that when using the " | tee" syntax, the control-C is passed to the "tee"
> instead of the dc_shell session.  This basically breaks the pipe and stops
> the job, with no way that I could find to recover.  Any UNIX gurus out
> there know how to recover if this happens?  To prevent this, make sure
> to use the -i switch on tee, which tells it to ignore interrupts:
>
>                       "dc_shell | tee -i logfile"
>
> This allows the use of control-C for dc_shell.
>
>     - Bob Wiegand
>       NxtWave Communications                     Langhorne, PA


From: Sangeetha Narayan <sangeetha@ctl.creative.com>
To: Robert Wiegand <rwiegand@nxtwavecomm.com>

Hi Bob!

I found something that might be useful!  You can send a ctrl-c to dc_shell
(or any process for that matter) by using the command kill -INT 
This sends an interrupt or a Ctrl-C equivalent to the dc_shell running in
the background.  Send it once if you are using it to get a checkpoint.db,
twice for aborting optimization, and three times to kill the process.

    - Sangeetha Narayan
      Creative Technology Ltd.                   Singapore

         ----    ----    ----    ----    ----    ----   ----

From: Robert Wiegand <rwiegand@nxtwavecomm.com>
To: Sangeetha Narayan <sangeetha@ctl.creative.com>

Hi Sangeetha,

I'm glad to hear that post helped you.  I had to 'kill -9' as well, losing
30 hours of run time, bummer!  I haven't found any way to recover yet, the
safest bet may be to alias tee to "tee -i".  Before discovering the "| tee",
I used to do:

   dc_shell -f script > logfile &
   tail -f logfile

This would give me a running log as if it were an active session.  If
something died, I would control C the tail, fg the background process, and
then be able to blindly type into the dc session.  I could open another
window, and tail -f the logfile once again.  This would allow me to type in
one window and see the output in another window.  The one advantage to this
is that backgrounding the process gives in an automatic "nohup", so if
you're remote logging to a process server, and your user session dies, the
process keeps running on the process server.  I've tried typing nohup
infront of the "| tee" syntax, and it runs, but I havn't tried to kill the
user session to see if the process still runs on the process server.

    - Bob Wiegand
      NxtWave Communications                     Langhorne, PA

         ----    ----    ----    ----    ----    ----   ----

From: Christian Michon <christian.michon@st.com>

Hi John,

I read the small tip from Robert Wiegand and found it very useful.  Let me
share one, too.  For those unfortunate few who would have spent hours of run
time and who would discover with horror they forgot the -i to the tee, you
can just do a "kill -INT <>" where PID is the number of the process ID
of your dc_shell_exec.  This works nicely with the UNIX utility "top".

A "kill -INT ..." in unix is equivalent to a "CTRL-C".

Do it once to save a checkpoint, do it twice to abort the current
optimization and go on with your script, do it a third time and it'll
die.  I hope this is useful for those who sometimes forget the -i, or even
lost the terminal where they launched the command.

    - Christian Michon
      STMicro

         ----    ----    ----    ----    ----    ----   ----

From: Patrick Harkin <paharkin@micron.com>

John,

A trick I like to use for that is to create a small shell script (I call it
xdc) which opens an xterm and runs dc_shell.  Here's the xdc cshell script.

  #
  mv log.$1.log olog.$1.log
  xterm -geometry 80x33+0+30 -l -lf log.$1.log -fn 7x13bold -ls \
        -sb -n synop -fg moccasin -bg black -cr \#0ef -bd \#0ef \
        -ms \#0ef -sl 500 -bw 2 -e
  dc_shell -f $1 

The session is completely logged as with the tee and you can Control-C the
run within the new xterm.  So if you run "xdc module.scr", you will have
log.module.scr.log when you're done and the previous log file is moved to
olog.module.scr.log.  

    - Patrick Harkin
      Micron Technology Inc.


 Sign up for the DeepChip newsletter.
Email
 Read what EDA tool users really think.


Feedback About Wiretaps ESNUGs SIGN UP! Downloads Trip Reports Advertise

"Relax. This is a discussion. Anything said here is just one engineer's opinion. Email in your dissenting letter and it'll be published, too."
This Web Site Is Modified Every 2-3 Days
Copyright 1991-2024 John Cooley.  All Rights Reserved.
| Contact John Cooley | Webmaster | Legal | Feedback Form |

   !!!     "It's not a BUG,
  /o o\  /  it's a FEATURE!"
 (  >  )
  \ - / 
  _] [_     (jcooley 1991)