From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81778 invoked by alias); 1 Jun 2016 14:18:34 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 79693 invoked by uid 89); 1 Jun 2016 14:18:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-96.1 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=H*Ad:D*ne.jp, HTo:D*ne.jp, online, sleep X-HELO: calimero.vinschen.de Received: from ipbcc0227e.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.34.126) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Jun 2016 14:18:22 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 71B9AA807CC; Wed, 1 Jun 2016 16:18:20 +0200 (CEST) Date: Wed, 01 Jun 2016 14:18:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com, Takashi Yano Subject: Re: gdb pty problem [Was: emacs gud-interface is not updated after gdb command execution (maybe because of incomplete output from gdb)] Message-ID: <20160601141820.GF11431@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com, Takashi Yano References: <466943424.37628.394d161a-7219-415d-a659-0f774811ad2d.open-xchange@email.1und1.de> <44459aa0-4381-2368-ab63-5dffc26f3344@cornell.edu> <20160531094115.GE24015@calimero.vinschen.de> <34c9cf10-4930-a017-92fc-fd56171671b1@cornell.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oj4kGyHlBMXGt3Le" Content-Disposition: inline In-Reply-To: <34c9cf10-4930-a017-92fc-fd56171671b1@cornell.edu> User-Agent: Mutt/1.6.1 (2016-04-27) X-SW-Source: 2016-06/txt/msg00003.txt.bz2 --oj4kGyHlBMXGt3Le Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 4436 Hi Takashi, can you please have a look? Thanks, Corinna On Jun 1 08:51, Ken Brown wrote: > On 5/31/2016 5:41 AM, Corinna Vinschen wrote: > > Any chance you could bisect Cygwin to help finding the culprit? >=20 > The culprit is >=20 > commit 252a07b0ad3353abcd0fcd9b1b65ff977acd679e > Author: Takashi Yano > Date: Fri Apr 3 13:07:35 2015 +0900 >=20 > Cygwin hangs up if several keys are typed during outputting a lot of t= exts. >=20 > * fhandler_tty.cc (fhandler_pty_slave::read): Change calculation of > "readlen" not to use "bytes_in_pipe" value directly. >=20 >=20 > Reverting that commit fixes the problem. To test, compile and run the at= tached file. >=20 > $ gcc gdbstc.cc >=20 > $ ./a > 1-inferior-tty-set /dev/pty3 > 2-gdb-set height 0 > 3-gdb-set non-stop 1 > 4-file-list-exec-source-files > 5-file-list-exec-source-file > 6-gdb-show prompt > 7-stack-info-frame > 8-thread-info > 9-break-list > q > *** using gdb > =3Dthread-group-added,id=3D"i1" > ~"GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1\n" > ~"Copyright (C) 2015 Free Software Foundation, Inc.\n" > ~"License GPLv3+: GNU GPL version 3 or later \nThis is free software: you are free to change and redistribute it.\= nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying= \"\nand \"show warranty\" for details.\n" > ~"This GDB was configured as \"i686-pc-cygwin\".\nType \"show configurati= on\" for configuration details." > ~"\nFor bug reporting instructions, please see:\n" > ~".\n" > ~"Find the GDB manual and other documentation resources online at:\n.\n" > ~"For help, type \"help\".\n" > ~"Type \"apropos word\" to search for commands related to \"word\".\n" > =3Dcmd-param-changed,param=3D"auto-load safe-path",value=3D"/" > (gdb) > ... >=20 > In bad cases (bug present), the program hangs and doesn't complete until = the gdb process is killed from a different terminal. In good cases it runs= to completion. >=20 > Ken > #include > #include > #include > #include > #include > #include >=20 > void get_output (int fd); >=20 > int > main (int argc, const char **argv)=20 > { > int master; > pid_t pid; >=20 > if ((pid =3D forkpty (&master, NULL, NULL, NULL)) < 0) > { > perror ("forkpty"); > exit (1); > } > /* child */ > if (pid =3D=3D 0)=20 > { > const char *av[100]; > // putenv ("HOME=3D/tmp"); > int i =3D 0; > #ifdef STRACE_GDB > av[i++] =3D "strace"; > av[i++] =3D "-o"; > av[i++] =3D "/tmp/strace.out"; > #ifdef __CYGWIN__ > av[i++] =3D "--mask=3Dall+paranoid"; > #endif > #endif > av[i++] =3D argv[1] ?: "gdb"; > fprintf (stderr, "*** using %s\n", av[0]); > av[i++] =3D "-i=3Dmi"; > av[i] =3D NULL; > execvp (av[0], (char * const *) av); > /* shouldn't get here */ > exit (1); > } > /* parent */ > const char *input[20]; >=20 > int i =3D 0; > input[i++] =3D "1-inferior-tty-set /dev/pty3\n"; > input[i++] =3D "2-gdb-set height 0\n"; > input[i++] =3D "3-gdb-set non-stop 1\n"; > input[i++] =3D "4-file-list-exec-source-files\n"; > input[i++] =3D "5-file-list-exec-source-file\n"; > input[i++] =3D "6-gdb-show prompt\n"; > input[i++] =3D "7-stack-info-frame\n"; > input[i++] =3D "8-thread-info\n"; > input[i++] =3D "9-break-list\n"; > input[i++] =3D "q\n"; > input[i] =3D NULL; >=20 > for (int i =3D 0; input[i]; ++i) > { > write (master, input[i], strlen (input[i])); > // sleep (1); > } > get_output (master); > wait (NULL); > } >=20 > void > get_output (int fd) > { > char buf[4096]; >=20 > while (1) > { > int nread =3D read (fd, buf, sizeof (buf)); > if (nread > 0) > write (STDOUT_FILENO, buf, nread); > else > { > printf ("No more output. nread %d\n", nread); > break; > } > } > } >=20 >=20 > -- > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --oj4kGyHlBMXGt3Le Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXTu6sAAoJEPU2Bp2uRE+g/SIQAICUu1dTiZycE/bAmowuB8EV dl191B/+WrZ2b3I1mFapcYSNrdFT6n6tZGvru5D99TzsfQMXTXBWXKM+haWJYkq/ Vfza1y7hTxsWN3AmVCRF63VeD7Pc2Okdm4La72grZtKozHoetNEtnozE+Qh+cYMO FjvadVHIC92CokgKbA1DPGkRn+jI6s3WEOcUY/OQtM2rLIIBTkO2GVjaehgh8o/z NpYa6TvROViFyjv4yoJfmA9NU3+PrIT+bbkx4rUJkpPZmhB3JkE3j/NI/cQsI3C2 hk8oXry5jgzs3S0PlZm5aAWPN7yCLLPnFmuO46n1cL8IRRjpZxEUTNMj1YmEGlSc rVEqPxzTOFVbgteY+myhE/urDbwjzcx+nrBvPg5mTTn1zgNMdo6QKulz0WeBBBXb JmndqWVkunzu1PW0jwIf1fGjy67MHIlfYqqD/65VjWWG2Lqx6G0T3kMrQlkOvq6B oLPc5DEe/yFrXFBk7W9S0OvfUb7i5XI5d4boIxOw8622cPVYVfXcWMN4HpVMfk2F 7eZy/oHj8DxNST+jkSEHPiRscyJPH8Vgy1mgjLz8Db4XxkGts0+Zuq129tbAoUpI 3YA1jge7/4f/ggL5M2wOqwRl7l5Xlor1hxxEPqt1/vQ6S6Pvg+DbropUYH9grnAa vQWkJRXywauFZdhVL1ZG =tfU3 -----END PGP SIGNATURE----- --oj4kGyHlBMXGt3Le--