Mail Archives: cygwin/2011/10/22/16:38:23
--------------020501000804040503070108
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
The attached testcase illustrates a problem with `gdb -i=mi'. I've
tested both gdb 7.3.50-1 and 7.3.50-2, with cygwin 1.7.9 as well as with
several recent snapshots (including 2011-10-22).
Under some circumstances, if gdb -i=mi is started and given several
input lines at once, it only prints part of the output before stopping.
I've been able to reproduce this once in a while while working
interactively (by copying and pasting the whole bunch of input lines);
in this case one can press Return to get the rest of the output. But
the problem happens consistently with the attached test case, which runs
gdb in a subprocess. One has to kill the gdb process before the main
program exits.
The STC runs as expected on Linux.
The particular input lines I gave gdb are precisely those that emacs
sends in the problem I reported in
http://cygwin.com/ml/cygwin/2011-10/msg00357.html .
I don't know if this is relevant.
Ken
--------------020501000804040503070108
Content-Type: text/plain;
name="stc.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="stc.c"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pty.h>
#include <string.h>
#include <sys/wait.h>
void get_output (int fd);
int
main ()
{
int master;
pid_t pid;
if ((pid = forkpty (&master, NULL, NULL, NULL)) < 0)
{
perror ("forkpty");
exit (1);
}
/* child */
if (pid == 0)
{
char *argv[3];
argv[0] = "gdb";
argv[1] = "-i=mi";
argv[2] = '\0';
execvp (argv[0], argv);
/* shouldn't get here */
exit (1);
}
/* parent */
char *input[10];
input[0] = "1-inferior-tty-set /dev/pty3\n";
input[1] = "2-gdb-set height 0\n";
input[2] = "3-gdb-set non-stop 1\n";
input[3] = "4-file-list-exec-source-files\n";
input[4] = "5-file-list-exec-source-file\n";
input[5] = "6-gdb-show prompt\n";
input[6] = "7-stack-info-frame\n";
input[7] = "8-thread-info\n";
input[8] = "9-break-list\n";
input[9] = "q\n";
int i;
for (i = 0; i < 10; ++i)
write (master, input[i], strlen (input[i]));
get_output (master);
wait (NULL);
}
void
get_output (int fd)
{
#define BUFSIZE 1024
char buf[BUFSIZE];
int i;
for (i = 0; i < 10; ++i)
{
int nread;
nread = read (fd, buf, BUFSIZE);
if (nread > 0)
write (STDOUT_FILENO, buf, nread);
else
{
printf ("No more output.\n");
break;
}
}
}
--------------020501000804040503070108
Content-Type: text/plain; charset=us-ascii
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--------------020501000804040503070108--
- Raw text -