Recent

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

ahnz

  • Jr. Member
  • **
  • Posts: 57
Re: Problems with Debugger on OSX
« Reply #60 on: April 28, 2019, 10:33:51 pm »
Sorry to have to advice, but I've just updated to rev 61074 and the issue is still there and the same fix (symbolic link MacOs -> MacOS) works

Cheers
OS: OSX High Sierra 10.13.6
Lazarus: 2.1.0, r61162

Widgetset: Cocoa
Target: 64bit OSX

Compiler:
FPC 3.0.4 [2017/11/26] for x86_64

Debug:
LLDB  (with fpdebug)(Beta)
Path: /usr/bin/lldb
Version: lldb-1000.11.38.2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5515
    • wiki
Re: Problems with Debugger on OSX
« Reply #61 on: April 29, 2019, 01:02:16 am »
Could you look at components/fpdebug/fpimgreaderbase.pas
Line 205
inside
constructor TDbgFileLoader.Create(AFileName: String);
?

And see if it get the correct filename, and what FileExists returns? That is, it is enough to
Code: Pascal  [Select]
  1. debugln(['AFileName = ',AFileName,'  s = ',s, ' err = ',fpgeterrno()]);
on the next line.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5515
    • wiki
Re: Problems with Debugger on OSX
« Reply #62 on: April 29, 2019, 01:08:43 am »
One more thing.

Check the timestamp of the lazarus executable. MAke sure you are using the one that you did rebuild.

Usually in the Lazarus directory, inside the Lazarus.app/Contents/MacOS should be a sym link.
When rebuilding, the exe that is replaced is in the same folder as Lazarus.app (and the symlink points to it)

If you however did build, with a user that did not have write permission to that folder, then the exe ends up in your primary conf path. If that is the case, startlazarus should find it.
But care, if you have 2 installs, that this will not be mixed up.

If you add the debugln, then that will also prove that the correct rebuild version is used.

ahnz

  • Jr. Member
  • **
  • Posts: 57
Re: Problems with Debugger on OSX
« Reply #63 on: April 29, 2019, 02:29:32 am »
I've checked the timestamp of lazarus, and the symbolic link is good. Help | About Lazarus shows rev 61074M


I added the debugln ...

Code: Pascal  [Select]
  1. constructor TDbgFileLoader.Create(AFileName: String);
  2. {$IFDEF MacOS}
  3. var
  4.   s: String;
  5. {$ENDIF}
  6. begin
  7. debugln(['AFileName = ',AFileName,'  s = ',s, ' err = ',fpgeterrno()]);
  8.  

Logs this ..

Quote
AFileName = /mnt/NAS/Documents/Andy/Pascal/src/MyStamps/MyStamps.app  s =  err = 0

The resultant debug log is attached

Cheers
OS: OSX High Sierra 10.13.6
Lazarus: 2.1.0, r61162

Widgetset: Cocoa
Target: 64bit OSX

Compiler:
FPC 3.0.4 [2017/11/26] for x86_64

Debug:
LLDB  (with fpdebug)(Beta)
Path: /usr/bin/lldb
Version: lldb-1000.11.38.2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5515
    • wiki
Re: Problems with Debugger on OSX
« Reply #64 on: April 29, 2019, 09:55:08 am »
Sorry I meant a few lines further down:

Code: Pascal  [Select]
  1.     s := AFileName + PathDelim + 'Contents' + PathDelim + 'MacOS' + PathDelim + copy(s, 1, Length(s) - 4);
  2.     if (FileExists(s)) then AFileName := s
  3.     // debugln goes here
  4.     debugln(['AFileName = ',AFileName,'  s = ',s, ' err = ',fpgeterrno()]);
  5.  

ahnz

  • Jr. Member
  • **
  • Posts: 57
Re: Problems with Debugger on OSX
« Reply #65 on: April 29, 2019, 11:08:16 pm »
Ok, made the change and reproduced the issue.

The I noticed the MacOs in the first line here ...

Code: Pascal  [Select]
  1. s := AFileName + PathDelim + 'Contents' + PathDelim + 'MacOs' + PathDelim + copy(s, 1, Length(s) - 4);
  2. if (FileExists(s)) then AFileName := s;
  3. debugln(['AFileName = ',AFileName,'  s = ',s, ' err = ',fpgeterrno()]);

I changed that and recompiled, the issue has now gone away so I haven't included any debug logs

Then I did a quick search for MacOs in other files under ./components and found it

at line 353 of components/fpdebug/fpimgreadermacho.pas:

Code: Pascal  [Select]
  1.  i := pos('/Contents/MacOs', fname);

and at line 2227 of components /lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas: 

Code: Pascal  [Select]
  1. {$IFDEF MacOs}
  2.  

Are defines case-sensitive?

I haven't changed anything in these two.

I don't know anywhere near enough of the inside of Lazarus, or doing updates with svn etc so can I please leave it to you to the necessary there?


Cheers
OS: OSX High Sierra 10.13.6
Lazarus: 2.1.0, r61162

Widgetset: Cocoa
Target: 64bit OSX

Compiler:
FPC 3.0.4 [2017/11/26] for x86_64

Debug:
LLDB  (with fpdebug)(Beta)
Path: /usr/bin/lldb
Version: lldb-1000.11.38.2

lucamar

  • Hero Member
  • *****
  • Posts: 1942
Re: Problems with Debugger on OSX
« Reply #66 on: April 30, 2019, 12:33:43 am »
and at line 2227 of components /lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas: 
Code: Pascal  [Select]
  1. {$IFDEF MacOs}
Are defines case-sensitive?

No, they aren't; they are like Pascal identifiers in that respect. Change it to MACOS if you feel like it :)

Note, also, that that IFDEF doesn't affect you: the MACOS define is for code intended for "Classical" MacOS (MacOS 1 to 9)
« Last Edit: April 30, 2019, 12:35:32 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5515
    • wiki
Re: Problems with Debugger on OSX
« Reply #67 on: April 30, 2019, 01:36:21 am »
Sorry to have to advice, but I've just updated to rev 61074 and the issue is still there and the same fix (symbolic link MacOs -> MacOS) works
Are you on trunk or fixes branch?

61074 is a revision on trunk.
But "svn up" may show it as result, even if you are on fixes.

The change is currently only in Trunk. It is listed to be merged. http://wiki.lazarus.freepascal.org/Lazarus_2.0_fixes_branch#Submitted_by_developer_.2F_committer.2C_tested.2C_waiting_to_be_merged
But the merge has not yet been done.

So if you updated fixes branch, then indeed you did not have the fix.

"i := pos('/Contents/MacOs', fname);"
Has also been changed in trunk.


ahnz

  • Jr. Member
  • **
  • Posts: 57
Re: Problems with Debugger on OSX
« Reply #68 on: April 30, 2019, 12:33:05 pm »

Are you on trunk or fixes branch?


To be honest I don't really know, I'm a complete newbie when it comes to using svn.

I installed a new 2.0.2 and then when you told me it should be fixed in 61066 I followed the instruction you gave a while back to update ...

Quote
svn co https://svn.freepascal.org/svn/lazarus/branches/fixes_2_0 /Developer/lazarus

followed by

Quote
make bigide LCL_PLATFORM=carbon CPU_TARGET=i386

Everything is working fine now so I'll trust in your better judgment that the fixes are as you say

Many, many thanks for all the help

Cheers

OS: OSX High Sierra 10.13.6
Lazarus: 2.1.0, r61162

Widgetset: Cocoa
Target: 64bit OSX

Compiler:
FPC 3.0.4 [2017/11/26] for x86_64

Debug:
LLDB  (with fpdebug)(Beta)
Path: /usr/bin/lldb
Version: lldb-1000.11.38.2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5515
    • wiki
Re: Problems with Debugger on OSX
« Reply #69 on: April 30, 2019, 01:41:25 pm »
Quote
svn co https://svn.freepascal.org/svn/lazarus/branches/fixes_2_0 /Developer/lazarus

That is the fixes branch.

In svn there are several lines (branches) of development.

- New code is added to "trunk"

- When a major release is planned, a "branch" is created. It starts as a copy (though internally its a reference to the snapshot).
- Only selected changes are transfered/merged to that copy. That way new features (with new bugs) do not get into the release (and minor releases).

Those copies are called "fixes branch" because we usually only merge bug fixes.

When I fixed the issue I committed it to trunk (as is usual). The merging to the fixes branch can be sometimes delayed.
I have now done the merge, so that change is in the fixes branch.
 
You can do ("." is the directory, that is if you are inside the lazarus svn dir)
To undo ANY changes you made
svn -R revert .
To update
svn up .