ubuntu version: 12.04
code:blocks 10.04
When I debug my program, the IDE output
"warning: GDB: Failed to set controlling terminal: Operation not permitted"
ubuntu version: 12.04
code:blocks 10.04
When I debug my program, the IDE output
"warning: GDB: Failed to set controlling terminal: Operation not permitted"
I don't have a solution but I can point out how the error is generated.
Looking through the gdb source code the warning output is generated as the result of a ioctl call, specifically setting the controlling terminal (TIOSCCTY). Man ioctl_tty tells us that if the terminal is a controlling terminal of a different session group, this call will fail, unless CAP_SYS_ADMIN is set and the argument is 1. In this case the argument is 0 hence it does not matter is CAP_SYS_ADMIN is set or not.
The following is based on my limited understanding of controlling terminals so may be completely wrong. Please correct me if so.
The IDE is spawning a terminal process which will automatically create a session group. Next a gdb process is started in the spawned terminal (this is usually achieved by passing -x command (or similar) to the terminal creation).
During startup gdb manipulates the standard file descriptors (cin, cout and cerr) and then tries to set the spawned terminal as the controlling terminal. This fails as the terminal already has a session group.
For details refer to the file inflow.c function new_tty of the gdb source code.
I like to stress that I could be absolutely wrong about this and I would really like someone to correct me if that is the case so I can learn.