Jump to content
Sign in to follow this  
Gustav Schubert

OSX debugger search path problem - original FMX units before patched

Recommended Posts

In 10.3.2, (latest Rio), I cannot get the debugger to break into a patched FMX unit included in my project.

The IDE will always open the original file from ...\embarcadero\studio instead of the file in my project.


I already tried to mess with project options, delphi-compiler search path or debugger source path.

Do I miss a trick?

 

For a minimal test project you can use this : New empty FMX project with Button1 and Memo1 on Form1, using a local copy of FMX.Memo in subdir fmx.

procedure TForm1.Button1Click(Sender: TObject);
begin
  log.d(Memo1.Text);
end;

// in FMX.Memo.pas
function TCustomMemo.GetText: string;
begin
  Result := Lines.Text; // <-- break point here
end;

 

Share this post


Link to post

Works OK here. My steps:

 

1. Create a blank FMX app, change platform to OSX 64-bit

2. Add a button and memo

3. Add the code you described

4. Save the project

5. Open FMX.Memo.pas from the source, and save it in the same folder as the project

6. Put a breakpoint in TCustomMemo.GetText

7. Close the file in the editor

8. Run the app with debugging

9. Click the button.

IDE opens the local copy, as expected, and stops at the expected breakpoint

 

  • Thanks 1

Share this post


Link to post

Probably you have old and new units in the search path.
Maybe you check your search paths and cleanup a little.
I usually also clean all compiled project *.DCU, and re-build them all, which helps to avoid such strange linking error.

Share this post


Link to post

 

1 hour ago, Dave Nottage said:

Works OK here. My steps:

5. Open FMX.Memo.pas from the source, and save it in the same folder as the project

IDE opens the local copy, as expected, and stops at the expected breakpoint

Yes, I have just confirmed that it works if the unit is put into the same folder. But I have it in a subfolder, and then it does not work as expected. It will go to the unit in the project folder (if present) or it will go and find the original unit.

 

In my real project I have all my patched FMX units (many) located in subfolder ./fmx:

 

uses
  System.StartUpCopy,
  FMX.Forms,
  FrmMain in 'FrmMain.pas' {Form1},
  FMX.Memo in 'fmx\FMX.Memo.pas';

 

Share this post


Link to post
11 hours ago, Gustav Schubert said:

But I have it in a subfolder, and then it does not work as expected

If it's other than in the project folder, you need to set the Source path in the Debugger section of the Project Options:

 

image.thumb.png.f6880298d6055bf1009388de79415420.png

  • Like 1

Share this post


Link to post
8 hours ago, Dave Nottage said:

If it's other than in the project folder, you need to set the Source path in the Debugger section of the Project Options

Indeed, problem solved!

 

Just folder name of fmx will do in Project Options, Debugger, Source path.

Needed for both OSX32 and OSX64.

Not required for Windows.

( For Windows targets, it is enough to include the source file in the dpr. )
 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×