Recent

Author Topic: Lazarus 2.0.0 and LLDB: no output in the Messages window  (Read 3857 times)

jouborg

  • New Member
  • *
  • Posts: 11
Lazarus 2.0.0 and LLDB: no output in the Messages window
« on: February 17, 2019, 11:00:25 pm »
Hi,

When I run my console app, none of the
Code: Pascal  [Select][+][-]
  1. writeln
output appear in the Messages window. When I run the app from a terminal, everything outputs correctly.

Thoughts?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #1 on: February 17, 2019, 11:19:08 pm »
This is a known issue. It applies to OSx, independent of the debugger (so if you codesign gdb, and use gdb, there is also no output).

IIRC (but I have to double check) it requires a virtual tty to be implemented.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #2 on: February 20, 2019, 08:01:28 pm »
I added a workaround.

Get the changes from https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&root=lazarus&revision=60470 (use as patch)

Using the lldb/fpdebug based debugger, in Tools > Option > Debugger, will be a field "LaunchNewTerminal", check it and a terminal will open when you debug your app.

This setting is global, and affects all apps in the debugger. There is no (not yet) per project option.
Also the terminal seems to stay open after debugging....


dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #3 on: February 25, 2019, 01:06:14 pm »
Martin, is it intended that this work in a Carbon IDE ?  Using current Fixes_2_0 and applying the patches, I get a terminal window that contains -

Code: [Select]
Last login: Mon Feb 25 22:53:38 on ttys001
admins-MBP:~ dbannon$ /bin/bash -c 'arch -arch i386 '/Developer/Xcode-beta.app/Contents/SharedFrameworks/LLDB.framework/Resources/darwin-debug' --unix-socket=/tmp/649Lsn --arch=i386 --working-dir '/' --disable-aslr --env='XPC_SERVICE_NAME=lazarus.freepascal.ide.17080' --env='OS_ACTIVITY_DT_MODE=enable' --  '/Users/dbannon/Pascal/SmallTest/DebugTest/project1.app/Contents/MacOS/project1' ; echo Process exited with status $?';exit
arch: posix_spawnp: /Developer/Xcode-beta.app/Contents/SharedFrameworks/LLDB.framework/Resources/darwin-debug: Bad CPU type in executable
Process exited with status 1
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

and no application running. Seems to be same result if I make a 32carbon or 64Cocoa app.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #4 on: February 25, 2019, 01:36:54 pm »
It is actually a lldb feature. I am not sure what lldb supports.
The IDE sets a flag for lldb, telling lldb to launch the app in a terminal..

The strange bit in your output, is that it would seem to me that lldb correctly identified 32bit "arch i386".

However, I am myself not a Mac/OSX expert. (Despite my involvement in the lldb debugger). Maybe someone witch more experience can tell.


dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #5 on: February 25, 2019, 11:22:50 pm »
Yeah, to my surprise, lldb works fine in a 32bit IDE debugging a 32bit application. Or a 64bit application.

The problem I am seeing is when I add your patches to show a terminal, to pickup writeln() output for example. Thats when things go wrong .....

(I cannot comment on how the patches work in a 64bit IDE, I have not been able to build a stable one recently...)

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #6 on: February 26, 2019, 12:57:35 am »
Even if you have a 32bit IDE, you should be able to build your project for 64bit (Project Options > Target)
Lldb should big that up. And the console too, I hope.

I don't know if you can redirect the output to a file, then you can tail that.

There are 2 more options that can be added/implemented to the IDE. But I need to find time to do that. (And potentially also docs on how to....)

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #7 on: February 26, 2019, 01:43:08 am »
Thanks Martin, its not really worrying me personally, I build my app from command line using Lazbuild and it all works fine. I don't need to do a lot of debugging on the Mac, so much easier on Linux (in part, at least, because of the console output). And, yep, last time I looked, redirection to a file was working OK.

So, more in the way of some feedback. Even neg feedback is better that none ! And I do really appreciate the progress thats being made, thanks !

Davo



Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 2.0.0 and LLDB: no output in the Messages window
« Reply #8 on: February 26, 2019, 02:36:55 am »
Well, thanks. Yes any feedback is good.

Glad you are not stuck, due to this.

 

TinyPortal © 2005-2018