Re: Problems with C++ program

From: Teds Ups List (
Date: Tue May 08 2001 - 16:57:34 BST

I wrote:

>The second is that ups seems to run the program automatically (i.e. as if the -go option were
>specified).  If the program starts up successfully, the ups window is never displayed. If it fails
>(and hence exits) the ups window is displayed (after I get the startup error messages) and I
>can debug normally. I tried specifying the -go option, and the program ran *twice* before
>the ups window was displayed.

This seems to be timing related. I ran ups 3.35 under itself ("ups ups -a <prog>"). There
seems to be a critical section around the vfork() in ao_elflib.c. Here is the code:

 if ((pid = vfork()) == -1) {
	    errf("Vfork failed: %s", get_errno_str());
	    free((char *)envp);
	    return FALSE;
    if (pid == 0) {
	    if (fds[1] != 1)
		    dup2(fds[1], 1);
	    execle(textpath, textpath, (char *)NULL, envp);
	    failmesg("Can't exec", "", textpath);

    free((char *)envp);

I found that if I put a breakpoint on the "if (pid == 0)") and continue from it, the debugged
program does not run before ups comes up, and everything works as expected.

If I move the breakpoint down to the next executed statement ( "free((char *)envp);",
then the debugged program runs before ups comes up (and before the breakpoint is reached).

That's as far as I've been able to trace things. I suppose the next thing is to start putting sleeps in the code to see if that
helps, but I don't have time right now.

I hope that helps narrow down the problem.

P.S. To repeat, I'm seeing this problem on Red Hat 6.2, with both ups and my program compiled with gcc/g++ 2.95.2.

This archive was generated by hypermail 2.1.4 : Wed Feb 13 2002 - 21:51:33 GMT