From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: qq510371827 Newsgroups: gmane.emacs.bugs Subject: bug#12163: 24.1; Can not input anything or showing none output when debugging c/c++ application. Date: Fri, 10 Aug 2012 18:18:44 +0800 Message-ID: References: <83obmkdoli.fsf@gnu.org> <83ehnfdzgw.fsf@gnu.org> <837gt7dqjm.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf302078889b7eaa04c6e6ad64 X-Trace: dough.gmane.org 1344594008 25366 80.91.229.3 (10 Aug 2012 10:20:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2012 10:20:08 +0000 (UTC) To: 12163@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 10 12:20:08 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SzmK3-0006be-5J for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 12:20:03 +0200 Original-Received: from localhost ([::1]:55299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzmK1-0004Qa-O2 for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 06:20:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzmJv-0004MD-E6 for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 06:19:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzmJn-0004Kp-DB for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 06:19:55 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzmJn-0004Kl-9a for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 06:19:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SzmRl-00081z-Q2 for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 06:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: qq510371827 Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Aug 2012 10:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12163 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134459447730861 (code B ref -1); Fri, 10 Aug 2012 10:28:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Aug 2012 10:27:57 +0000 Original-Received: from localhost ([127.0.0.1]:46192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SzmRg-00081h-P4 for submit@debbugs.gnu.org; Fri, 10 Aug 2012 06:27:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51377) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SzmRe-00081a-PG for submit@debbugs.gnu.org; Fri, 10 Aug 2012 06:27:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzmJc-00049X-IH for submit@debbugs.gnu.org; Fri, 10 Aug 2012 06:19:40 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:36431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzmJc-00049K-E3 for submit@debbugs.gnu.org; Fri, 10 Aug 2012 06:19:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzmJZ-0004Cf-IL for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 06:19:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzmJR-000430-Nl for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 06:19:33 -0400 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:39081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzmJR-00042O-4r for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2012 06:19:25 -0400 Original-Received: by weys10 with SMTP id s10so1017963wey.0 for ; Fri, 10 Aug 2012 03:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=iKsnmPicAT5oqTfaFqYjDz46BFv9WgYMpXGULRt5O4A=; b=GhdJ14ttrjb9SSf4g+n2mGn7p27z+xIYDjgjwpm2vb3Ubb4abho3qKLUXJzaApZ7qE YVWTQHEl1BOpYuSzQ8wepRtRwwgx+EYv3rf/QmWDKlqGEdYkcfPh4nG7WNKr1GU/cq+W v/1a0Gz+uE7YqjMMgmqn7CHDeRBge9RBBXF+A0kM/trUh2E1yFwrWKxq6/mYxN9NkRhY uDIf7Hg5GDVPaE8RRiLlo0dj9HI/rC10S49Z2LAACh1bXyBlfCy4YkyqIGe+l8PpPiEP sTvW/I5B8OnERkkWYq6MsBazIlfQJQyjMRJ95hM4Sb4havuaQvq84xWhIGqI6f83MUmj 70dw== Original-Received: by 10.217.3.7 with SMTP id q7mr1493787wes.47.1344593964269; Fri, 10 Aug 2012 03:19:24 -0700 (PDT) Original-Received: by 10.216.210.19 with HTTP; Fri, 10 Aug 2012 03:18:44 -0700 (PDT) In-Reply-To: <837gt7dqjm.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62999 --20cf302078889b7eaa04c6e6ad64 Content-Type: text/plain; charset=ISO-8859-1 2012/8/10 Eli Zaretskii > > From: qq510371827 > > Date: Fri, 10 Aug 2012 17:14:14 +0800 > > > > > Try invoking GDB from Emacs like this: > > > > > > M-x gud-gdb RET > > > > > > If that doesn't help, either, then I'm clueless, sorry. Perhaps > > > someone else could help. > > > > > Thanks for your patience. It finally works. However, two other new > > problem appeared after using 'gud-gdb'. > > 1).the code, gdb information and out/input datas mixed together in the > same > > buffer and 'gdb-many-windows' command didn't work any more. > > This is expected. gud-gdb uses the old interface with GDB, which > doesn't support gdb-many-windows. > > > 2) You can refer this link: > > http://stackoverflow.com/questions/9676135/gud-gdb-emacs-24-not-working > > The same problem as mine. > > No, it isn't the same. Your problem was with getting input and output > to and from the debuggee. The above URL describes a much more serious > problem, whereby Emacs doesn't show the source code of functions you > step through. I don't see any of this in your original bug report > (and it surely works for me on MS-Windows). > I'm sorry.I got it wrong. > As for the original problem: could you please post here a minimal C > program that exhibits the problem with I/O when you use "M-x gdb"? I > will then try to look into the reasons of this and the possible ways > to solve that, when I have time. > > Thanks. > Ok,source code is as follows: #include "stdio.h" #include "ctype.h" #include "string.h" void Reverse(char* p,int n) { if(--n > 0) Reverse(p+1,n); printf("%c",*p); fflush(stdout); } int main() { //setbuf(stdin,NULL); //setbuf(stdout,NULL); // setvbuf(stdin,NULL,_IONBF,0); // setvbuf(stdout,NULL,_IONBF,0); //freopen("input.txt","r",stdin); char s[255],*p,*q; int i=0,n; fgets(s,255,stdin); s[strlen(s)-1] = ' '; p = q = s; // set breakpoint at this line. while(*p != '\0') { i++; p++; if(isspace(*p)) { n = i; i = 0; Reverse(q,n); q = p+1; } } n = i; Reverse(q,n); printf("\n"); return 0; } Thanks in advance. --20cf302078889b7eaa04c6e6ad64 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

2012/8/10 Eli Zaretskii <eliz@gnu.org>= ;
> From: qq510371827 <qq51037= 1827@gmail.com>
> Date: Fri, 10 Aug 2012 17:14:14 +0800
>
> > Try invoking GDB from Emacs like this:
> >
> > =A0 M-x gud-gdb RET
> >
> > If that doesn't help, either, then I'm clueless, sorry. = =A0Perhaps
> > someone else could help.
> >
> =A0Thanks for your patience. It finally works. However, two other new<= br> > problem appeared after using 'gud-gdb'.
> 1).the code, gdb information and out/input datas mixed together in the= same
> buffer and 'gdb-many-windows' command didn't work any more= .

This is expected. =A0gud-gdb uses the old interface with GDB, which doesn't support gdb-many-windows.

> 2) You can refer this link:
> =A0http://stackoverflow.com/questions/96761= 35/gud-gdb-emacs-24-not-working
> The same problem as mine.

No, it isn't the same. =A0Your problem was with getting input and= output
to and from the debuggee. =A0The above URL describes a much more serious problem, whereby Emacs doesn't show the source code of functions you step through. =A0I don't see any of this in your original bug report (and it surely works for me on MS-Windows).
I'm sorry.I got it wrong.=A0
As for the original problem: could you please post here a minimal C
program that exhibits the problem with I/O when you use "M-x gdb"= ? =A0I
will then try to look into the reasons of this and the possible ways
to solve that, when I have time.

Thanks.
Ok,source code is as follows:
#include "stdio.h"
= #include "ctype.h"
#include "string.h"

void= Reverse(char* p,int n)
{
=A0 =A0 if(--n > 0) Reverse(p+1,n);<= /div>
=A0 =A0 printf("%c",*p);=
=A0 =A0 fflush(stdout);
}
int main()
{
=A0 //setbuf(stdin,NULL);<= /font>
=A0 //setbuf(stdout,NULL);<= /div>
=A0 // setvbuf(stdin,NULL,_IONBF,0);
=A0 // setvbuf(stdout,NULL,_IONBF,0);
=A0 //freopen("input.txt","r&= quot;,stdin);
=A0 =A0 char s[255],*p,*q;
=A0 =A0 int i=3D0,n;
=A0 =A0 fgets(s,255,stdin);
=A0 =A0 s[strlen(s)-1] =3D ' ';
=A0 =A0 p =3D q =3D s; =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // =A0set breakpoint at this line.
=A0 =A0 while(*p !=3D '\0')
=A0 =A0 {
=A0 =A0 =A0 =A0 i++;
=A0 =A0 =A0 =A0 p++;
=A0 =A0 =A0 =A0 if(isspace(*p))
=A0 =A0 =A0 =A0 {
=A0 =A0 =A0 =A0 =A0 =A0 n =3D i;
<= font color=3D"#000099">=A0 =A0 =A0 =A0 =A0 =A0 i =3D 0;
=A0 =A0 =A0 =A0 =A0 =A0 Reverse(q,n);
=A0 =A0 =A0 =A0 =A0 =A0 q =3D p+1;
=A0 =A0 =A0 =A0 }
=A0 =A0 }
=A0 =A0 n = =3D i;
=A0 =A0 Reverse(q,n);
=A0 =A0 printf("\n");<= /div>
=A0 =A0 return 0;
}
Thanks in adva= nce.
--20cf302078889b7eaa04c6e6ad64--