GNU bug report logs -
#12163
24.1; Can not input anything or showing none output when debugging c/c++ application.
Previous Next
Reported by: qq510371827 <qq510371827 <at> gmail.com>
Date: Thu, 9 Aug 2012 16:00:01 UTC
Severity: normal
Tags: moreinfo
Merged with 12180
Found in version 24.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
2012/8/10 Eli Zaretskii <eliz <at> gnu.org>
> > From: qq510371827 <qq510371827 <at> gmail.com>
> > 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.
[Message part 2 (text/html, inline)]
This bug report was last modified 3 years and 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.