GNU bug report logs - #12163
24.1; Can not input anything or showing none output when debugging c/c++ application.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: qq510371827 <qq510371827@HIDDEN>; merged with #12180; dated Thu, 9 Aug 2012 16:00:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Removed tag(s) patch. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
Added tag(s) patch. Request was from David Edmondson <dme@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug No longer marked as fixed in versions 24.4 and reopened. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.

Message received at 12163 <at> debbugs.gnu.org:


Received: (at 12163) by debbugs.gnu.org; 18 Dec 2012 13:51:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 18 08:51:57 2012
Received: from localhost ([127.0.0.1]:48425 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TkxaO-0006hN-OO
	for submit <at> debbugs.gnu.org; Tue, 18 Dec 2012 08:51:57 -0500
Received: from mout.gmx.net ([212.227.15.18]:59652)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <michael.albinus@HIDDEN>) id 1TkxaK-0006h3-Nr
	for 12163 <at> debbugs.gnu.org; Tue, 18 Dec 2012 08:51:54 -0500
Received: from mailout-de.gmx.net ([10.1.76.10]) by mrigmx.server.lan
	(mrigmx002) with ESMTP (Nemesis) id 0MRQfu-1TeGXX2EPo-00Sj2m for
	<12163 <at> debbugs.gnu.org>; Tue, 18 Dec 2012 14:50:31 +0100
Received: (qmail invoked by alias); 18 Dec 2012 13:50:31 -0000
Received: from p57BB97C7.dip0.t-ipconnect.de (EHLO detlef.gmx.de)
	[87.187.151.199]
	by mail.gmx.net (mp010) with SMTP; 18 Dec 2012 14:50:31 +0100
X-Authenticated: #3708877
X-Provags-ID: V01U2FsdGVkX1+c2WxH8kWcVYu1Xj1SMKX1jiCjc+GuCdgF0v3Bqy
	EQv2X5mkveiBmm
From: Michael Albinus <michael.albinus@HIDDEN>
To: control <at> debbugs.gnu.org
Subject: Re: control message for bug #12163
References: <87d2y78omg.fsf@HIDDEN>
Date: Tue, 18 Dec 2012 14:50:27 +0100
In-Reply-To: <87d2y78omg.fsf@HIDDEN> (Michael Albinus's message of "Tue, 18
	Dec 2012 14:40:39 +0100")
Message-ID: <877gof8o64.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Y-GMX-Trusted: 0
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 12163
Cc: 12163 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -0.0 (/)

reopen 12163

Sorry, the closure was accidental.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.
bug marked as fixed in version 24.4, send any further explanations to 12163 <at> debbugs.gnu.org and qq510371827 <qq510371827@HIDDEN> Request was from Michael Albinus <michael.albinus@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) fixed. Request was from Michael Albinus <michael.albinus@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 12163 12180. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 12163 <at> debbugs.gnu.org:


Received: (at 12163) by debbugs.gnu.org; 11 Aug 2012 14:39:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 11 10:39:29 2012
Received: from localhost ([127.0.0.1]:49475 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1T0Cqe-0000uZ-Vt
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 10:39:29 -0400
Received: from mtaout23.012.net.il ([80.179.55.175]:59770)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eliz@HIDDEN>) id 1T0Cqc-0000uQ-Mx
	for 12163 <at> debbugs.gnu.org; Sat, 11 Aug 2012 10:39:28 -0400
Received: from conversion-daemon.a-mtaout23.012.net.il by
	a-mtaout23.012.net.il (HyperSendmail v2007.08) id
	<0M8L00D00HL4U000@HIDDEN> for
	12163 <at> debbugs.gnu.org; Sat, 11 Aug 2012 17:31:03 +0300 (IDT)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0M8L00DQAHNROP90@HIDDEN>;
	Sat, 11 Aug 2012 17:31:03 +0300 (IDT)
Date: Sat, 11 Aug 2012 17:31:12 +0300
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#12163: 24.1;
	Can not input anything or showing none output when debugging
	c/c++	application.
In-reply-to: <CAORnh3iNywhP_MDMt=7AiX_c-UvZqU=5NrbTEQmA=aB2pfTzCw@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: qq510371827 <qq510371827@HIDDEN>
Message-id: <83obmhcxfz.fsf@HIDDEN>
References: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
	<83obmkdoli.fsf@HIDDEN>
	<CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
	<83ehnfdzgw.fsf@HIDDEN>
	<CAORnh3guaiS0feFz3kH47fyp3JqkyBtfujKxFQ4TZetwZSjLTA@HIDDEN>
	<837gt7dqjm.fsf@HIDDEN>
	<CAORnh3icm+MjYUOUbKfihcJdekMNKgztT0ghw2P3fFS+bnaMVQ@HIDDEN>
	<83628qeikl.fsf@HIDDEN>
	<CAORnh3iNywhP_MDMt=7AiX_c-UvZqU=5NrbTEQmA=aB2pfTzCw@HIDDEN>
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 12163
Cc: 12163 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

> From: qq510371827 <qq510371827@HIDDEN>
> Date: Sat, 11 Aug 2012 20:32:56 +0800
> 
> Thanks for your good work. The problem I encountered on windows is just as
> you have described.But on linux(i am running ubuntu 12.04 under virtualbox)
> ,it works for me.

What version of Emacs do you have on Ubuntu, and what version of GDB?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Aug 2012 12:42:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 11 08:42:09 2012
Received: from localhost ([127.0.0.1]:48332 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1T0B17-0006Sy-5N
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 08:42:09 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54814)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <qq510371827@HIDDEN>) id 1T0B13-0006So-Fl
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 08:42:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1T0Asw-0004dj-JQ
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 08:33:44 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,
	FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE,
	RCVD_IN_DNSWL_HI, 
	T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:33213)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1T0Asw-0004de-Fn
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 08:33:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35927)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1T0Asu-0004zP-NV
	for bug-gnu-emacs@HIDDEN; Sat, 11 Aug 2012 08:33:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1T0Ass-0004d7-Px
	for bug-gnu-emacs@HIDDEN; Sat, 11 Aug 2012 08:33:40 -0400
Received: from mail-wi0-f169.google.com ([209.85.212.169]:57531)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1T0Ass-0004cy-EP
	for bug-gnu-emacs@HIDDEN; Sat, 11 Aug 2012 08:33:38 -0400
Received: by wibhm2 with SMTP id hm2so1757979wib.0
	for <bug-gnu-emacs@HIDDEN>; Sat, 11 Aug 2012 05:33:37 -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=68vFkueorY8iuUPws+pf8ytS1mSyTOFGmCx0v7/ydrU=;
	b=F3QRKhNTpv05Tzb4Pw3ORGULzEKZOw0hqaFrfhK6P+ssGKnPtwlM8UGeskqSBxURg7
	d3ZJsNA0aoEWS5B4QciKDkW/ObPtz8QDAtp2zzxy55VJMDo6q1z860942fcMxoq8s+is
	SOUV/t9BzLHyznls19LK2VmgbJbnFcG74iS+EgW9x92sc0CM73njbJhmxzsny3g07AvW
	SHb3juqjlENROz6cyEOS5QcREFtxlOoGiEkxe5I85ABHnL0KcdvL+cVqsQ8tvHOdpDKW
	39SsIDpJJ+E6GVnKmP3Vaj34V1MMvNHfne97UUcxayN0p4JgnZipEEcPp6ZWB19uckgS
	4rnQ==
Received: by 10.217.3.7 with SMTP id q7mr3420840wes.47.1344688417019; Sat, 11
	Aug 2012 05:33:37 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.216.210.19 with HTTP; Sat, 11 Aug 2012 05:32:56 -0700 (PDT)
In-Reply-To: <83628qeikl.fsf@HIDDEN>
References: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
	<83obmkdoli.fsf@HIDDEN>
	<CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
	<83ehnfdzgw.fsf@HIDDEN>
	<CAORnh3guaiS0feFz3kH47fyp3JqkyBtfujKxFQ4TZetwZSjLTA@HIDDEN>
	<837gt7dqjm.fsf@HIDDEN>
	<CAORnh3icm+MjYUOUbKfihcJdekMNKgztT0ghw2P3fFS+bnaMVQ@HIDDEN>
	<83628qeikl.fsf@HIDDEN>
From: qq510371827 <qq510371827@HIDDEN>
Date: Sat, 11 Aug 2012 20:32:56 +0800
Message-ID: <CAORnh3iNywhP_MDMt=7AiX_c-UvZqU=5NrbTEQmA=aB2pfTzCw@HIDDEN>
Subject: Re: bug#12163: 24.1; Can not input anything or showing none output
	when debugging c/c++ application.
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=20cf302078886e18ea04c6fcabbe
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-Received-From: 208.118.235.17
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

--20cf302078886e18ea04c6fcabbe
Content-Type: text/plain; charset=ISO-8859-1

Thanks for your good work. The problem I encountered on windows is just as
you have described.But on linux(i am running ubuntu 12.04 under virtualbox)
,it works for me.
Here is the session on linux:
Reading symbols from /home/darks/Reverse...done.
(gdb) b 22
Breakpoint 1 at 0x80485e4: file Reverse.c, line 22.
(gdb) start
Temporary breakpoint 2 at 0x8048586: file Reverse.c, line 12.
Starting program: /home/darks/Reverse

At this point, I see the source in another window with the black arrow at
line 12 and the red breakpoint at line 22.
then,

(gdb) cotinue
continuing.

At this point,Nothing changed in the source code window .The debuggee hung
and is waitting input. So i input some values in IO buffer window and press
RET,the gdb session shows:

(gdb)

Now, the arrow goes into line 22 and hits the breakpoint.
Then :

(gdb) continue
or doing this repeatly: (gdb) next
The debuggee works very well.it showed all of the output in the IO buffer
window and normally terminted at last. That's all, just for your
information only. Thanks.
2012/8/11 Eli Zaretskii <eliz@HIDDEN>

> I looked into this.  The problem seems to be that gdb-mi.el is
> confused wrt which text typed by the user to send to GDB and which to
> the program being debugged.
>
> Here's the session on Windows:
>
>   Reading symbols from d:/usr/eli/data/rev.exe...done.
>   (gdb) break 22
>   Breakpoint 1 at 0x4013ae: file rev.c, line 22.
>   (gdb) start
>   Temporary breakpoint 2 at 0x40136f: file rev.c, line 19.
>   Starting program: d:/usr/eli/data/rev.exe
>   [New Thread 2120.0x165c]
>
>   Temporary breakpoint 2, main () at rev.c:19
>   19        int i=0,n;
>
> At this point, I see the source in another window with the arrow at
> line 19 and the breakpoint I set at line 22.
>
> Now:
>
>   (gdb) continue
>   Continuing.
>
>   Breakpoint 1, main () at rev.c:22
>   22        p = q = s;                  //  set breakpoint at this line.
>   (gdb) print s
>   $1 = "23-thread-info --thread 1 \000 ..."
>
> That "23-thread-info --thread 1" thing is a command sent by gdb-mi.el
> to GDB.  But since the debbuggee is reading stdin with fgets, the
> command ends up in the buffer read by fgets.  Which explains why the
> program doesn't stop when fgets is called: the call to fgets returns
> immediately with the above command as its input.
>
> I tried to work around this by commenting out the "-thread-info"
> command sent here:
>
>   (defun gdb-starting (_output-field)
>     ;; CLI commands don't emit ^running at the moment so use gdb-running
> too.
>     (setq gdb-inferior-status "running")
>     (gdb-force-mode-line-update
>      (propertize gdb-inferior-status 'face font-lock-type-face))
>     (setq gdb-active-process t)
>     (setq gud-running t)
>     ;; GDB doesn't seem to respond to -thread-info before first stop or
>     ;; thread exit (even in non-stop mode), so this is useless.
>     ;; Behavior may change in the future.
>     (gdb-emit-signal gdb-buf-publisher 'update-threads))  <<<<<<<<<<<<<
>
> Then I do get a chance to type some text when the debuggee is stuck in
> fgets.  But what winds up in the buffer read by fgets is
>
>   -interpreter-exec console "TEXT"
>
> where TEXT is what I typed.  Evidently, gdb-mi thinks that what I
> typed is a GDB command, so it wraps it with -interpreter-exec.
>
> The above was on MS-Windows.  On GNU/Linux, I see a slightly different
> manifestation of what seems to be the same problem: there, I cannot
> get the debuggee to continue after I type some text that is supposed
> to be read by fgets.  Sounds like the input never gets to the
> debuggee, or maybe the debuggee's stdin is not line-buffered for some
> reason.  In any case, the call to fgets never returns.
>
> So I no longer think this is a Windows-specific problem, and my
> original assertion that it has to do with different buffering on
> Windows seems to be incorrect.
>
> Perhaps someone who knows more about GUD and comint in general could
> chime in and find out what is wrong here.  Or at least explain what
> should be done in gdb-mi to treat separately GDB commands and input to
> the debuggee.  Evidently, the old gud-gdb way of running GDB did that
> correctly.
>

--20cf302078886e18ea04c6fcabbe
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks for your good work. The problem I encountered on windows is just as =
you have described.But on linux(i am running ubuntu 12.04 under virtualbox)=
 ,it works for me.<div>Here is the session on linux:</div><div><font color=
=3D"#000066">Reading symbols from /home/darks/Reverse...done.</font></div>

<div><font color=3D"#000066">(gdb) b 22</font></div><div><font color=3D"#00=
0066">Breakpoint 1 at 0x80485e4: file Reverse.c, line 22.</font></div><div>=
<font color=3D"#000066">(gdb) start</font></div><div><font color=3D"#000066=
">Temporary breakpoint 2 at 0x8048586: file Reverse.c, line 12.</font></div=
>

<div><font color=3D"#000066">Starting program: /home/darks/Reverse</font></=
div><div><font color=3D"#000066"><br></font></div><div>At this point, I see=
 the source in another window with the black arrow at line 12 and the red b=
reakpoint at line 22.=A0</div>

<div>then,</div><div><br></div><div><span style=3D"color:rgb(0,0,102)">(gdb=
)</span>=A0<font color=3D"#000066">cotinue</font></div><div><font color=3D"=
#000066">continuing.</font></div><div><font color=3D"#000066"><br></font></=
div><div>

At this point,Nothing changed in the source=A0code window .The debuggee hun=
g and is waitting input. So i input some values in IO buffer window and pre=
ss RET,the gdb session shows:</div><div><br></div><div><span style=3D"color=
:rgb(0,0,102)">(gdb)</span>=A0</div>

<div><br></div><div>Now, the arrow goes into line 22 and hits the breakpoin=
t.=A0</div><div>Then :</div><div><br></div><div><span style=3D"color:rgb(0,=
0,102)">(gdb)</span>=A0<font color=3D"#000066">continue</font> =A0</div><di=
v>or doing this repeatly:=A0<span style=3D"color:rgb(0,0,102)">(gdb)</span>=
=A0<font color=3D"#000066">next=A0</font></div>

<div>The debuggee works very <a href=3D"http://well.it">well.it</a> showed =
all of the output in the IO buffer window and normally terminted at last. T=
hat&#39;s all, just for your information only. Thanks.</div><div><div class=
=3D"gmail_quote">

2012/8/11 Eli Zaretskii <span dir=3D"ltr">&lt;<a href=3D"mailto:eliz@HIDDEN=
g" target=3D"_blank">eliz@HIDDEN</a>&gt;</span><br><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">

<div id=3D":3q">I looked into this. =A0The problem seems to be that gdb-mi.=
el is<br>
confused wrt which text typed by the user to send to GDB and which to<br>
the program being debugged.<br>
<br>
Here&#39;s the session on Windows:<br>
<br>
=A0 Reading symbols from d:/usr/eli/data/rev.exe...done.<br>
=A0 (gdb) break 22<br>
=A0 Breakpoint 1 at 0x4013ae: file rev.c, line 22.<br>
=A0 (gdb) start<br>
=A0 Temporary breakpoint 2 at 0x40136f: file rev.c, line 19.<br>
=A0 Starting program: d:/usr/eli/data/rev.exe<br>
=A0 [New Thread 2120.0x165c]<br>
<br>
=A0 Temporary breakpoint 2, main () at rev.c:19<br>
=A0 19 =A0 =A0 =A0 =A0int i=3D0,n;<br>
<br>
At this point, I see the source in another window with the arrow at<br>
line 19 and the breakpoint I set at line 22.<br>
<br>
Now:<br>
<br>
=A0 (gdb) continue<br>
=A0 Continuing.<br>
<br>
=A0 Breakpoint 1, main () at rev.c:22<br>
=A0 22 =A0 =A0 =A0 =A0p =3D q =3D s; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// =
=A0set breakpoint at this line.<br>
=A0 (gdb) print s<br>
=A0 $1 =3D &quot;23-thread-info --thread 1 \000 ...&quot;<br>
<br>
That &quot;23-thread-info --thread 1&quot; thing is a command sent by gdb-m=
i.el<br>
to GDB. =A0But since the debbuggee is reading stdin with fgets, the<br>
command ends up in the buffer read by fgets. =A0Which explains why the<br>
program doesn&#39;t stop when fgets is called: the call to fgets returns<br=
>
immediately with the above command as its input.<br>
<br>
I tried to work around this by commenting out the &quot;-thread-info&quot;<=
br>
command sent here:<br>
<br>
=A0 (defun gdb-starting (_output-field)<br>
=A0 =A0 ;; CLI commands don&#39;t emit ^running at the moment so use gdb-ru=
nning too.<br>
=A0 =A0 (setq gdb-inferior-status &quot;running&quot;)<br>
=A0 =A0 (gdb-force-mode-line-update<br>
=A0 =A0 =A0(propertize gdb-inferior-status &#39;face font-lock-type-face))<=
br>
=A0 =A0 (setq gdb-active-process t)<br>
=A0 =A0 (setq gud-running t)<br>
=A0 =A0 ;; GDB doesn&#39;t seem to respond to -thread-info before first sto=
p or<br>
=A0 =A0 ;; thread exit (even in non-stop mode), so this is useless.<br>
=A0 =A0 ;; Behavior may change in the future.<br>
=A0 =A0 (gdb-emit-signal gdb-buf-publisher &#39;update-threads)) =A0&lt;&lt=
;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>
<br>
Then I do get a chance to type some text when the debuggee is stuck in<br>
fgets. =A0But what winds up in the buffer read by fgets is<br>
<br>
=A0 -interpreter-exec console &quot;TEXT&quot;<br>
<br>
where TEXT is what I typed. =A0Evidently, gdb-mi thinks that what I<br>
typed is a GDB command, so it wraps it with -interpreter-exec.<br>
<br>
The above was on MS-Windows. =A0On GNU/Linux, I see a slightly different<br=
>
manifestation of what seems to be the same problem: there, I cannot<br>
get the debuggee to continue after I type some text that is supposed<br>
to be read by fgets. =A0Sounds like the input never gets to the<br>
debuggee, or maybe the debuggee&#39;s stdin is not line-buffered for some<b=
r>
reason. =A0In any case, the call to fgets never returns.<br>
<br>
So I no longer think this is a Windows-specific problem, and my<br>
original assertion that it has to do with different buffering on<br>
Windows seems to be incorrect.<br>
<br>
Perhaps someone who knows more about GUD and comint in general could<br>
chime in and find out what is wrong here. =A0Or at least explain what<br>
should be done in gdb-mi to treat separately GDB commands and input to<br>
the debuggee. =A0Evidently, the old gud-gdb way of running GDB did that<br>
correctly.</div></blockquote></div><br></div>

--20cf302078886e18ea04c6fcabbe--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.

Message received at 12163 <at> debbugs.gnu.org:


Received: (at 12163) by debbugs.gnu.org; 10 Aug 2012 18:05:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 10 14:05:28 2012
Received: from localhost ([127.0.0.1]:47333 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SztaS-0003TK-DM
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 14:05:28 -0400
Received: from mtaout23.012.net.il ([80.179.55.175]:62907)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eliz@HIDDEN>) id 1SztaP-0003TB-J9
	for 12163 <at> debbugs.gnu.org; Fri, 10 Aug 2012 14:05:27 -0400
Received: from conversion-daemon.a-mtaout23.012.net.il by
	a-mtaout23.012.net.il (HyperSendmail v2007.08) id
	<0M8J00800WBBO300@HIDDEN> for
	12163 <at> debbugs.gnu.org; Fri, 10 Aug 2012 20:57:07 +0300 (IDT)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0M8J0089IWJ6O220@HIDDEN>;
	Fri, 10 Aug 2012 20:57:07 +0300 (IDT)
Date: Fri, 10 Aug 2012 20:57:14 +0300
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#12163: 24.1;
	Can not input anything or showing none output when debugging
	c/c++	application.
In-reply-to: <CAORnh3icm+MjYUOUbKfihcJdekMNKgztT0ghw2P3fFS+bnaMVQ@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: qq510371827 <qq510371827@HIDDEN>
Message-id: <83628qeikl.fsf@HIDDEN>
References: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
	<83obmkdoli.fsf@HIDDEN>
	<CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
	<83ehnfdzgw.fsf@HIDDEN>
	<CAORnh3guaiS0feFz3kH47fyp3JqkyBtfujKxFQ4TZetwZSjLTA@HIDDEN>
	<837gt7dqjm.fsf@HIDDEN>
	<CAORnh3icm+MjYUOUbKfihcJdekMNKgztT0ghw2P3fFS+bnaMVQ@HIDDEN>
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 12163
Cc: 12163 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

> From: qq510371827 <qq510371827@HIDDEN>
> Date: Fri, 10 Aug 2012 18:18:44 +0800
> 
> 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.

I looked into this.  The problem seems to be that gdb-mi.el is
confused wrt which text typed by the user to send to GDB and which to
the program being debugged.

Here's the session on Windows:

  Reading symbols from d:/usr/eli/data/rev.exe...done.
  (gdb) break 22
  Breakpoint 1 at 0x4013ae: file rev.c, line 22.
  (gdb) start
  Temporary breakpoint 2 at 0x40136f: file rev.c, line 19.
  Starting program: d:/usr/eli/data/rev.exe 
  [New Thread 2120.0x165c]

  Temporary breakpoint 2, main () at rev.c:19
  19	    int i=0,n;

At this point, I see the source in another window with the arrow at
line 19 and the breakpoint I set at line 22.

Now:

  (gdb) continue
  Continuing.

  Breakpoint 1, main () at rev.c:22
  22	    p = q = s;			//  set breakpoint at this line.
  (gdb) print s
  $1 = "23-thread-info --thread 1 \000 ..."

That "23-thread-info --thread 1" thing is a command sent by gdb-mi.el
to GDB.  But since the debbuggee is reading stdin with fgets, the
command ends up in the buffer read by fgets.  Which explains why the
program doesn't stop when fgets is called: the call to fgets returns
immediately with the above command as its input.

I tried to work around this by commenting out the "-thread-info"
command sent here:

  (defun gdb-starting (_output-field)
    ;; CLI commands don't emit ^running at the moment so use gdb-running too.
    (setq gdb-inferior-status "running")
    (gdb-force-mode-line-update
     (propertize gdb-inferior-status 'face font-lock-type-face))
    (setq gdb-active-process t)
    (setq gud-running t)
    ;; GDB doesn't seem to respond to -thread-info before first stop or
    ;; thread exit (even in non-stop mode), so this is useless.
    ;; Behavior may change in the future.
    (gdb-emit-signal gdb-buf-publisher 'update-threads))  <<<<<<<<<<<<<

Then I do get a chance to type some text when the debuggee is stuck in
fgets.  But what winds up in the buffer read by fgets is

  -interpreter-exec console "TEXT"

where TEXT is what I typed.  Evidently, gdb-mi thinks that what I
typed is a GDB command, so it wraps it with -interpreter-exec.

The above was on MS-Windows.  On GNU/Linux, I see a slightly different
manifestation of what seems to be the same problem: there, I cannot
get the debuggee to continue after I type some text that is supposed
to be read by fgets.  Sounds like the input never gets to the
debuggee, or maybe the debuggee's stdin is not line-buffered for some
reason.  In any case, the call to fgets never returns.

So I no longer think this is a Windows-specific problem, and my
original assertion that it has to do with different buffering on
Windows seems to be incorrect.

Perhaps someone who knows more about GUD and comint in general could
chime in and find out what is wrong here.  Or at least explain what
should be done in gdb-mi to treat separately GDB commands and input to
the debuggee.  Evidently, the old gud-gdb way of running GDB did that
correctly.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Aug 2012 10:27:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 10 06:27:57 2012
Received: from localhost ([127.0.0.1]:46192 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SzmRg-00081h-P4
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 06:27:57 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51377)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <qq510371827@HIDDEN>) id 1SzmRe-00081a-PG
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 06:27:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzmJc-00049X-IH
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 06:19:40 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,
	FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE,
	RCVD_IN_DNSWL_HI, 
	T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:36431)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzmJc-00049K-E3
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 06:19:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38672)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzmJZ-0004Cf-IL
	for bug-gnu-emacs@HIDDEN; Fri, 10 Aug 2012 06:19:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzmJR-000430-Nl
	for bug-gnu-emacs@HIDDEN; Fri, 10 Aug 2012 06:19:33 -0400
Received: from mail-we0-f169.google.com ([74.125.82.169]:39081)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzmJR-00042O-4r
	for bug-gnu-emacs@HIDDEN; Fri, 10 Aug 2012 06:19:25 -0400
Received: by weys10 with SMTP id s10so1017963wey.0
	for <bug-gnu-emacs@HIDDEN>; 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==
Received: by 10.217.3.7 with SMTP id q7mr1493787wes.47.1344593964269; Fri, 10
	Aug 2012 03:19:24 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.216.210.19 with HTTP; Fri, 10 Aug 2012 03:18:44 -0700 (PDT)
In-Reply-To: <837gt7dqjm.fsf@HIDDEN>
References: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
	<83obmkdoli.fsf@HIDDEN>
	<CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
	<83ehnfdzgw.fsf@HIDDEN>
	<CAORnh3guaiS0feFz3kH47fyp3JqkyBtfujKxFQ4TZetwZSjLTA@HIDDEN>
	<837gt7dqjm.fsf@HIDDEN>
From: qq510371827 <qq510371827@HIDDEN>
Date: Fri, 10 Aug 2012 18:18:44 +0800
Message-ID: <CAORnh3icm+MjYUOUbKfihcJdekMNKgztT0ghw2P3fFS+bnaMVQ@HIDDEN>
Subject: Re: bug#12163: 24.1; Can not input anything or showing none output
	when debugging c/c++ application.
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=20cf302078889b7eaa04c6e6ad64
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-Received-From: 208.118.235.17
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

--20cf302078889b7eaa04c6e6ad64
Content-Type: text/plain; charset=ISO-8859-1

2012/8/10 Eli Zaretskii <eliz@HIDDEN>

> > From: qq510371827 <qq510371827@HIDDEN>
> > 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

<br><br><div class=3D"gmail_quote">2012/8/10 Eli Zaretskii <span dir=3D"ltr=
">&lt;<a href=3D"mailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>&gt=
;</span><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">

&gt; From: qq510371827 &lt;<a href=3D"mailto:qq510371827@HIDDEN">qq51037=
1827@HIDDEN</a>&gt;<br>
&gt; Date: Fri, 10 Aug 2012 17:14:14 +0800<br>
<div class=3D"im">&gt;<br>
&gt; &gt; Try invoking GDB from Emacs like this:<br>
&gt; &gt;<br>
&gt; &gt; =A0 M-x gud-gdb RET<br>
&gt; &gt;<br>
&gt; &gt; If that doesn&#39;t help, either, then I&#39;m clueless, sorry. =
=A0Perhaps<br>
&gt; &gt; someone else could help.<br>
&gt; &gt;<br>
&gt; =A0Thanks for your patience. It finally works. However, two other new<=
br>
&gt; problem appeared after using &#39;gud-gdb&#39;.<br>
&gt; 1).the code, gdb information and out/input datas mixed together in the=
 same<br>
&gt; buffer and &#39;gdb-many-windows&#39; command didn&#39;t work any more=
.<br>
<br>
</div>This is expected. =A0gud-gdb uses the old interface with GDB, which<b=
r>
doesn&#39;t support gdb-many-windows.<br>
<div class=3D"im"><br>
&gt; 2) You can refer this link:<br>
&gt; =A0<a href=3D"http://stackoverflow.com/questions/9676135/gud-gdb-emacs=
-24-not-working" target=3D"_blank">http://stackoverflow.com/questions/96761=
35/gud-gdb-emacs-24-not-working</a><br>
&gt; The same problem as mine.<br>
<br>
</div>No, it isn&#39;t the same. =A0Your problem was with getting input and=
 output<br>
to and from the debuggee. =A0The above URL describes a much more serious<br=
>
problem, whereby Emacs doesn&#39;t show the source code of functions you<br=
>
step through. =A0I don&#39;t see any of this in your original bug report<br=
>
(and it surely works for me on MS-Windows).<br><span style=3D"line-height:1=
4.545454025268555px;background-color:rgb(255,255,255)"><font color=3D"#0066=
00">I&#39;m sorry.I got it wrong.=A0</font></span><br>
As for the original problem: could you please post here a minimal C<br>
program that exhibits the problem with I/O when you use &quot;M-x gdb&quot;=
? =A0I<br>
will then try to look into the reasons of this and the possible ways<br>
to solve that, when I have time.<br>
<br>
Thanks.<br>
</blockquote></div><font color=3D"#006600">Ok,</font><span style=3D"color:r=
gb(0,102,0)">source code is as follows:</span><div><div><font color=3D"#000=
099">#include &quot;stdio.h&quot;</font></div><div><font color=3D"#000099">=
#include &quot;ctype.h&quot;</font></div>

<div><font color=3D"#000099">#include &quot;string.h&quot;</font></div><div=
><font color=3D"#000099"><br></font></div><div><font color=3D"#000099">void=
 Reverse(char* p,int n)</font></div><div><font color=3D"#000099">{</font></=
div>

<div><font color=3D"#000099">=A0 =A0 if(--n &gt; 0) Reverse(p+1,n);</font><=
/div><div><font color=3D"#000099">=A0 =A0 printf(&quot;%c&quot;,*p);</font>=
</div><div><font color=3D"#000099">=A0 =A0 fflush(stdout);</font></div><div=
><font color=3D"#000099">}</font></div>

<div><font color=3D"#000099">int main()</font></div><div><font color=3D"#00=
0099">{</font></div><div><font color=3D"#000099">=A0 //setbuf(stdin,NULL);<=
/font></div><div><font color=3D"#000099">=A0 //setbuf(stdout,NULL);</font><=
/div><div>

<font color=3D"#000099">=A0 // setvbuf(stdin,NULL,_IONBF,0);</font></div><d=
iv><font color=3D"#000099">=A0 // setvbuf(stdout,NULL,_IONBF,0);</font></di=
v><div><font color=3D"#000099">=A0 //freopen(&quot;input.txt&quot;,&quot;r&=
quot;,stdin);</font></div>

<div><font color=3D"#000099">=A0 =A0 char s[255],*p,*q;</font></div><div><f=
ont color=3D"#000099">=A0 =A0 int i=3D0,n;</font></div><div><font color=3D"=
#000099">=A0 =A0 fgets(s,255,stdin);</font></div><div><font color=3D"#00009=
9">=A0 =A0 s[strlen(s)-1] =3D &#39; &#39;;</font></div>

<div><font color=3D"#000099">=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.</fo=
nt></div><div><font color=3D"#000099">=A0 =A0 while(*p !=3D &#39;\0&#39;)</=
font></div><div><font color=3D"#000099">=A0 =A0 {</font></div>

<div><font color=3D"#000099">=A0 =A0 =A0 =A0 i++;</font></div><div><font co=
lor=3D"#000099">=A0 =A0 =A0 =A0 p++;</font></div><div><font color=3D"#00009=
9">=A0 =A0 =A0 =A0 if(isspace(*p))</font></div><div><font color=3D"#000099"=
>=A0 =A0 =A0 =A0 {</font></div><div>

<font color=3D"#000099">=A0 =A0 =A0 =A0 =A0 =A0 n =3D i;</font></div><div><=
font color=3D"#000099">=A0 =A0 =A0 =A0 =A0 =A0 i =3D 0;</font></div><div><f=
ont color=3D"#000099">=A0 =A0 =A0 =A0 =A0 =A0 Reverse(q,n);</font></div><di=
v><font color=3D"#000099">=A0 =A0 =A0 =A0 =A0 =A0 q =3D p+1;</font></div>

<div><font color=3D"#000099">=A0 =A0 =A0 =A0 }</font></div><div><font color=
=3D"#000099">=A0 =A0 }</font></div><div><font color=3D"#000099">=A0 =A0 n =
=3D i;</font></div><div><font color=3D"#000099">=A0 =A0 Reverse(q,n);</font=
></div><div><font color=3D"#000099">=A0 =A0 printf(&quot;\n&quot;);</font><=
/div>

<div><font color=3D"#000099">=A0 =A0 return 0;</font></div><div><font color=
=3D"#000099">}</font></div><div style=3D"color:rgb(0,102,0)">Thanks in adva=
nce.</div></div>

--20cf302078889b7eaa04c6e6ad64--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.

Message received at 12163 <at> debbugs.gnu.org:


Received: (at 12163) by debbugs.gnu.org; 10 Aug 2012 09:58:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 10 05:58:34 2012
Received: from localhost ([127.0.0.1]:46059 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SzlzF-0007Ho-Ov
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 05:58:34 -0400
Received: from mtaout23.012.net.il ([80.179.55.175]:62139)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eliz@HIDDEN>) id 1SzlzD-0007Hg-AN
	for 12163 <at> debbugs.gnu.org; Fri, 10 Aug 2012 05:58:32 -0400
Received: from conversion-daemon.a-mtaout23.012.net.il by
	a-mtaout23.012.net.il (HyperSendmail v2007.08) id
	<0M8J006009R7KI00@HIDDEN> for
	12163 <at> debbugs.gnu.org; Fri, 10 Aug 2012 12:50:15 +0300 (IDT)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0M8J006AN9ZRKY00@HIDDEN>;
	Fri, 10 Aug 2012 12:50:15 +0300 (IDT)
Date: Fri, 10 Aug 2012 12:50:21 +0300
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#12163: 24.1;
	Can not input anything or showing none output when debugging
	c/c++	application.
In-reply-to: <CAORnh3guaiS0feFz3kH47fyp3JqkyBtfujKxFQ4TZetwZSjLTA@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: qq510371827 <qq510371827@HIDDEN>
Message-id: <837gt7dqjm.fsf@HIDDEN>
References: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
	<83obmkdoli.fsf@HIDDEN>
	<CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
	<83ehnfdzgw.fsf@HIDDEN>
	<CAORnh3guaiS0feFz3kH47fyp3JqkyBtfujKxFQ4TZetwZSjLTA@HIDDEN>
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 12163
Cc: 12163 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

> From: qq510371827 <qq510371827@HIDDEN>
> 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).

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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Aug 2012 09:23:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 10 05:23:25 2012
Received: from localhost ([127.0.0.1]:45940 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SzlRE-0006SQ-LC
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 05:23:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48761)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <qq510371827@HIDDEN>) id 1SzlR8-0006SF-Be
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 05:23:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzlJ6-0002uZ-Le
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 05:15:03 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,
	FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE,
	RCVD_IN_DNSWL_HI, 
	T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:49970)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzlJ6-0002uV-I6
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 05:15:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45008)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzlJ3-0006TF-RP
	for bug-gnu-emacs@HIDDEN; Fri, 10 Aug 2012 05:15:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzlJ2-0002tv-Ai
	for bug-gnu-emacs@HIDDEN; Fri, 10 Aug 2012 05:14:57 -0400
Received: from mail-wi0-f177.google.com ([209.85.212.177]:59951)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzlJ2-0002tq-0K
	for bug-gnu-emacs@HIDDEN; Fri, 10 Aug 2012 05:14:56 -0400
Received: by wibhn17 with SMTP id hn17so190041wib.12
	for <bug-gnu-emacs@HIDDEN>; Fri, 10 Aug 2012 02:14:55 -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=nGCrj9llSNBlwz0jertXIyoffh9kDlQYHVgoBU1J71I=;
	b=nWppH5ehIEXU3bylsrm45j/EoMBWkOxSD4VXKTXTj5KZQoYeAQvNiNBTbwfHyqpY6k
	GDxKXZJlVQN6FmQ1PcXB1OyjR1ZuQJJmF9rhW/ahFvURtLa/J8ZqKMmZ43TCVszY659H
	B6mQP1mDNr1GfkImu7vIueAtS/T9SnDRXEqxMdG09siq3XaYz5wmRLOHdyIBpuDfqqm0
	WCySZh2alvbR+tVJDgc9Uq9YUnZUcf7AoCAhIPiQEMFJQAv8vuMSRsZcHywi051TSFu0
	uAYcYYAyKxfgvXpH2S+yq5vFDkn+SEy1pUmw1b4Cgz7HkCxaG5CIOFIBaJaTHc88nxDt
	j+0g==
Received: by 10.180.82.39 with SMTP id f7mr4551863wiy.2.1344590095158; Fri, 10
	Aug 2012 02:14:55 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.216.210.19 with HTTP; Fri, 10 Aug 2012 02:14:14 -0700 (PDT)
In-Reply-To: <83ehnfdzgw.fsf@HIDDEN>
References: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
	<83obmkdoli.fsf@HIDDEN>
	<CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
	<83ehnfdzgw.fsf@HIDDEN>
From: qq510371827 <qq510371827@HIDDEN>
Date: Fri, 10 Aug 2012 17:14:14 +0800
Message-ID: <CAORnh3guaiS0feFz3kH47fyp3JqkyBtfujKxFQ4TZetwZSjLTA@HIDDEN>
Subject: Re: bug#12163: 24.1; Can not input anything or showing none output
	when debugging c/c++ application.
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=f46d041826eafd8d3e04c6e5c6af
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-Received-From: 208.118.235.17
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

--f46d041826eafd8d3e04c6e5c6af
Content-Type: text/plain; charset=ISO-8859-1

2012/8/10 Eli Zaretskii <eliz@HIDDEN>

> [Please keep the bug address in the CC list.]
> Sorry,it's my first time to file a bug report here. I will do as what you
> said.
> > From: qq510371827 <qq510371827@HIDDEN>
> > Date: Fri, 10 Aug 2012 10:58:11 +0800
> >
> > Thanks for your help.But it doesn't work yet. I added :
> >   setbuf(stdin,NULL);
> >   setbuf(stdout,NULL);
> > or,
>
>   setvbuf(stdin,NULL,_IONBF,0);
> >   setvbuf(stdout,NULL,_IONBF,0);
> > and
> > fflush(stdout) after printf,
> > All of the above didn't work, None output when debugging my
> application.In
> > addition,I can not input values during debugging yet. for instance,
> > 1...........scanf("%c",s);
> > 2...........
> > 3...........
> > 4...........i=0; // set breakpoint at this line
> > During the debugging,*What is the expected result?*
> > It should suspend and wait IO buffer's input values. Then after I input a
> > value in IO buffer and press RET it resumed and stopped at line 4 ( it
> hit
> > the breakpoint).
> > *But in fact What happens instead?*
> > It run and directly stopped at line 4 and didn't give me a chance to
> input
> > anything. I still input some values in io buffer and press RET but it
> > didn't give me a response. It seems as if the debugger didn't recognize
> > emacs' input/ouput IO buffer to be its input/output pipe and still kept
> > waitting for input.
> > This problem only appeared in emacs 24.1. Emacs 23.4 works very well
> > without this problem.
>
> 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.
2) You can refer this link:
 http://stackoverflow.com/questions/9676135/gud-gdb-emacs-24-not-working
The same problem as mine.

--f46d041826eafd8d3e04c6e5c6af
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><div class=3D"gmail_quote">2012/8/10 Eli Zaretskii <span dir=3D"ltr">&l=
t;<a href=3D"mailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>&gt;</s=
pan><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex">


[Please keep the bug address in the CC list.]<br><span style=3D"background-=
color:rgb(255,255,255)"><font color=3D"#006600">
Sorry,it&#39;s my first time to file a bug report here. I will do as what y=
ou said.=A0</font></span><br>
&gt; From: qq510371827 &lt;<a href=3D"mailto:qq510371827@HIDDEN" target=
=3D"_blank">qq510371827@HIDDEN</a>&gt;<br>
&gt; Date: Fri, 10 Aug 2012 10:58:11 +0800<br>
<div>&gt;<br>
&gt; Thanks for your help.But it doesn&#39;t work yet. I added :<br>
&gt; =A0 setbuf(stdin,NULL);<br>
&gt; =A0 setbuf(stdout,NULL);<br>
&gt; or,=A0</div></blockquote><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
&gt; =A0 setvbuf(stdin,NULL,_IONBF,0);<br>
&gt; =A0 setvbuf(stdout,NULL,_IONBF,0);<br>
&gt; and<br>
&gt; fflush(stdout) after printf,<br>
&gt; All of the above didn&#39;t work, None output when debugging my applic=
ation.In<br>
&gt; addition,I can not input values during debugging yet. for instance,<br=
>
&gt; 1...........scanf(&quot;%c&quot;,s);<br>
&gt; 2...........<br>
&gt; 3...........<br>
&gt; 4...........i=3D0; // set breakpoint at this line<br>
</div>&gt; During the debugging,*What is the expected result?*<br>
<div>&gt; It should suspend and wait IO buffer&#39;s input values. Then aft=
er I input a<br>
&gt; value in IO buffer and press RET it resumed and stopped at line 4 ( it=
 hit<br>
&gt; the breakpoint).<br>
</div>&gt; *But in fact What happens instead?*<br>
<div>&gt; It run and directly stopped at line 4 and didn&#39;t give me a ch=
ance to input<br>
&gt; anything. I still input some values in io buffer and press RET but it<=
br>
&gt; didn&#39;t give me a response. It seems as if the debugger didn&#39;t =
recognize<br>
&gt; emacs&#39; input/ouput IO buffer to be its input/output pipe and still=
 kept<br>
&gt; waitting for input.<br>
&gt; This problem only appeared in emacs 24.1. Emacs 23.4 works very well<b=
r>
&gt; without this problem.<br>
<br>
</div>Try invoking GDB from Emacs like this:<br>
<br>
=A0 M-x gud-gdb RET<br>
<br>
If that doesn&#39;t help, either, then I&#39;m clueless, sorry. =A0Perhaps<=
br>
someone else could help.<br>
</blockquote></div>=A0<font color=3D"#006600">Thanks for your patience. It =
finally works. However, two other new problem=A0appeared=A0after using &#39=
;gud-gdb&#39;.</font><div><font color=3D"#006600">1).the code, gdb informat=
ion and out/input datas mixed together in the same buffer and &#39;gdb-many=
-windows&#39; command didn&#39;t work any more.<br>


</font><div><font color=3D"#006600"><span style=3D"line-height:16px">2)</sp=
an>=A0You can refer this link:</font></div><div>=A0<a href=3D"http://stacko=
verflow.com/questions/9676135/gud-gdb-emacs-24-not-working" target=3D"_blan=
k">http://stackoverflow.com/questions/9676135/gud-gdb-emacs-24-not-working<=
/a></div>


<div><font color=3D"#006600">The same problem as mine.</font></div></div>

--f46d041826eafd8d3e04c6e5c6af--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.

Message received at 12163 <at> debbugs.gnu.org:


Received: (at 12163) by debbugs.gnu.org; 10 Aug 2012 06:45:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 10 02:45:51 2012
Received: from localhost ([127.0.0.1]:45870 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Sziyk-0002r8-OJ
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 02:45:51 -0400
Received: from mtaout21.012.net.il ([80.179.55.169]:34357)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eliz@HIDDEN>) id 1Sziye-0002qW-SB
	for 12163 <at> debbugs.gnu.org; Fri, 10 Aug 2012 02:45:47 -0400
Received: from conversion-daemon.a-mtaout21.012.net.il by
	a-mtaout21.012.net.il (HyperSendmail v2007.08) id
	<0M8J0000004HS600@HIDDEN> for
	12163 <at> debbugs.gnu.org; Fri, 10 Aug 2012 09:37:29 +0300 (IDT)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0M8J000VN12HNN90@HIDDEN>;
	Fri, 10 Aug 2012 09:37:29 +0300 (IDT)
Date: Fri, 10 Aug 2012 09:37:35 +0300
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#12163: 24.1;
	Can not input anything or showing none output when debugging c/c++
	application.
In-reply-to: <CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: qq510371827 <qq510371827@HIDDEN>
Message-id: <83ehnfdzgw.fsf@HIDDEN>
References: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
	<83obmkdoli.fsf@HIDDEN>
	<CAORnh3gDSy9iG=o8E=Hnx=UaqzM6+Of5iN99-7Gyp46iVVMJHw@HIDDEN>
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 12163
Cc: 12163 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

[Please keep the bug address in the CC list.]

> From: qq510371827 <qq510371827@HIDDEN>
> Date: Fri, 10 Aug 2012 10:58:11 +0800
> 
> Thanks for your help.But it doesn't work yet. I added :
>   setbuf(stdin,NULL);
>   setbuf(stdout,NULL);
> or,
>   setvbuf(stdin,NULL,_IONBF,0);
>   setvbuf(stdout,NULL,_IONBF,0);
> and
> fflush(stdout) after printf,
> All of the above didn't work, None output when debugging my application.In
> addition,I can not input values during debugging yet. for instance,
> 1...........scanf("%c",s);
> 2...........
> 3...........
> 4...........i=0; // set breakpoint at this line
> During the debugging,*What is the expected result?*
> It should suspend and wait IO buffer's input values. Then after I input a
> value in IO buffer and press RET it resumed and stopped at line 4 ( it hit
> the breakpoint).
> *But in fact What happens instead?*
> It run and directly stopped at line 4 and didn't give me a chance to input
> anything. I still input some values in io buffer and press RET but it
> didn't give me a response. It seems as if the debugger didn't recognize
> emacs' input/ouput IO buffer to be its input/output pipe and still kept
> waitting for input.
> This problem only appeared in emacs 24.1. Emacs 23.4 works very well
> without this problem.

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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Aug 2012 15:59:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 09 11:59:57 2012
Received: from localhost ([127.0.0.1]:44991 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SzV9P-0005tB-PR
	for submit <at> debbugs.gnu.org; Thu, 09 Aug 2012 11:59:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35174)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <qq510371827@HIDDEN>) id 1SzUGu-0004cn-TL
	for submit <at> debbugs.gnu.org; Thu, 09 Aug 2012 11:03:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzU8u-0003ub-8F
	for submit <at> debbugs.gnu.org; Thu, 09 Aug 2012 10:55:26 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,
	FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE,
	RCVD_IN_DNSWL_HI, 
	T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:34107)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzU8u-0003uX-4u
	for submit <at> debbugs.gnu.org; Thu, 09 Aug 2012 10:55:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44052)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzU8n-00052E-OS
	for bug-gnu-emacs@HIDDEN; Thu, 09 Aug 2012 10:55:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzU8h-0003qp-A0
	for bug-gnu-emacs@HIDDEN; Thu, 09 Aug 2012 10:55:13 -0400
Received: from mail-wi0-f171.google.com ([209.85.212.171]:35327)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <qq510371827@HIDDEN>) id 1SzU8h-0003pd-0a
	for bug-gnu-emacs@HIDDEN; Thu, 09 Aug 2012 10:55:07 -0400
Received: by wibhq4 with SMTP id hq4so304125wib.12
	for <bug-gnu-emacs@HIDDEN>; Thu, 09 Aug 2012 07:55:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:from:date:message-id:subject:to:content-type;
	bh=8lk2q27qCGmf/YJiPol0zsjmYzBRk9y5KR1OQKJd0gM=;
	b=xSiWwn4yrDdm4BynZjhe1o2i6aWnWZBZdLZ7Ls3APT4Cqc14VYFAEbrIsXk+xBu28H
	uF7LMvYPD9oe//ZMlg2CYP6iH7TbC0NGBQExbVCvNlGs1F0U7kL9lO/c3TsYiSqJFK8y
	zLNtxQIzDlfci1LQdzV/rYtcZqLv+khqYYOXKDFDlarn5xi2WU13mEMVIBcy3S5AqRWL
	r/afWvk6zg3CP9O3LikWHrH4F1V9smzd/tIVm8EUzxG8JIAziQmdc1ORGMM47BB1XYi6
	tXX+7o6POQToutjfI/kgb1NsLnCaU0WyPIYFDzLIF8jJao75qmdJecpsbtGbM9Nb0YTe
	dSlQ==
Received: by 10.217.3.7 with SMTP id q7mr8172959wes.47.1344524105320; Thu, 09
	Aug 2012 07:55:05 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.216.210.19 with HTTP; Thu, 9 Aug 2012 07:54:24 -0700 (PDT)
From: qq510371827 <qq510371827@HIDDEN>
Date: Thu, 9 Aug 2012 22:54:24 +0800
Message-ID: <CAORnh3iB4=RyVT1qwG+a61C4VQs+KkC5gfeZ4_T38nNDmGbbWQ@HIDDEN>
Subject: 24.1; Can not input anything or showing none output when debugging
	c/c++ application.
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=20cf30207888b08a1904c6d66915
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-Received-From: 208.118.235.17
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 09 Aug 2012 11:59:54 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

--20cf30207888b08a1904c6d66915
Content-Type: text/plain; charset=ISO-8859-1

I am running emacs 24.1 on windows7 32bit with mginw32.When debugging my
c/c++ application I can not give an iputting and can not see any
output. For example:
         ...          //  line 1
         ...          //  line 2
         fgets(s,255,stdin); //line 3
         ...         // line 4
         ...         //line 5
         i = 0; // line 6          Breakpoint is at this line.
Then i started debugging:
(gdb)r
After executing the above command, it stopped at line 6 and didn't
waitting for me to input values. I inputted values in input/output io
buffer but nothing happend.Then I executed "(gdb)n" command,the debug
toolbar icons became grey and i can not continue debugging my
application.I tried to debug another application and it showed none
output during the debugging. However, everything works like a charm in
emacs 23.4 on windows7 with
mingw32(emacs 24.1 on ubuntu 12.04 is also works very well).That'all, thank
you.


In GNU Emacs 24.1.1 (i386-mingw-nt6.1.7601)
 of 2012-06-10 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --with-gcc (4.6) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: CHS
  value of $XMODIFIERS: nil
  locale-coding-system: cp936
  default enable-multibyte-characters: t

Major mode: Debugger

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <drag-n-drop>
<help-echo> <escape> x g d b <return> <return> b SPC
1 8 <return> r <return> q <return> <help-echo> <escape>
x r e p <tab> <down-mouse-1> <mouse-2>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Target doesn't support non-stop mode.  Turning it off.
Switched to thread 1
Making completion list...
call-interactively: End of buffer [2 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils help-mode view
gdb-mi bindat json gud easy-mmode comint ansi-color ring cc-mode
cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs regexp-opt browse-url url-util url-parse auth-source
eieio byte-opt bytecomp byte-compile cconv macroexp assoc gnus-util
password-cache url-vars mm-util mail-prsvr time-date china-util tooltip
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table ls-lisp
w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process multi-tty emacs)

--20cf30207888b08a1904c6d66915
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>I am running emacs 24.1 on windows7 32bit with mginw32.When debugging =
my</div><div>c/c++ application I can not give an iputting and can not see a=
ny</div><div>output. For example:</div><div>=A0 =A0 =A0 =A0 =A0... =A0 =A0 =
=A0 =A0 =A0// =A0line 1</div>

<div>=A0 =A0 =A0 =A0 =A0... =A0 =A0 =A0 =A0 =A0// =A0line 2</div><div>=A0 =
=A0 =A0 =A0 =A0fgets(s,255,stdin); //line 3</div><div>=A0 =A0 =A0 =A0 =A0..=
. =A0 =A0 =A0 =A0 // line 4</div><div>=A0 =A0 =A0 =A0 =A0... =A0 =A0 =A0 =
=A0 //line 5</div><div>=A0 =A0 =A0 =A0 =A0i =3D 0; // line 6 =A0 =A0 =A0 =
=A0 =A0Breakpoint is at this line.</div>

<div>Then i started debugging:</div><div>(gdb)r</div><div>After executing t=
he above command, it stopped at line 6 and didn&#39;t</div><div>waitting fo=
r me to input values. I inputted values in input/output io</div><div>buffer=
 but nothing happend.Then I executed &quot;(gdb)n&quot; command,the debug</=
div>

<div>toolbar icons became grey and i can not continue debugging my</div><di=
v>application.I tried to debug another application and it showed none</div>=
<div>output during the debugging. However, everything works like a charm in=
 emacs 23.4 on windows7 with</div>

<div>mingw32(emacs 24.1 on ubuntu 12.04 is also works very well).That&#39;a=
ll, thank you.</div><div><br></div><div><br></div><div>In GNU Emacs 24.1.1 =
(i386-mingw-nt6.1.7601)</div><div>=A0of 2012-06-10 on MARVIN</div><div>Wind=
owing system distributor `Microsoft Corp.&#39;, version 6.1.7601</div>

<div>Configured using:</div><div>=A0`configure --with-gcc (4.6) --cflags</d=
iv><div>=A0-ID:/devel/emacs/libs/libXpm-3.5.8/include</div><div>=A0-ID:/dev=
el/emacs/libs/libXpm-3.5.8/src</div><div>=A0-ID:/devel/emacs/libs/libpng-de=
v_1.4.3-1/include</div>

<div>=A0-ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include</div><div>=A0-ID:/de=
vel/emacs/libs/giflib-4.1.4-1/include</div><div>=A0-ID:/devel/emacs/libs/jp=
eg-6b-4/include</div><div>=A0-ID:/devel/emacs/libs/tiff-3.8.2-1/include</di=
v><div>

=A0-ID:/devel/emacs/libs/gnutls-3.0.9/include&#39;</div><div><br></div><div=
>Important settings:</div><div>=A0 value of $LC_ALL: nil</div><div>=A0 valu=
e of $LC_COLLATE: nil</div><div>=A0 value of $LC_CTYPE: nil</div><div>=A0 v=
alue of $LC_MESSAGES: nil</div>

<div>=A0 value of $LC_MONETARY: nil</div><div>=A0 value of $LC_NUMERIC: nil=
</div><div>=A0 value of $LC_TIME: nil</div><div>=A0 value of $LANG: CHS</di=
v><div>=A0 value of $XMODIFIERS: nil</div><div>=A0 locale-coding-system: cp=
936</div>

<div>=A0 default enable-multibyte-characters: t</div><div><br></div><div>Ma=
jor mode: Debugger</div><div><br></div><div>Minor modes in effect:</div><di=
v>=A0 tooltip-mode: t</div><div>=A0 mouse-wheel-mode: t</div><div>=A0 tool-=
bar-mode: t</div>

<div>=A0 menu-bar-mode: t</div><div>=A0 file-name-shadow-mode: t</div><div>=
=A0 global-font-lock-mode: t</div><div>=A0 font-lock-mode: t</div><div>=A0 =
blink-cursor-mode: t</div><div>=A0 auto-composition-mode: t</div><div>=A0 a=
uto-encryption-mode: t</div>

<div>=A0 auto-compression-mode: t</div><div>=A0 line-number-mode: t</div><d=
iv>=A0 transient-mark-mode: t</div><div><br></div><div>Recent input:</div><=
div>&lt;help-echo&gt; &lt;help-echo&gt; &lt;help-echo&gt; &lt;help-echo&gt;=
 &lt;drag-n-drop&gt;=A0</div>

<div>&lt;help-echo&gt; &lt;escape&gt; x g d b &lt;return&gt; &lt;return&gt;=
 b SPC=A0</div><div>1 8 &lt;return&gt; r &lt;return&gt; q &lt;return&gt; &l=
t;help-echo&gt; &lt;escape&gt;=A0</div><div>x r e p &lt;tab&gt; &lt;down-mo=
use-1&gt; &lt;mouse-2&gt;</div>

<div><br></div><div>Recent messages:</div><div>For information about GNU Em=
acs and the GNU system, type C-h C-a.</div><div>Target doesn&#39;t support =
non-stop mode. =A0Turning it off.</div><div>Switched to thread 1</div><div>

Making completion list...</div><div>call-interactively: End of buffer [2 ti=
mes]</div><div><br></div><div>Load-path shadows:</div><div>None found.</div=
><div><br></div><div>Features:</div><div>(shadow sort mail-extr emacsbug me=
ssage format-spec rfc822 mml mml-sec</div>

<div>mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils<=
/div><div>mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils help-mo=
de view</div><div>gdb-mi bindat json gud easy-mmode comint ansi-color ring =
cc-mode</div>

<div>cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engi=
ne</div><div>cc-vars cc-defs regexp-opt browse-url url-util url-parse auth-=
source</div><div>eieio byte-opt bytecomp byte-compile cconv macroexp assoc =
gnus-util</div>

<div>password-cache url-vars mm-util mail-prsvr time-date china-util toolti=
p</div><div>ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table l=
s-lisp</div><div>w32-win w32-vars tool-bar dnd fontset image fringe lisp-mo=
de register</div>

<div>page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock</div>=
<div>font-lock syntax facemenu font-core frame cham georgian utf-8-lang</di=
v><div>misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebre=
w</div>

<div>greek romanian slovak czech european ethiopic indian cyrillic chinese<=
/div><div>case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer l=
oaddefs</div><div>button faces cus-face files text-properties overlay sha1 =
md5 base64</div>

<div>format env code-pages mule custom widget hashtable-print-readable</div=
><div>backquote make-network-process multi-tty emacs)</div><div><br></div>

--20cf30207888b08a1904c6d66915--




Acknowledgement sent to qq510371827 <qq510371827@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#12163; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 30 Jun 2017 04:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.