6

I found some questions about this warning but all related to IDEs. This is for pure terminal GDB interaction.

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

In terminal 1, I get its TTY for GDB

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

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

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

The program contains some I/O magic like this:

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

In terminal 1, a warning appears before desired output:

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

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

Please suggest me some workaround to make the tty work with GDB.

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

Ions
  • 71
  • 1
  • 3
  • Just found this and wanted to add that this warning is in my case still produced in gcc 8.8.1 but the program output is correctly redirected anyways. – Peter Sep 21 '18 at 16:56

0 Answers0