On 02/25/2011 07:46 PM, Bob Rossi wrote:
> Hi Justin,
>
> The issue is that you are trying to read from the terminal
> that cgdb is displaying itself on.
>
> You have two options:
>
> - Use the tty window,
> http://cgdb.sourceforge.net/docs/cgdb-no-split.html#TTY-Window
> which is kind of awkward and hard to use or
>
> - Run cgdb in a different termainal than the program you
> are debugging. That involves starting your program in
> one terminal and then attaching cgdb/gdb to that program
> in another terminal. This is exactly how i debug cgdb
> itself. Considering cgdb needs a terminal when it runs.
>
> Hope that's helpful.
>
> Thanks,
> Bob
>
> On Fri, Feb 25, 2011 at 01:57:56PM +0800, liuyond wrote:
>> Hello,
>>
>> I am a new user to cgdb and I like it very mush. However, when I use
>> cgdb to debug a simple program today, it failed to return when my
>> program called scanf to get some information. my program are very
>> simple, it just read a integer from the standard input and then output
>> it. the source code is as follow:
>>
>> 1 #include<stdio.h>
>> 2
>> 3 int main(void)
>> 4 {
>> 5 int n;
>> 6
>> 7 scanf("%d",&n);
>> 8
>> 9 printf("the number you input is: %d\n", n);
>> 10
>> 11 return 0;
>> 12 }
>>
>> I set a breakpoint on line 7, and then type in "run" and "next" command
>> in the gdb window, and then i can input. However it don't return no
>> matter what I type in even when I type in ctrl+d. when I use gdb to
>> debug this program, there is such problem. I don't if there is something
>> wrong with cgdb or something wrong with my system. other more
>> information about my system is:
>>
>> CGDB version: 0.6.5
>> gdb version: GNU gdb (GDB) 7.1-ubuntu
>> gcc version: 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>> system: ubuntu-10.04
>> kernel: 2.6.36
>>
>> Thanks& Regards
>>
>> --justin
>>
>>
>> ------------------------------------------------------------------------------
>> Free Software Download: Index, Search& Analyze Logs and other IT data in
>> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
>> generated by your applications, servers and devices whether physical, virtual
>> or in the cloud. Deliver compliance at lower cost and gain new business
>> insights. http://p.sf.net/sfu/splunk-dev2dev
>> _______________________________________________
>> Cgdb-devel mailing list
>> Cgd...@li...
>> https://lists.sourceforge.net/lists/listinfo/cgdb-devel
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search& Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Cgdb-devel mailing list
> Cgd...@li...
> https://lists.sourceforge.net/lists/listinfo/cgdb-devel
Hi Bob,
Thanks for your reply, and now I how to getting input while using cgdb,
and thanks for your suggestion on debuging too :-)
Thanks,
justin
|