Forum > Debugger

debug compiled pascal code

(1/1)

old_pascal:
Hello. This is my first post.
I wold like to use lazarus like my freepascal ide in windows. But there is a thing I have in my Linux box I have not in lazarus for windows. A built in terminal emulator. I make lots of terminal programming and I need run the compiled pascal code and get an "writeLn" print. Linux lazarus have a built in teminal emulator. Lazarus for windows display a pop-up native teminal. Works, but is  boring and inefficient because I need close the pop-up window all the time and is difficult to copy the displayed text. Does exist any way I can embed a terminal emulator in my Lazarus copy like a debug facility? I am using Lazarus 2.020 (jan, 2022).

I am editing my question to add I forgot to mention that what  I want is to capture the stand stdout/stderr from a compiled pascal code. I mean, I compile/build a freepascal "*.pas" file and run it immediately capturing the writeLn out put in the stdout. I do it all the time in C using Geany text editor in both Windows and Linux. Having a built in console inside the Lazarus editor could be great because keep it in family :). Thank you for all answers.

MarkMLl:
You will find that WriteLn() etc. works fine when a program is started from a shell session.

MarkMLl

Thaddy:

--- Quote from: old_pascal on February 06, 2022, 05:39:47 am --- and is difficult to copy the displayed text.

--- End quote ---
How so? Select and press enter... That is not difficult.

You can keep the terminal open by entering a debug define on the top of the Lazarus project file (lpr)
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$IFOPT D+}{$APPTYPE CONSOLE}{$ENDIF}This will keep a terminal open during debug and the GUI part of the program will still work.

PascalDragon:

--- Quote from: old_pascal on February 06, 2022, 05:39:47 am ---I wold like to use lazarus like my freepascal ide in windows. But there is a thing I have in my Linux box I have not in lazarus for windows. A built in terminal emulator. I make lots of terminal programming and I need run the compiled pascal code and get an "writeLn" print. Linux lazarus have a built in teminal emulator. Lazarus for windows display a pop-up native teminal. Works, but is  boring and inefficient because I need close the pop-up window all the time and is difficult to copy the displayed text. Does exist any way I can embed a terminal emulator in my Lazarus copy like a debug facility? I am using Lazarus 2.020 (jan, 2022). Thank you.

--- End quote ---

The terminal emulator on Linux was only introduced because it does not have the same ability that Windows has of having a shell be shown by the OS itself. The terminal emulator on Linux is inferior to a real terminal due to all the features that a terminal has and implementing one for Windows would be just as complex and essentially useless, because Windows itself does this for us already.

And why you need to close the terminal window manually? Once the application is stopped the window will be closed as well.

Copy/Paste takes some getting used to, but in the end it's consistent as well: you select with the mouse and then hit enter to copy it into the clipboard. You can insert text by right clicking.

Martin_fr:
If you want to combine
- your choice of terminal
- debugging in the IDE
there isn't anything out of the box.

Afaik it should be possible using gdb server. It's not the most comfortable though.

In the terminal of your choice:
gdbserver {args for host and port}  your_exe

And the use LazDebuggerGdbmiServer (you may have to install that package to the IDE), and connect to the gdbserver.

This works only with gdb, not with fpdebug.

Implement (and maybe contribute) your terminal in pascal, so it can be used instead of the "console output" of the IDE.

Navigation

[0] Message Index

Go to full version