Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-10

How do you debug a console program in Linux GUI mode?

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frank Church

I am trying to debug a program in Ubuntu gnome.

In Windows the program runs starts as a console program which has the ability to open a GUI.

In Linux only the GUI comes up. When I run the program directly from the gnome-terminal I get the console output.

How do I configure Lazarus to do the same - start up the console then run the GUI?

Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111001/f08b6b6f/attachment.html>

Reply by email

Martin
to Frank Church
Frank Church wrote 10 lines
I am trying to debug a program in Ubuntu gnome. In Windows the program runs starts as a console program which has the ability to open a GUI. In Linux only the GUI comes up. When I run the program directly from the gnome-terminal I get the console output. How do I configure Lazarus to do the same - start up the console then run the GUI?

At least 0.9.31 has a console window in the "View" menu, "Debug windows"

Not sure about 0.9.30.

There may be an option in the debugger-tab, of the options dialog: ConsoleTTY.
If so, open a terminal (any terminal), run "tty" (should return /dev/ppy/n), and enter the result.

In Lazarus versions 0.9.28, just run Lazarus from a console

Reply by email

Martin
to Reimar Grabowski
Reimar Grabowski wrote 7 lines
On Sat, 1 Oct 2011 19:51:17 +0100 Frank Church wrote: > How do I configure Lazarus to do the same - start up the console then run > the GUI? Check Run->Run Parameters->Launching application

True, that is another way => but it may not always work with the debugger

Reply by email

Frank Church
to Reimar Grabowski: On Sat, 1 Oct 2011 19:51:17 +0100 Check Run->Run Parameters->Launching application R.
Reimar Grabowski wrote 8 lines
On Sat, 1 Oct 2011 19:51:17 +0100 Frank Church wrote: > How do I configure Lazarus to do the same - start up the console then run > the GUI? Check Run->Run Parameters->Launching application

I have tried this method and it works. How do I check that it is working with the debugger?

Show quoted text 8 lines
R. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111001/b65815d8/attachment.html>

Reply by email

Martin
to Frank Church
Frank Church wrote 17 lines
On 1 October 2011 20:07, Reimar Grabowski < <mailto:>> wrote: On Sat, 1 Oct 2011 19:51:17 +0100 Frank Church < <mailto:>> wrote: > How do I configure Lazarus to do the same - start up the console then run > the GUI? Check Run->Run Parameters->Launching application I have tried this method and it works. How do I check that it is working with the debugger?

Set a breakpoint?
If it stops, then it is ok.

There was an old report that it did not work with "xterm" (and/or maybe other terminals?).
As gdb would then debug the starter-app

Make sure you have gdb set as debugger in the environment options.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111001/a4ae0cce/attachment.html>

Reply by email

Bernd
to Martin

In the project options uncheck the "win32 GUI application". Then it will be run inside a terminal on linux when started from the IDE. This will not interfere with debugging. But it will also make the compiled program always have a black DOS box in windows, even when run outside the IDE. (The difference in the binary affects only the windows binary, on all other platforms this option only affects how it is started when run from within the IDE).

Maybe this option should be inverted and renamed to: "program needs console window". This will also affect whether on windows an attempt to writeln() will crash your application due to missing stdout.

The IDE is using TProcess to start the application and the type of terminal (xterm or other) that comes up is not configurable in the IDE, it is TProcess (with the show console flag) automatically trying to decide what is the default terminal app on your system.

Reply by email

Martin
to Bernd
Bernd wrote 8 lines
2011/10/1 Frank Church: >> Check Run->Run Parameters->Launching application > I have tried this method and it works. How do I check that it is working > with the debugger? The debugger will then "debug" xterm instead of your program and neither breakpoints nor anything else will work, the debugger will essentially be useless.

Can you check menu "run" "run params". Make sure no starter app is selected.

To watch your apps output, use "View" "debug windows" "console output"

Reply by email

Michael Schnell
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 11 lines
Bernd schrieb: > Maybe this option should be inverted and renamed to: "program needs > console window". This will also affect whether on windows an attempt > to writeln() will crash your application due to missing stdout. +1 The current wording is very inprecise/confusing, should be rephrased in any case.

+1
-Michael

Reply by email