On windows there is a known problem. You can either:
- use FPC 2.6.0 and you should be able to debug.
- Try Stabs, sometimes works, but not sure, if always
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Win_64_bitAs for your linux issue:
I do not know what opens the terminal for you. Unlike windows on linux an application does not have it's own terminal, but uses the window of the terminal from which it was started,
If double clicked an icon on the desktop, I do not know, but usually there is no terminal.
If started from Lazarus (debugger disabled), I wouldn;t expect one (unless configured under "Run" > "Run param". But it may be that on your system TProcess creates the terminal....
If you have a console app or plain program, then Lazarus probably somewhere opens the terminal...
And yes in the debugger you are not getting that.
In older lazarus, you could start Lazarus from a terminal, and then your program's in/output would be on that console.
There were several changes (at different times), and I am not sure which are already in 0.9.30 (including 0.9.30.2) and which are only in 0.9.31
In 0.9.31 you have a console window. It has an input field, but that's only good for readln, not for read.
Another option is in the Tools or Environment menu, under "Options" > "debugger" you find an object ispector like grid, that allows to set a "console tty"
Open a terminal (outside lazarus), and run "pty" , you get something like /dev/pty1
Enter that as config, and your apps in/output go to that terminal.
----------
The problem with the original solution was that your apps output went into the same stream as the gdb output (which the IDE must read), in some cases this could hang the IDE, as it would not recolonize a token returned by gdb and wait forever.
The terminal window is the solution that should be used instead => but it needs still work. (Ideally a full terminal emulation).