Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem Generating Profiling Data (gmon.out) from Spawned Process in Expect

135 views
Skip to first unread message

noluckmurphy

unread,
Feb 16, 2006, 1:12:00 AM2/16/06
to
I'm fairly new to Expect/TCL and am stuck on a problem for which I
think I know the root cause but do not know how to go about correcting
it.

I'm testing a fairly small (4K LOC) interactive program and have built
an expect/perl from scratch to test it (this is for an intro software
engineeing class).

The program is compiled with all the necessary flags in g++ for
profiling and coverage statistics. When run from the command line, all
the profile output files are updated nicely as they should be (most
importantly, gmon.out, gprof's main output). However, when I spawn
this process and interact with it through my expect script, and after
it terminates normally (i.e. no crashes), the gmon.out file does not
exist.

I'm assuming that somewhere between the spawning of the process by
Expect and the end of the script, the background things that should be
happening are being "eaten" by Expect.

Is there an easy way to solve this problem? I have Exploring Expect if
someone could refer me to a page in there, too.

noluckmurphy

unread,
Feb 16, 2006, 2:03:18 AM2/16/06
to
This is taken from the gprof man page--I don't if it helps at all.

"The profiled program must call exit(2) or return normally for the
profiling information to be saved in the gmon.out file."

noluckmurphy

unread,
Feb 16, 2006, 4:41:41 PM2/16/06
to
When the program is spawned within Expect and ometime later given an
"interact" command, the gmon.out file is generated.

The problem occurs only when Expect closes the program itself.

noluckmurphy

unread,
Feb 16, 2006, 5:54:20 PM2/16/06
to
It's official...I'm a moron. When the program and script worked
successfully, I was not issuing an explicit 'exit' command.

Sorry for wasting anyone's time who has read this far.

0 new messages