system() Call May Cause CodeView to Terminate Process

ID Number: Q57867

2.20 2.30 3.00 3.10 3.11 3.14

MS-DOS

buglist3.00 buglist3.10 buglist3.11 buglist3.14

Summary:

Using real-mode CodeView to trace over the system() run-time function

causes the debugger to terminate the parent process upon return from

the child process in certain situations where the child does a

multiple directory-level traversal.

Instead of tracing, use the "Go" Command (F5) to run past the system()

call. This procedure allows the program to run to completion.

The program below demonstrates this problem but it requires that

TREE.COM be somewhere in the path. Compile the code with the /Zi and

/Od options and, using F8, use CodeView to trace into the program.

After TREE.COM runs, CodeView will display the "Program terminated

normally" message, preventing the last printf() from being executed.

Microsoft has confirmed this to be a problem in CodeView versions 2.2,

2.3, 3.0, 3.1, 3.11, and 3.14. We are researching this problem and

will post new information here as it becomes available.

Sample Code

-----------

#include <process.h>

#include <stdio.h>

void main (void)

{

printf ("This is the beginning of the program\n");

printf ("Calling TREE.COM\n");

system ("tree");

/* This line will never be executed */

printf ("Back from spawn\n");

}

Additional reference words: buglist2.20 buglist2.30 2.2 2.20 2.30 2.30

2.35 3.0 3.00 3.1 3.10 3.11 3.14