Author Topic: Quick patch to make gnome-terminal-server usable with debugger-plugin  (Read 11655 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Newer versions of gnome-terminal start (or reuse) a gnome-terminal-server instead of a single process.
Because of this, the pid returned by wxExecute when starting gnome-terminal is no longer valid and the check whether the started console is still opened fails.
The user gest a message that the console has been closed and is asked whether the debugger should be stopped or not.
Nevertheless debugging works fine, because the tty can be determined coorectly, because or sleep-process is still running, but the console can nt be closed after debugging.

I attach a patch, where the pid can (and will) be changed by cbDebuggerPlugin::GetConsoleTty, if it can not be found.
This breaks the api of the cbDebuggerPlugin-class, but it works.

@oBFusCATed
can you please look into this patch, I know it is probaly not the best solution, but it works with minimal changings.
If there are no objections, I would like to have it or a similar patch in our repo before we do the release, because it allows user to use gnome-terminal again.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #1 on: December 10, 2013, 12:06:07 pm »
Have they removed the --disable-factory option in newer gnome-terminals?
I've not tried any 3.x based one, but the 2.xx version in centos 6 works correctly with this option.
(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: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #2 on: December 10, 2013, 12:22:46 pm »
The option is there and I use it but the gnome-terminal-server is the only visible gnome-terminal process anyway.

From an xterm with no running gnome-terminal at start:
Code
jens@fedora-aspire:~$ ps -eaf | grep terminal
jens      6381  6319  0 12:17 pts/1    00:00:00 grep --color=auto terminal
jens@fedora-aspire:~$ gnome-terminal --disable-factory -t 'Program Console' -x  sleep 1234567
jens@fedora-aspire:~$ ps -eaf | grep terminal
jens      6388     1  1 12:18 ?        00:00:00 /usr/libexec/gnome-terminal-server
jens      6400  6319  0 12:18 pts/1    00:00:00 grep --color=auto terminal
jens@fedora-aspire:~$ ps x -o tty,pid,command | grep "sleep 1234567"
pts/2     6392 sleep 1234567
pts/1     6417 grep --color=auto sleep 1234567
The last command with the output piped to grep is similar to what we do to find our sleep-process, that's why the tty is determined correctly, but the pid returned by wxExecute is invalid.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #3 on: December 10, 2013, 12:28:51 pm »
What version of gnome are you using?
(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: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #4 on: December 10, 2013, 12:39:50 pm »
Currently I use 3.8 (Fedoora 19).
On Fedora 20 with 3.10 I get the following message:
Code
jens@localhost:~$ LC_ALL='C' gnome-terminal --disable-factory
Failed to parse arguments: Option "--disable-factory" is no longer supported in this version of gnome-terminal.
so the functionality might already be removed in 3.8, but the option is still there.
With 3.6 (Fedora 18) it works as expected.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #5 on: December 10, 2013, 01:21:23 pm »
Grrrr. I'll look at it more thoroughly in the next couple of days.
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #6 on: February 02, 2014, 05:05:11 pm »
Sorry for the delay, I haven't been able to look at the patch until now.
I've committed your version first and then decided to improve the code a bit, because it was almost impossible to follow it.
Now it should be more readable and more robust.
Please test and report if there are any problems.
I'll be happy if there is someone on OSX/*BSD that can test it and which is able to verify that there are no problems with it there, too.

p.s. gnome-terminal 3.10.x has the switch removed and I guess this will be serious problem will face in the forum in the future :(
(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: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #7 on: February 03, 2014, 05:33:13 pm »
Please test and report if there are any problems.
Sorry for the delay. my working system was out of order since yesterday evening.
It seems to work.
But instead of "Using sleep command's PID as console PID %d, TTY %s" I would prefer "Using sleep command's PID %d to find tty, TTY %s" or something similar, because we do not need the pid, just the tty the sleep command is running in.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Quick patch to make gnome-terminal-server usable with debugger-plugin
« Reply #8 on: February 03, 2014, 08:20:48 pm »
In fact we need the PID to detect if the terminal has been closed by the user and then show a message for stopping the debug session.
(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!]