Discussion:
GDB: Failed to set controlling terminal: Operation not permitted
stewie
2010-11-08 05:06:24 UTC
Permalink
I get the same error. But this is not preventing me from debugging.
Maybe you have an error in your program and the breakpoint is placed on a variable declaration, meaning the debugger will not stop.
Also check you are compiling with -g option.

I am using Ubuntu 10.04 kernel 2.6.32-24-generic
Netbeans 6.9
GDB 7.1-ubuntu
flyingsnow
2010-11-30 19:06:43 UTC
Permalink
I get the same error as well. The difference is that it is preventing me from debugging.

Application runs fine in RUN mode, just cannot debug. debug stops at
"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"

Set Console type to output window works but I need Gnome terminal.

ANYTHING i can do?

compiling with -g option.

Ubuntu 10.04 kernel 2.6.32-26-generic
Netbeans 6.8
GDB 7.1-ubuntu
soldatov
2010-11-30 20:54:51 UTC
Permalink
Post by flyingsnow
Application runs fine in RUN mode, just cannot debug. debug stops at
"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
It is a warning only. And it can't break debug. Input and output works correctly. Debug in terminal doesn't work in very specific cases only (for example if you uses ncurses library).
flyingsnow
2010-12-01 18:39:23 UTC
Permalink
You are right, the warning itself does not break the debug.
FILE *input = fopen("/dev/tty","r");
returns NULL in debug mode (works fine in Run mode). and that breaks the debug by coding.

Any idea?

[quote="soldatov"][quote="flyingsnow"]Application runs fine in RUN mode, just cannot debug. debug stops at
"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
[/quote]
It is a warning only. And it can't break debug. Input and output works correctly. Debug in terminal doesn't work in very specific cases only (for example if you uses ncurses library).[/quote]
Ivan Soleimanipour
2010-12-01 21:26:54 UTC
Permalink
Post by flyingsnow
You are right, the warning itself does not break the debug.
FILE *input = fopen("/dev/tty","r");
returns NULL in debug mode (works fine in Run mode). and that breaks the debug by coding.
What is 'errno' set to after that NULL from fopen)(?
Post by flyingsnow
Any idea?
[quote="soldatov"][quote="flyingsnow"]Application runs fine in RUN mode, just cannot debug. debug stops at
"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
[/quote]
It is a warning only. And it can't break debug. Input and output works correctly. Debug in terminal doesn't work in very specific cases only (for example if you uses ncurses library).[/quote]
flyingsnow
2010-12-01 21:39:53 UTC
Permalink
Answer to my own question, hopefully this will provide some hint to others:

The gdb bug(?) "warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
will not affect other debug EXCEPT using controlling terminal.

The Controlling Terminal /dev/tty
/dev/tty stands for the controlling terminal (if any) for the current process. To find out which tty's are attached to which processes use the "ps -a" command at the shell prompt (command line). Look at the "tty" column.

If gdb failed to set controlling terminal in Debug,
FILE *input = NULL;
input = fopen("/dev/tty","r");
will return NULL.

Soltuion: not yet.
Post by flyingsnow
You are right, the warning itself does not break the debug.
FILE *input = fopen("/dev/tty","r");
returns NULL in debug mode (works fine in Run mode). and that breaks the debug by coding.
Any idea?
Post by soldatov
Post by flyingsnow
Application runs fine in RUN mode, just cannot debug. debug stops at
"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
It is a warning only. And it can't break debug. Input and output works correctly. Debug in terminal doesn't work in very specific cases only (for example if you uses ncurses library).
flyingsnow
2010-12-01 21:55:12 UTC
Permalink
Post by Ivan Soleimanipour
What is 'errno' set to after that NULL from fopen)(?
[Errno 2] No such file or directory
soldatov
2010-12-01 22:45:34 UTC
Permalink
Post by flyingsnow
The gdb bug(?) "warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
Can be. I know 2 bug reports. First from NetBeans team (http://sourceware.org/bugzilla/show_bug.cgi?id=11403), second from RedHat team (https://bugzilla.redhat.com/show_bug.cgi?id=593483)
flyingsnow
2010-12-07 21:41:44 UTC
Permalink
Post by soldatov
Can be. I know 2 bug reports. First from NetBeans team (http://sourceware.org/bugzilla/show_bug.cgi?id=11403), second from RedHat team (https://bugzilla.redhat.com/show_bug.cgi?id=593483)
Reported new bug to bugzilla, http://sourceware.org/bugzilla/show_bug.cgi?id=12294
This is not just a minor warning bug like bug 11403. I basically cannot debug using terminal.
Loading...