*BSD News Article 71721


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!newsfeed.internetmci.com!news.ac.net!news.bconnex.net!news1.erols.com!newsmaster@erols.com
From: Ken Bigelow <kbigelow@www.play-hookey.com>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Alarms & gdb
Date: Sat, 22 Jun 1996 10:29:31 -0700
Organization: Erols Internet Services
Lines: 40
Message-ID: <31CC2D7B.77B0@www.play-hookey.com>
References: <4q8msm$j0o@news.IAEhv.nl>
NNTP-Posting-Host: kenjb05.play-hookey.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.02 (Win16; I)

Hans Zuidam wrote:
> 
> Hi,
> 
> I have a problem debugging a program which uses the interval timer to
> periodically do some work. Each time I try to continue after a
> breakpoint, the alarm has gone off and I get dumped back into gdb.  The
> net effect is that after the first breakpoint no debugging is possible.
> 
> A solution might be for the program to detect that it is beeing stopped
> (possibly by gdb) and turn off the interval timer before giving control
> back to gdb.  Is that possible or are there better ways around this?
> 
> Thanks in advance,
>                                         Hans

This may not fit your requirements, but it may work for you.

It sounds as if you essentially have two tasks: one occurring at regular 
intervals and one monitoring the regular task. The first question is, 
what is the interval for the regular task? Could the crom daemon control 
the timing, with perhaps a control file to tell the regular task's script 
whether or not to take action? If so, the controlling program could work 
by just setting a flag in the control file, which the script controlling 
the regular task would reset.

This approach would also split your debugging into two phases: the 
regular task which you can control by manually setting the control file, 
and the controlling task which will automate what you started doing 
manually.

Of course, the cron daemon runs once a minute, so your task can only run 
at integer multiples on one minute intervals. However, if it must run at 
smaller, but accurate, intervals, you may be shot down anyway -- there 
are two many concurrent tasks going on for the system to guarantee 
handling seconds precisely by task.

I hope this at least sparks an idea!

Ken