1

Information:
OS: Ubuntu 14.04
IDE: Code::blocks 13.12
Debugger: gdb 7.10

I'm new to code::blocks and was trying out the debugger, but it didn't work. So I'm here to ask you what I could do to find a solution to this problem.

When I click on 'step into' and the XTerm console opens with the message:

warning: GDB: Failed to set controlling teminal: Operation not permitted

And the output is not to be seen anywhere.

Sven
  • 119
  • 1
  • 8
  • Why do you think it didn't work? Have you tried to set breakpoints? What do you expect to see? – ks1322 Sep 10 '15 at 19:05
  • I think it didn't work because nothing of what the program should output can be seen in the console, but if run the program normally then I can read the expected output. The breakpoint changes nothing and the program should output the classic "Hello World!". – Sven Sep 10 '15 at 19:37
  • 1
    UPDATE: if there is an endl after the last cout, then I can see every the correct output. So I'd say that the problem is solved :D – Sven Sep 10 '15 at 20:07
  • @Sven If you have solved your problem, you should either delete this useless content, or consider to write an answer for your question yourself. – πάντα ῥεῖ Sep 10 '15 at 22:50
  • @πάνταῥεῖ Do you find the way I edited the question ok? I decided the leave the post so that other people with the same dumb problem will find the solution. – Sven Sep 11 '15 at 12:10
  • @Sven remove the STATUS SOLVED from your title please, and move the whole update part from your body to the **Your Answer** edit box below. Then it's OK I think. After a while (2 days IIRC) you can mark your own answer as accepted. – πάντα ῥεῖ Sep 11 '15 at 12:20
  • @πάνταῥεῖ thank you really much – Sven Sep 11 '15 at 12:34
  • Possible duplicate of [ubuntu codeblocks :warning: GDB: Failed to set controlling terminal: Operation not permitted](http://stackoverflow.com/questions/11841727/ubuntu-codeblocks-warning-gdb-failed-to-set-controlling-terminal-operation-n) – Waldir Leoncio Dec 07 '15 at 11:25

2 Answers2

2

I found out there was no real problem, I only had to end the line that I was trying to see with a 'endl'

What I was trying to execute in the debugging session, but couldn't see:

 cout << "Hello World!";

What solved the problem, enabling me to see the output in the debugger:

 cout << "Hello World!" << endl;
Sven
  • 119
  • 1
  • 8
0

Indeed, you need to flush your buffered streams (ie. fflush for FILE*, and .flush for std::stream-s).

But you don't need any IDE to run gdb. You could run it in a plain terminal, try gdb or gdb -tui or gdb --args or in Emacs

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547