Recent

Author Topic: [Solved] Console application not running in IDE  (Read 3132 times)

andresayang

  • Full Member
  • ***
  • Posts: 124
[Solved] Console application not running in IDE
« on: May 04, 2022, 06:38:34 pm »
Hi All,

Well, I do not know what is going wrong, but I can not run a console application from IDE.
If I build and run from outside, no problem at all.

Lazarus 2.2.0, Debian 10, fresh install.

If anyone has an idea ? (maybe a compiler option wrongly set ?)

Thanks
« Last Edit: May 05, 2022, 10:18:54 am by andresayang »
Linux, Debian 12
Lazarus: always latest release

Handoko

  • Hero Member
  • *****
  • Posts: 5524
  • My goal: build my own game engine using Lazarus
Re: Console application not running in IDE
« Reply #1 on: May 04, 2022, 06:47:59 pm »
Did it run on your previous Lazarus versions?

I am not sure but you can try:
Lazarus main  menu > View > Debug Windows > Console In/Output

andresayang

  • Full Member
  • ***
  • Posts: 124
Re: Console application not running in IDE
« Reply #2 on: May 04, 2022, 07:14:19 pm »
Hello

Did it run on your previous Lazarus versions?: well I think I was able to set break point before.
But I'm not sure.

The thing is that It does not create any output, simply rename some binary files from the content of the file itself. So there is no I/O console.
When i try to run it, it seems to build, but nothing happen, the program is not executed (and there is "?" if I set break points)

I can run it from outside IDE, it works, no problem (debug with "very old fashion writeln" and I was able to chase my memory leaks).

I'm almost sure that on previous version, I was able to run step by step console application.

Cheers
Linux, Debian 12
Lazarus: always latest release

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: Console application not running in IDE
« Reply #3 on: May 04, 2022, 08:42:15 pm »
Please note "Quote" button so you can provide a bit of context to your messages where necessary.

When i try to run it, it seems to build, but nothing happen, the program is not executed (and there is "?" if I set break points)

Your combination works OK for me on x86_64. "?" suggests the program's being built without debugging information. Are you /sure/ it's not running, or are you being misled by not being able to set a breakpoint?

Also check whether Run -> Run without Debugging works.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

andresayang

  • Full Member
  • ***
  • Posts: 124
Re: Console application not running in IDE
« Reply #4 on: May 04, 2022, 10:27:20 pm »
Quote
Also check whether Run -> Run without Debugging works.

MarkMLl

Run without Debugging works ! The program run fine.

Program not executed if I use only Run (with or without debugging info)
Not able to set break point with debug options (all works the way it should when I make a standard lcl application)
I tested with all debug infos option, I usually use "automatic"

Thanks for your help

Cheers

Linux, Debian 12
Lazarus: always latest release

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12208
  • Debugger - SynEdit - and more
    • wiki
Re: Console application not running in IDE
« Reply #5 on: May 04, 2022, 10:49:30 pm »
Menu: Run > Run parameters

Make sure that:
- "Host Application" is empty
- "Launching Application" is empty (or disabled)

It is not possible to debug your app in an external "terminal". (That used to work with some terminals (and gdb) 10 years ago, but nowadays I don't know any terminal that supports this / Most terminals use some "main-controller process" that the debugger never sees).

- Any output/input of your app should go via: View > Debugger Windows > Console Output
- There should be no new terminal window opening up.




Are you using FpDebug or Gdb? Tools > Options > Debugger > Backend



If you need an external terminal, it might be possible using gdbserver. Not tested.
You need the gdb-server backend of the IDE, and then pretend you debug on a remote system. Only the remote is the local PC.
Then you can manually start gdbserver in an existing terminal of your choice. After that connect the IDE....

andresayang

  • Full Member
  • ***
  • Posts: 124
Re: Console application not running in IDE
« Reply #6 on: May 04, 2022, 11:00:29 pm »



Are you using FpDebug or Gdb? Tools > Options > Debugger > Backend




Thanks a lot: Tools > Options > Debugger > Backend was set to none. I set it to FpDebug internal Dwarf-degugger

And now it is working, and I can set breakpoint.

Problem solved, thank you.

How to write as "solved" in forum ?
« Last Edit: May 04, 2022, 11:22:39 pm by andresayang »
Linux, Debian 12
Lazarus: always latest release

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12208
  • Debugger - SynEdit - and more
    • wiki
Re: Console application not running in IDE
« Reply #7 on: May 05, 2022, 12:10:11 am »
How to write as "solved" in forum ?

Edit the your first message in this thread.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: Console application not running in IDE
« Reply #8 on: May 05, 2022, 09:21:25 am »
It is not possible to debug your app in an external "terminal". (That used to work with some terminals (and gdb) 10 years ago, but nowadays I don't know any terminal that supports this / Most terminals use some "main-controller process" that the debugger never sees).

But you can attach to an already-running process.

Quote
If you need an external terminal, it might be possible using gdbserver. Not tested.
You need the gdb-server backend of the IDE, and then pretend you debug on a remote system. Only the remote is the local PC.
Then you can manually start gdbserver in an existing terminal of your choice. After that connect the IDE....

Works fine. I've mentioned it on multiple occasions, and I believe we've discussed startup parameters etc.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1222
    • Burdjia
Re: [Solved] Console application not running in IDE
« Reply #9 on: May 05, 2022, 12:21:49 pm »
Note that in Linux a console program doesn't opens a terminal: you must open it explicitly. On Windows it opens a terminal event if you don't do it explicitly.  That means, running a console program from Lazarus on Linux will look like do nothing; actually it does but std i/o streams are /dev/nil or similar.

By the way, you said break points didn't work.  That's weird but, are you sure you put them correctly?  Maybe they don't work because the code never reach that line.  Just wondering.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

PascalDragon

  • Hero Member
  • *****
  • Posts: 6356
  • Compiler Developer
Re: [Solved] Console application not running in IDE
« Reply #10 on: May 05, 2022, 01:10:22 pm »
By the way, you said break points didn't work.  That's weird but, are you sure you put them correctly?  Maybe they don't work because the code never reach that line.  Just wondering.

andresayang already wrote that the debugger was set to None. No wonder that breakpoints don't work then.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1222
    • Burdjia
Re: [Solved] Console application not running in IDE
« Reply #11 on: May 08, 2022, 12:02:10 pm »
By the way, you said break points didn't work.  That's weird but, are you sure you put them correctly?  Maybe they don't work because the code never reach that line.  Just wondering.

andresayang already wrote that the debugger was set to None. No wonder that breakpoints don't work then.
My fault.  I did a fast reading and I miss it (and maybe more things).  :-[
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018