I'm using Code-Blocks IDE in my Ubuntu 12.10.But when I'm trying to debug any project, I got the following warning:

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

What should I do now ?

  • Search in the settings of CodeBlocks if you can change the terminal type. – Lucio Mar 26 '13 at 16:59
  • 1
    On a side note, if your current instruction arrow is not showing this error is NOT the cause. I spent hours trying to get the current instruction arrow to show thinking that this warning was causing it and not finding anything on google searches. In my case it was because I was using the wrong debugging format in nasm, I switched to using dwarf instead and it worked. – user487254 Dec 29 '15 at 16:41

I had the same problem using KDBG on Debian jessie to debug assembling program but it was only because I didn't have the right to execute the file (copy)

a simple chmod +x /path/to/file solved the problem

| improve this answer | |
  • what exactly would we put in for /path/to/file what file are we looking for? – Gunner Stone Oct 7 '16 at 23:59
  • the executable.. the thing you're debugging. – demented hedgehog Jan 31 '17 at 5:31

I had a similar problem on Ubuntu 16.04 using GDB 7.11 via XTerm. To solve it I simply modified the permissions on the local .gdbinit file by issuing chmod +x /path/to/file/.gdbinit which resolved the issue.

| improve this answer | |
  1. Install or verify that gnome terminal is installed on your PC

  2. Switch to gnome-terminal. under Settings -> Environment -> Terminal to launch, I use this:

    gnome-terminal --disable-factory --hide-menubar -t $TITLE -x

You will still get the error but the debugger works completely.

| improve this answer | |
  • 3
    As you mention, that doesn't solve the error. – Drew Dormann Jun 17 '14 at 21:21

I had the same Problem with Ubuntu 10.04, QTCreator 2.5.2 and gdb 7.1 coming with ubuntu.

I could solve my problems with an upgrade to the current version 7.5 of gdb and using this instead the 7.1 installed by ubuntu.

You can download the latest and compile it by yourself:

  • Check for the latest gdb-*.tar.gz file here, and adapt the commands below if necessary.

wget http://ftp.gnu.org/gnu/gdb/gdb-7.6.2.tar.gz
tar xvfz gdb-7.6.2.tar.gz
cd gdb-7.6.2
cp gdb/gdb /usr/local/bin

Take care about that the /usr/local/bin is at the beginning of the PATH you are using while running QtCreator.

You can place the following line into your .profile:

export PATH=$PATH:/usr/local/bin 
| improve this answer | |

Had the same problem using Debug in kdevelop with my C code. Disdabled the "Use External Terminal" option under Run/Configure Launches and it works like a charm.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.