X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_NEUTRAL X-Spam-Check-By: sourceware.org Message-ID: <4EA329A3.30800@cornell.edu> Date: Sat, 22 Oct 2011 16:37:55 -0400 From: Ken Brown User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: cygwin Subject: gdb problem Content-Type: multipart/mixed; boundary="------------020501000804040503070108" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------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 #include #include #include #include #include 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--