Date: Mon, 22 Dec 1997 10:17:39 +0200 (IST) From: Eli Zaretskii To: "M. Schulter" cc: djgpp AT delorie DOT com Subject: Re: An IDE for UNIX In-Reply-To: <67ker3$1v9$1@vnetnews.value.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 22 Dec 1997, M. Schulter wrote: > Maybe Eli might have some comments here, and the question seems relevant > at least in emphasizing the different between MS-DOS limitations and > limitations of Emacs/gcc/gdb themselves. There's nothing mysterious here. Emacs uses certain library functions like `pipe' and `fork' to run GDB as a child process and establish a pipe through which it communicates with GDB. When you move a cursor or type a command in the Emacs buffer that shows the source being debugged, Emacs translates that to a GDB command and sends it down the pipe. GDB's input is redirected to the other end of that pipe, so it reads the command, executes it and outputs the results. The output of GDB is redirected to another pipe which Emacs reads and does whatever is appropriate. For example, if GDB prints a source line, Emacs moves the cursor to that line; if GDB prints a value of a variable, Emacs shows that in a special window; etc. We don't need too much to make this work on DOS. One thing we need is a way to preempt a child program to gain control of the CPU, and a way to return control to the child. This feature doesn't have to be true multi-programming; Emacs debug support will work even if the child program is only preempted when it reads its stdin or writes its stdout. After all, there's no need for GDB to get CPU time while it is waiting for input from Emacs, and Emacs doesn't really need to do anything while the GDB runs the debuggee. Another feature that is needed is a way to catch output of a child program and a way to feed it with input so that the pipe functionality could be implemented. This is quite simple to do for a child that is a DJGPP program, but that means that only DJGPP programs could be used in that way. Given the above two features, it's a relatively simple matter of making the Emacs asynchronous subprocess support work on DOS. When implemented, this support will immediately make integrated GDB, integrated spelling and other niceties work on MS-DOS.