Author Topic: Debugging on OSX: how to set tty  (Read 3406 times)

Offline warpino

  • Multiple posting newcomer
  • *
  • Posts: 30
Debugging on OSX: how to set tty
« on: April 23, 2018, 12:12:11 am »
Hi all,

I managed to build the latest svn of Code::Blocks and of the FortranProject plugin.
It is working! I am debugging a fortran project using the Intel debugger gdb-ia
coming with the Intel Fortran Compiler.
While debugging, in order to have to program output on an iTerm window I did the following:

in Environment settings -> General settings
I set "Terminal to launch console programs:" as
Code
osascript -e 'tell app "iTerm"' -e 'create window with default profile' -e 'tell current session of window 1 to write text "$SCRIPT"' -e 'end tell'

and in Settings -> Debugger
I set "Arguments":
Code
--tty=/dev/ttys000

But this only works if the iTerm window that is opened actually is /dev/ttys000.
How can I set the ttys number of the gdb --tty option to match that of the window that will be opened?

Thanks for any help,

w

PS: why does the debugger take approx 1 min to start on OSX while it takes less than 1 sec on Linux?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging on OSX: how to set tty
« Reply #1 on: April 23, 2018, 01:01:29 am »
But this only works if the iTerm window that is opened actually is /dev/ttys000.
How can I set the ttys number of the gdb --tty option to match that of the window that will be opened?
There is a code that tries to detect tty and it then executes the correct gdb command to set the redirection. I guess this code doesn't work correctly on macOS.
Search for console in the code. Probably in cbplugin.cpp or somewhere in debuggergdb/*.cpp.

PS: why does the debugger take approx 1 min to start on OSX while it takes less than 1 sec on Linux?
Is this the same if you start it from the command line?
(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 warpino

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Debugging on OSX: how to set tty
« Reply #2 on: April 23, 2018, 09:17:01 am »
Er... yes, the code is there in cbplugin.cpp
I have no clue on why it does not work

w

Offline warpino

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Debugging on OSX: how to set tty
« Reply #3 on: April 27, 2018, 07:57:20 am »
Quote
Is this the same if you start it from the command line?

It seems that running the debugger from the command line there is no delay whatsoever.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging on OSX: how to set tty
« Reply #4 on: April 27, 2018, 09:31:25 am »
Have you tried to pass the same options cb is passing?
(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!]