Recent

Author Topic: Application runs as a child of Lazarus  (Read 3137 times)

Grahame Grieve

  • Sr. Member
  • ****
  • Posts: 365
Application runs as a child of Lazarus
« on: October 05, 2021, 08:03:13 am »
When I'm debugging my application, it brings up a window, but the window is a child of the Lazarus process, and it doesn't appear as it's own application. I'm not starting the application the normal way in the .dpr - it's a console application thtat brings up a window to emulate the console, so I can see what's going on while I debug. but I thought I'd started it equivalently.... what should I be looking for?

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Application runs as a child of Lazarus
« Reply #1 on: October 05, 2021, 08:52:58 am »
Well, of course a program being debugged is a child of Lazarus... or strictly, it's a child of the debugger which is a child of Lazarus.

Do you really mean that you don't like your output being in the "Console In/Output" window? In that case try starting the program from the console and then attach (Run -> Attach to program) which should be a bit better behaved.

All subject to Lazarus version, OS etc. about which you've told us nothing.

I did a bit of work on the console window a couple of years ago, but I think that the whole thing is a bit of a struggle particularly where non-ANSI characters are involved. Some of the stuff I put in might have got lost since but while it would be nice to have fully-formatted output I'm not sure that that ideal is compatible with the window being informative as to what the program being debugged is really doing.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Grahame Grieve

  • Sr. Member
  • ****
  • Posts: 365
Re: Application runs as a child of Lazarus
« Reply #2 on: October 07, 2021, 03:01:31 pm »
I didn't say the OS, since I posted on the MacOS board. So: MacOS. Using trunk of FPC and Lazarus. There's no console in MacOS - that's what the docs say: windows has a console, linux has the console view, but MacOS... nothing.

Other programs I've debugged run as their own application (e.g. alt-tab) not child windows of Lazarus. So I'm wondering what's different about this application as opposed to others

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Application runs as a child of Lazarus
« Reply #3 on: October 07, 2021, 04:15:25 pm »
Not sure. But I would expect such behaviour to be controlled by the lldb exe (or gdb if you still use that).

I don't know Mac very well. But I believe that a console app should be started from a pre-existing console?
Under Linux the IDE has "view > debug > console output". But that does not work on Mac. (Nobody seems to know how to implement it).

However lldb has an option to open a new console before launching an app. That can be controlled in the global debugger settings: Tools > Options > debugger > backend.

This then applies to all your projects. However, you can create 2 lldb backends (with/without this setting), and then in the project settings chose either backend.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Application runs as a child of Lazarus
« Reply #4 on: October 08, 2021, 12:36:49 am »
I find using NSLog to log debug output useful. See Using stdout and stderr for logging and debugging.

 

TinyPortal © 2005-2018