GDB: Could not install control terminal

I found a few questions about this warning, but this is all related to the IDE. This is for pure GDB terminal interaction.

Using the GDB tty command, I get a warning and further interaction with the program is impossible.

In terminal 1, I get it TTY for GDB

t1~$ tty
/dev/pts/9
t1~$

In terminal 2, I start GDB and declare tty, then I run the program

t2~$ gdb a_program
(gdb) tty /dev/pts/9
(gdb) run
Starting program: ...

The program contains some I / O magic:

printf("Give me some integer: ");
int r = scanf("%d", &i);

In terminal 1, a warning appears in front of the desired output:

warning: GDB: Failed to set controlling terminal: Operation not permitted
Give me some integer:

When I write an integer and press Enter, the cursor does not move in terminal 1. Also, nothing appears after the Starting: line in terminal 2, which means that GDB has not progressed further with execution.

, , tty GDB.

Kubuntu 14.04 64-, GNU gdb (Ubuntu 7.7.1-0ubuntu5 ~ 14.04.2) 7.7.1.

+4

All Articles