Author Topic: Debugging problem in a console application with ncurses library  (Read 14538 times)

bvgd

  • Guest
I have tried to compile and debug a pure-C console application using ncurses library (Linux Ubuntu 8.04 plattform).

There is no problem with BUILD and RUN commands; the application works; but I can't debug it.

When I try to start debugging, the console window is opened and I see a message "Error opening terminal: unknown" on it; the console window closes.

In Debugger logging window I see:

Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: /home/user/CB/ncurses1/
Adding source dir: /home/user/CB/ncurses1/
Adding file: bin/Debug/ncurses1
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8-debian
At /home/user/CB/ncurses1/main.c:55
Continuing...
Program exited with code 01.
Debugger finished with status 0


Note: main.c:55 contains a first call of a ncurses-library routine:
      init_ncurses();  /* Start curses mode   */

Is it known how to debug such project with ncurses library?

Thanks!

Ubuntu 8.04
Code::Blocks 8.02, Build: Feb 27 2008, 21:58:34 - wx2.8.7 (Linux, unicode)
« Last Edit: July 21, 2008, 08:36:51 pm by bvgd »

fmel

  • Guest
Re: Debugging problem in a console application with ncurses library
« Reply #1 on: May 23, 2009, 05:17:57 am »
I'm having the same problem, but have discovered that the problem only occurs when the first ncurses call is made.  You can put some code in front of the ncurses initialization and run in debug and the terminal runs fine until you step into the ncurses init call:

main()
{
    printf("Hello\n");      // Debug will show this line
    int myvar = 1;         // You can watch this variable too
    Initscr();                 // But as soon as you step into this line, term error occurs
    .....

Anyone have any ideas?

chepaz

  • Guest
Re: Debugging problem in a console application with ncurses library
« Reply #2 on: July 20, 2010, 05:43:32 pm »
Ok, i don't expect too much from an 1 year old thread ;)

I run into exactly the same problem. I tryed different terminals but it does't work. Hopefuly pushing this thread up again would give an answer. Running my program directly in gdb works, within codeblocks... same as above.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging problem in a console application with ncurses library
« Reply #3 on: July 20, 2010, 06:48:15 pm »
C::B version?
Do you have checked Project -> properties -> build targets -> Pause when executable ends?
What is the type of the project Project -> properties -> build targets -> Type?

I've done a simple test and it works fine!

Steps I've taken:
1. create console project
2. copy the code from ncurses' tutorial
3. add ncurses to the linking options
4. hit f9 run the app or f4 to run to cursor (both works)

System: gentoo linux amd64 + debugger branch...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

lamko

  • Guest
Re: Debugging problem in a console application with ncurses library
« Reply #4 on: August 06, 2011, 02:17:49 pm »
Bug is still in version 10.05.

To answer the questions :
pause when application ends is set
type is set to console application.

Someone any idee don't like gdb much, I want to get this working in code::blocks

by the way I'm using ubuntu 10.04 64 bit.

workaround :

start codeblocks from the console not from the gnome-panel
« Last Edit: August 06, 2011, 02:30:20 pm by lamko »

Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: Debugging problem in a console application with ncurses library
« Reply #5 on: August 10, 2011, 02:17:53 pm »
The versionning system of Code::Blocks is the same as Ubuntu's one:
The first number is the 2 last digits of the year, the  last one is the month's number.

All of this mean that you use a version of May 2010.
The post before you with the bug corrected is dated from July 20, 2010.

Try to use a nightly build, this problem is probably resolved there.
They are quite stable, and supported.

Look there: http://forums.codeblocks.org/index.php/topic,15023.0.html

Offline tjareson

  • Single posting newcomer
  • *
  • Posts: 5
Re: Debugging problem in a console application with ncurses library
« Reply #6 on: November 15, 2011, 05:35:20 am »
Hello,

has anybody tried, if this problem is solved in a version > 10.05 ?

I'm using 10.05 and have the same problem. Workaround helps, but the problem is more the time it takes until one gets the idea that the debugging itself causes this problem.
(drove me nuts for almost an hour...)


Cheers
Tjareson