Recent

Author Topic: Problems with Debugger on OSX  (Read 1228 times)

ahnz

  • New member
  • *
  • Posts: 19
Re: Problems with Debugger on OSX
« Reply #30 on: April 15, 2019, 10:34:17 pm »
Hi

Quote
Just for clarification:

It is your project that is on the NAS (except the compiled app?):

Originally, my project was on the NAS, including the compiled App. But cognisant of strange occurrences with other, entirely unrelated apps, I decided to copy the project to my local drive to eliminate the possibility of issues with an AFP share an the NAS.

When I first tried the things I did for you yesterday I noticed the NAS being referenced in the debug_log so I (a) completely deleted the project from the NAS and (b) checked there was no occurrences of NAS in any of the project files.

Then, when I did the final debug for you I could see no references to NAS so there shouldn't be any reference to it now

Quote
2) The reason for the failed launch (debug session aborted before project is started) is a filename matching the IDE trigger for another error message. Working on a fix.

3) The reason some debug info is not loaded (timestamp issues).

It looks like I've fixed these - though I have said that before and was proven wrong, so I do want to do some ore testing before I confirm completely. What had happened is, when I copied my project from the NAS to the local drive, the Application Bundle which is effectively a symbolic link to the compiled app, was expanded and the then compiled app copied rather than the link. The result being that no matter how many changes and compiles I did, I was always running the same version of the app from days ago. Instead of running the freshly compiled ./BareBones/project1 I was always running BareBones/project1.app/Contents/MacOS/project1

Once the Application Bundles was deleted and recreated I can now compile and run with debug and, step through. though I do have one question.

When I step though this ...

Code: Pascal  [Select]
  1. function TForm1.GetHe: string;
  2. begin
  3.   GetHe := 'He ';
  4. end;
  5.  
  6. procedure TForm1.Button1Click(Sender: TObject);
  7. var
  8.   s: string;
  9.   i: integer;
  10. begin
  11.   s := 'That Tickles, ';
  12.   for i := 1 to 3 do
  13.     s := s + GetHe;
  14.   Label1.Caption := s;
  15. end;
  16.  

... and view the local variables, the string 's' only shows the first character... is that normal?

All up it looks like the issue is resolve - but I say that once before so.. I'm off to do some more testing

Just for good measure, the debug_log is attached

Anything else you want me look at, just let me know

Cheers

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5240
    • wiki
Re: Problems with Debugger on OSX
« Reply #31 on: April 15, 2019, 10:47:28 pm »
... and view the local variables, the string 's' only shows the first character... is that normal?

I have to check, so I would expect not.
Does it happen in the watches win too?

Are you using dwarf+sets or dwarf-3 ?

----------------
Just noted something in the log.
That is a 32bit app?
« Last Edit: April 15, 2019, 10:49:12 pm by Martin_fr »

ahnz

  • New member
  • *
  • Posts: 19
Re: Problems with Debugger on OSX
« Reply #32 on: April 16, 2019, 12:23:28 am »
I was using dwarf-3. The same thing happened with the watch Window, only the 'T' was shown.

With dwarf-2 and with-sets, it appears to work ok with both the local variables and watch windows correctly showing the string.

I've compiled my bare bones with 32bit and 64bit and all appears well with debug.

I've now got another issue which may or may not be a debug problem, I don't know.

Copied my main project to my local drive, fixed up the application bundle. Its 64bit. Its uses SQLite and works perfectly Ok if compiled with a bog standard Lazarus v2.0.0. However, with rev 60971 ....

Clean & Build, Run without Debug.. It errors with "Can not load SQLite Client library "libsqlite3.dylib". Check you installation" - If I Ok this app runs ok (without access to the DB) and terminates cleanly when I close

Clean & Build, Run WITH Debug.. It errors with "Can not load SQLite Client library "libsqlite3.dylib". Check you installation" - If I Ok this app runs ok (without access to the DB) but when I close the app it error with an exception

/usr/lib/libsqlite3.dylib exists and including /usr/lib with -FI make no difference

Q.

Why would rev 60971 failed to find the SQLlite library, when the same app compiled under Laz 2.0.0 work perfectly Ok

Does this also point to a debugger issue not dealing with another nil object somewhere?

Attached is the debug log from the failed Run with Debug

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5240
    • wiki
Re: Problems with Debugger on OSX
« Reply #33 on: April 16, 2019, 12:53:06 am »
I cant see how the sqlite issue would be debug related.  The exception may just be un-noted outside the debugger.

AFAIK sqlite is part of the fpc packages (the stuff in lazarus seems to be just the component editor and registration). Since your updated lazarus use the same fpc, it should use the same code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5240
    • wiki
Re: Problems with Debugger on OSX
« Reply #34 on: April 16, 2019, 01:36:51 am »
The string len issue appears to be an fpc issue https://bugs.freepascal.org/view.php?id=35386

It only applies to 32 bit with dwarf-3.

You may be able to inspect the value using (if pchar is used by your app, and the debugger can find it)
pchar(thestring)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5240
    • wiki
Re: Problems with Debugger on OSX
« Reply #35 on: April 17, 2019, 05:15:05 pm »
I improved error detection during launch. For now in trunk only. (2.0.4 depends on further testing)
Trunk Revision: 61001
LazDebugger(Fp)Lldb: improve checks for errors during launch command. Ignore text in file names.
https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&root=lazarus&revision=61001


So if the timestamps are wrong, the app should now launch (it did fail in some cases, if certain filename where involved, i.e. the word "process" in a filename).

However debug info for any file with wrong timestamp is not loaded. Not by the IDE, and not by LLDB. So for those files (listed in the something went wrong dialog), neither breakpoints nor watches will work.

As to what exactly causes the wrong timestamps is unclear. And currently all the info suggests that it is done by Apple's toolchain. But that is a guess....


At the very start of this thread (when things were still crashing) there also was an issue that the IDE could not watch variables in files with correct time stamp. This has not been reproducible since the use of fixes branch.
For now I will assume that it was fixed since the release.

If it re-occurs (breakpoint works in a file, but watches do not) then logs for this are welcome.


As for issues with values of watches (such as the string being shortened). Those should be kept to be reported.

Currently known:
- interfaces => do not show / ident not found
- function references (type TFOo= function...) => ident not found
- Most string types will cut off at the first #0
- there are hardcoded length limits (string/array) 3000 or 5000
- ansistring, 32bit dwarf 3 => only first char
- most values of untyped constants are not shown: const a= 5;



ahnz

  • New member
  • *
  • Posts: 19
Re: Problems with Debugger on OSX
« Reply #36 on: April 17, 2019, 10:06:47 pm »
Hi,

Quote
As to what exactly causes the wrong timestamps is unclear.

I believe the problem was a mistake on my behalf...

Quote
What had happened is, when I copied my project from the NAS to the local drive, the Application Bundle which is effectively a symbolic link to the compiled app, was expanded and the then compiled app copied rather than the link. The result being that no matter how many changes and compiles I did, I was always running the same version of the app from days ago. Instead of running the freshly compiled ./BareBones/project1 I was always running BareBones/project1.app/Contents/MacOS/project1

The only problem I have now that I need to solve is why my app compiles and runs ok for 2.0.0 but fails to find/load libsqlite3.dylib when compiled and run with/without debug under  rev 60971

Thanks for all your help with this - much appreciated