Recent

Author Topic: Unable to get debugger working on V2.0RC2 -- High Sierra  (Read 4300 times)

Dr_Bob_MILLER

  • Newbie
  • Posts: 4
Unable to get debugger working on V2.0RC2 -- High Sierra
« on: November 08, 2018, 04:32:14 pm »
I am a longtime Delphi developer (since Delphi 1), with Windows-based commercial products of my own that I really want to convert to cross platform.  I am able to work with Lazarus 1.8.4 on Windows, but am new to Mac OS. I have been able to install Lazarus well enough to get it to compile and run without debugging, but have FAILED to get the debugger to work at all.

After spending several days getting the code signing set up for gdb but still not being able to run, I learned that lldb support is included in V2.0RC2.  I tried to set up for multiple Lazarus configs, but my attempts to use the command line to set this up FAILED.  (See attached file Failed_pcp.txt from a Terminal run.)

At this point, I took a chance on installing V2.0RC2 anyway, knowing it would overwrite v1.8.4.  I followed directions (as best I could figure) to set it up to use lldb as the debugger.  (See my debugger settings in attached file LLDB_Settings.png).

But once again, I could get Lazarus to compile and run a trivial test app without debugging, but debugging FAILED.  Debugger error dialog gave no specifics.

I had looked at this forum, and tried to closely follow thread http://forum.lazarus.freepascal.org/index.php/topic,42863.0.html

I tried to set up a debug log (see formula I tried in attached file DebugLogFormula.rtf) but that also FAILED.  (See Terminal run in attached file DebugLogFails.txt)

The problem I keep having, over and over again, is that the Lazarus docs will try to tell you how to do something, but at some key point in the explanation, the author is a bit vague about exactly HOW to do a step, or exactly WHERE to find something or to place something.  They assume that everybody already knows these details for the operating system in question.  And MacOS is so extremely locked down that this becomes a problem very quickly.

I really hope that someone can help me. I'm really not an idiot, though I have undoubtedly made some idiotic mistakes here.

Lazarus is now far more important than I had ever expected.  Windows 10 is becoming so unstable that it is hard to see how I can continue supporting my products on it -- programs that I released 2 years ago are failing to run due to failures in Microsoft's own API calls!  As someone else put it, Windows 10 is always a Beta now, and things get broken with every one of their forced "updates."  I really NEED to get Lazarus working on MacOS.

"Help me, Obi-Wan Kenobi, you're my only hope..."

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Unable to get debugger working on V2.0RC2 -- High Sierra
« Reply #1 on: November 08, 2018, 04:54:13 pm »
I do not know the arguments that "open" takes.
Code: [Select]
open /Developer/lazarus/lazarus.app/Contents/MacOS/lazarus --debug-log=/path/to/yourfiles/laz.log --debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INFO
open: unrecognized option `--debug-log=/path/to/yourfiles/laz.log'

But it seems that "open" tries to interpret the arguments, that you mean to go to lazarus.
Have you tried to start lazarus without using open?

Are you sure you have the right path to lldb? I do not have a Mac at current, but IIRC, the path was much shorter when I tested.
What is the result of
 
Code: [Select]
which lldb

Dr_Bob_MILLER

  • Newbie
  • Posts: 4
Re: Unable to get debugger working on V2.0RC2 -- High Sierra
« Reply #2 on: November 08, 2018, 06:01:51 pm »
Quote


Quote
Have you tried to start lazarus without using open?

If you mean if I have tried to run lazarus from a command line that does not include "open", the answer is "yes, but that gives an error message stating that it cannot find a command named "open". 

Quote
Are you sure you have the right path to lldb?
No, absolutely not! 

Quote
What is the result of "which lldb" ?

AHA!  THANKS for that!  I had used something different.  Adding this in the Lazarus Debugger settings seems to help, though it's not clear whether it is fully working yet.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Unable to get debugger working on V2.0RC2 -- High Sierra
« Reply #3 on: November 08, 2018, 06:48:51 pm »
There are some restrictions. Like properties (eg TList.Count) do not work. This is a general problem on all platforms.

You should be able to:
- set a breakpoint, run your app (F9) and pause at the breakpoint
- step with F7/F8, and other
- see Watches (hover the mouse, over a variable), open the Locals, or watches window)
- see assembler
 
What does not work in lldb:
- watchpoints (aka data breakpoints): pause when a variable's value is changed
- change the content of a variable during debugging.

That is just from the top of my head, I havent got a full list.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Unable to get debugger working on V2.0RC2 -- High Sierra
« Reply #4 on: November 08, 2018, 06:53:54 pm »
Quote
Have you tried to start lazarus without using open?

If you mean if I have tried to run lazarus from a command line that does not include "open", the answer is "yes, but that gives an error message stating that it cannot find a command named "open". 
Strange.

It should work, as long as you give the full path into the package (i.e. include the Contents/MacOs ... stuff).

To make sure you have no typos in the input, you can use the tab key, to autocomplete the name of each folder, and the exe. That is if your terminal runs a user friendly shell, like bash.  (if tab does not autocomplete, you may have a typo / to test if tab works at all, enter ./ and press it twice, it should show you at least all subdirectories of the folder you are in)

Dr_Bob_MILLER

  • Newbie
  • Posts: 4
Re: Unable to get debugger working on V2.0RC2 -- High Sierra
« Reply #5 on: November 08, 2018, 08:44:49 pm »
Thanks for that "you should be able to do..." stuff.  I am making progress, but it definitely behaves differently than Delphi.

Actual F7,F8, and F9 keys do NOT seem to work for me on MacOS -- the Lazarus Run menu in MaxOS shows Step Over as being one of those awkward Apple 3-key combinations:
Step Over = (some sort of up arrow but not the upper caret that appears on the Control key)
                 + (4 leaf clover Apple key)
                 + "R"

I find this combination very hard to reach and press simultaneously, but "Step over" menu item works.

One bit of confusion is that sometimes when I tell it to run, it creates the actual running main form window exactly behind the designer form for the main window.  So you think that the debugger is being very slow to start running, since you don't see the actual running program until you move the designer window away.  Wouldn't you expect designers to disappear during a run -- even a debug run?

Another confusion is caused by the way Apple places a program's menu across the top of the desktop, instead of attached to a form window.  My little test program only contains 1 button, so when I press the button on my test app, the Lazarus menu goes away until I click on the code editor window.

But hey, thanks to your help, I can at least get Lazarus to function in MacOS now.  Thanks a bunch!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Unable to get debugger working on V2.0RC2 -- High Sierra
« Reply #6 on: November 08, 2018, 09:26:10 pm »
Right, for Mac OS the IDE uses different keys. This is afaik because the normal keys are already allocated by the OS.
You can go the the Tools> options > editor > keymap: and change them.

Quote
One bit of confusion is that sometimes when I tell it to run, it creates the actual running main form window exactly behind the designer form for the main window.
If the IDE is active, yes that is normal.
You can:
- set the form's positioning property to something like desktopcenter
- define a "desktop" in lazarus that closes the designer (afaik that is possiple) (monitor icon in the toolbar, left of component pallete)
- close the designer form yourself, before debugging
- use (anchordocking and) sparta form designer (I am not sure how well those work on Mac, they are still new)
- Tools > Option > Environment > Window: "Hide IDE windows on run". This will do even more
Ask in a separate thread, there may be others with better answers


 

TinyPortal © 2005-2018