Pregunta

Is it possible to debug Dylibs from Delphi, or is this functionality not included?

As I understand it, I should be able to:

1) Create a Host Application which loads up the Dylib that is deployed by Delphi

2) Set the "Host Application" in "Run -> Parameters..." to match this new application.

3) When firing up the debugger in Delphi, it should start the Host Application. The Host Application loads up the Delphi-generated Dylib. I should be able to hook onto an entry point from my Windows machine, and trace through the code.

Just like it works on Windows, but on a remote machine.

Unfortunately, Delphi does not seem to catch the execution of the Dylib at all. It is being loaded (and I've even gone out of my way to look through my entire machine to see if there were any other identically named Dylibs getting loaded by mistake), but Delphi takes no notice of the Dylib getting executed by the Host Process, and just waits for the Host to end.

Any solutions?

¿Fue útil?

Solución

EDIT: I recently realized that XE4 can debug dylibs on Snow Leopard. So, load up an old version of OSX, if you've got one lying around.

Ok, here's the solution:

1) Switch over to Delphi XE5

1a) Wait for bitterness over upgrade price to subside. This may take a while. Consider waiting for XE6 to come out first.

2) XE5 Does track which libraries are loaded by an executable process, but it still fails to deploy the debugging symbols properly.

You will have to change a filename in your OSX output directory. This directory is located at "yourProjectFolder/OSX32/Debug". Build your project, and then rename "yourProject.rsm" to "yourProject.dylib.rsm". This is the name which Delphi is trying to deploy already, so you will not have to add the file to your Deployment Settings.

I'm hoping that there's a way to automate the renaming of this file (maybe the .dproj file can be hacked). If I can find one, I'll add it to this answer.

3) Goto 1a

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top