Author Topic: Irritating error message when debugging in XTerm  (Read 22760 times)

Offline Napoleon

  • Multiple posting newcomer
  • *
  • Posts: 59
Irritating error message when debugging in XTerm
« on: April 06, 2014, 07:52:33 am »
Using Code::Blocks 13.12, when I run my project in debug mode, using XTerm by default, I always get the following error:
Quote
"warning: GDB: Failed to set controlling terminal: Operation not permitted"

I've never had a problem debugging my code, but would like to make this error go away.

So, I've looked around for an answer explaining how to fix this problem but haven't found a solution.  Only references to bugs in GDB, and that the same bug appears for NetBean users.
Removing the -e option in Settings->Environment->General->Terminal launch command causes XTerm to not display.  In fact I get a message in the Debugger Log saying Can't launch console (xterm -T 'Program Console' sleep 80002690).

So I had a look at the XTerm Manual for an explanation of the -e option, see below:
Quote
-e program [ arguments ... ]
    This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line. This must be the last option on the command line.

The default launch command does not specify what the program and arguments are.  So I would like to put those parameters in.  However I cannot find which CodeBlocks predefined variables to use.  I've been considering using:
$(TARGET_NAME), but that is the build target, which I'm not sure is the same as the debugging target, and
I cannot find the variable that holds the "program arguments".

Can anyone help?

Cheers,
Nap

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Irritating error message when debugging in XTerm
« Reply #1 on: April 06, 2014, 02:36:47 pm »
Why do you think this is an error?
As far as I can read it says it is a warning :)
Are you able to debug your program?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5494
Re: Irritating error message when debugging in XTerm
« Reply #2 on: April 06, 2014, 03:16:44 pm »
Quote
I've never had a problem debugging my code, but would like to make this error go away.

Just a valid request to get rid of this annoying message. It gives the FALSE impression that something might be wrong.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Irritating error message when debugging in XTerm
« Reply #3 on: April 06, 2014, 06:20:31 pm »
Then someone should fix GDB... as far as I know we could not do anything about it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Napoleon

  • Multiple posting newcomer
  • *
  • Posts: 59
Re: Irritating error message when debugging in XTerm
« Reply #4 on: April 07, 2014, 08:17:39 am »
@KillerBot, thnx.
@oBFusCATed; Sorry for using the word ERROR when I should have used WARNING.  However my intention remains, I would like to make it go away.

Everyone is pointing to GDB, but the -e parameter in XTERM is expecting a program name and arguments to follow, which don't seem to be supplied by the default launch command, unless Code::Blocks appends them automatically somehow in during the launch sequence. 

From a gnome-terminal, typing:
Code
 xterm -e "/usr/bin/gdb -quiet /home/user/Documents/3420ICT/assignments/a1/bin/Release/a1"
opens XTerm, launches the GDB in quiet mode, gives me a message "Reading symbols from ...", loads my program, prints another message ".done." and gives me the (gdb) prompt.  No Warnings.

This suggests to me that perhaps there needs to be something after the -e in the Settings->Environment->General->Terminal launch command field.

Cheers,
Nap

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Irritating error message when debugging in XTerm
« Reply #5 on: April 07, 2014, 06:01:07 pm »
This won't work, because GDB must be a child process of C::B, because C::B needs to control it.
For this purpose we're starting gdb directly and also start a terminal using something like "xterm -e sleep randomnumber"
Then we use the tty command to tell gdb which terminal (tty) to use.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Irritating error message when debugging in XTerm
« Reply #6 on: April 08, 2014, 02:07:19 am »
It has nothing to do with C::B and xterms -e parameter or anything like this.
You can get it without any IDE, just two terminals and gdb.
Open one terminal, get it's tty, start gdb from a second terminal, but use the first one as control terminal with the --tty parameter, run a prigram from inside gdb and you get the warning.

I've read that running netbeans with sudo fixes the warning, that doesn't work for C::V or gdb in console.

The (real?) cause seems to be in linux kernel or better in the way we (have to) start gdb:
http://stackoverflow.com/questions/7407088/kdevelop-debugging-warning-failed-to-set-controlling-terminal-operation-not-pe

Offline Napoleon

  • Multiple posting newcomer
  • *
  • Posts: 59
Re: Irritating error message when debugging in XTerm
« Reply #7 on: April 08, 2014, 12:18:09 pm »
Well, thanks for having a look, and I'll just continue enjoying C::B's ease of use and wait and see what happens in the mean time.