Debugging Dylibs from Delphi XEx (XE4) - delphi

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?

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

Related

Delphi 5 BPLs Not Linking For One Program Only

I'm still using Delphi 5.
I have a program which is a rewrite of an earlier program and in fact uses the root unit from the earlier program. When I compile it, Delphi doesn't link the BPLs into the EXE for some reason. New programs and old programs compile fine, so the problem is obviously with this one program. I've compared the project options for Linking and Compiling with other programs which are linking just fine. The compiler options in the main unit are the standard ones.
While the program is on my development box, it runs as expected, obviously reading the BPLs in the development area. But of course it won't run on another machine unless I copy the BPLs over, which is obviously not very clever.
I've read everything I can find on the subject, but although I've found references to linking not working, I haven't found anything which helps to work out why the linking isn't working in just this one case.
Can anyone point me at some documentation about this or point out something I've obviously missed looking at? I know it's something I've done, but despite spending hours on it I can't work out why!
Since there are no errors generated, I can't show you where it went wrong. Any suggestions about where I might find the problem would be much appreciated.
If you go to the Packages tab of your Project Options, is the Build with runtime packages checked?
If it is, you need to deploy the other packages to other machines if they aren't already on those machines at locations where they can be found by the OS.
If it isn't, Delphi will compile and link your project as an .Exe file and the code from the DCUs in the packages will be statically linked into your .Exe so you won't need to deploy the .BPLs (and they would be ignored even if you did).
AFAIK, when Delphi compiles a project to an .Exe (that is, if Build with runtime packages isn't checked), the compiler gets the other units' code to link from the .DCU files, rather than from the .BPL files. If it can't find the .DCU files, or you have told the compiler to do a "Build" it will attempt to generate the .DCUs them from the corresponding .PAS files if it can find them either in the project directory or via the Seach Path under Directories/Conditionals.

delphi xe5 64-bit not working

This is peculiar. My Delphi XE5 was working properly and based on build switch would generate the EXE and put it in the appropriate folder (Win64\Debug or Win64\Release). Something unknown broke this functionality. If I create a new app, add 64-bit target, then compile, it creates a Win32 folder but no Win64 folder. It puts the EXE in the Win32\Debug folder (and there is no Win64 folder.
So I manually created the Win64 and Win64\Debug folders. I now try to run and get this error message (and there is no exe that gets deployed in Win64\Debug):
I'm at wits end on this one and things I have done:
verified run Delphi as administrator
killed Acronis (seems like someone ran into something similar)
Project options output folder is set to .\$(Platform)\$(Config)
The most likely explanation is that your anti virus software is interfering. Try disabling it to prove the point. If that is the problem, exclude your output directories from checking.
Double-check that the output folders in your Project Options are what they should be. Sounds like maybe the paths got altered.
OK - pilot error on my part, though have no idea how this happened. There was an environment variable set with a "user-override" that was set to Win32. I sure don't ever recall setting that nor know why I would. Deleting that override cured the problem.

Delphi XE - F1027 Unit not found: 'System.pas' or binary equivalents (.dcu) upon Activation of trial version

I just purchased the full version of Delphi XE Architect after using the trial version for 30 days. I can't build anything, every time I go to build a project I get the error.
[DCC Fatal Error] MegaMainPrj.dpr(1): F1027 Unit not found: 'System.pas' or binary equivalents (.dcu)
A quick google said that the library paths were a problem and I compared what was given (in a previous stackoverflow question) with what I had in the registry, and it was identical.
What could be causing this?
EDIT: Immediatly after I get this error message the entire IDE crashes.
add this :
$(BDSLIB)\win32\release;
to your library path .
Make sure you have the environmental variables set properly (Tools->Options->Environmental Variables from the IDE's main menu):
BDS=D:\Embarcadero\RAD Studio\8.0
BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\8.0
PLATFORM=Win32
These should all be set in the System Variables section, and should have been added by the installer. (Obviously, they should point to the installation location of your XE installation - mine is installed in D:\Embarcadero\RAD Studio\8.0, as you can see.)
EDIT: I see in your comment you installed in C:\Program Files - bad idea if you're running Windows Vista or Win7 or higher. You should try installing in a different location. You can also try running the IDE as Administrator (right-click shortcut in Start->All Programs->Embarcadero->RAD Studio XE->Delphi XE, choose "Run as Administrator" from context menu). Does this change anything?
Also, you can open a free support case at Embarcadero for installation-related issues. I'd first try reinstalling in another location (running the install as Administrator, putting it in another folder, and installing for all users); if that doesn't work, open a support case. You can also post to the Embarcadero Delphi Installation forums - you'll need to have already created a user account there first to log in.
C:\Embarcadero\RAD Studio\9.0\lib\win32\release
and
C:\Embarcadero\RAD Studio\9.0\lib\win32\debug
Both of these path have been to add in Delphi XE2 from IDE <<Tools->Options->Library->Library path>>
It's OK?
Goto Tools->Options->Library->Library path
and add $(BDSLIB)\win32\release
This worked in Delphi 10.2
When compiling using the command line compiler, so not from within the IDE, you can also get this error when the name of the build configuration is not "debug" and not "release".
It seems that, when using the command line compiler, it tries to find its dcus in a path under BDSLIB that it constructs using the configuration name.
I had this happening when using a configuration named ReleaseHA. Note: it was not a sub configuration under "release", but an extra configuration besides "debug" and "release".
Sometimes this error message occurs when we have duplicate libraries included.
Make sure that:
Tools->Options->Environmental Options->Library
and
Project->Options->Directories/Conditionals
Don't include the same paths...
Running as Administrator worked for me.

AV in IDE when opening any project or creating new in Delphi 7

After many years of trouble-free use, Delphi 7 is now throwing an Access violation at address
40233A3E in module 'vclx70.bpl'. Read of address 0000021C.
When starting the IDE, the default empty project and unit/form appear and compile and run fine.
I'm developing Windows apps, running on Windows 7 (x64).
I haven't installed any new packages or tools in many, many months.
I stopped, dead in the water, unable to work.
Any suggestions other than a complete rip and re-install (which takes many hours...)
EDIT: I un-installed and re-installed Delphi 7. Now I'm getting Access violation in vcl70.bpl. I would have thought that uninstalling D7 would completely remove all of its libraries, etc... Are there folders that I should manually delete after uninstalling D7?
Problem fixed (and major machine rebuild averted)!
Gerrit Beuze of ModelMaker Tools suggested elsewhere:
Remove all .dsk (project desktop) files for the project you try to load, Temp remove all *.dst (desktop files) from C:\Program Files\Borland\Delphi7\Bin
After performing these steps, the problem appears to have been fixed.
A read at that low a memory address is typically a problem in a third-party component. However, you say you haven't installed anything new in months.
The other thing that's strange is that you're getting the error in vclx70, which is one of the CLX libraries. Are you doing anything using the CLX (leftover cross platform - Kylix) forms or dialogs?
If not, you might do a search in your source for QDialogs, QForms, or any of the other units in %PROGRAMFILES%\Borland\Delphi7\Source\Clx, and see if something mistakenly was added that you didn't intend that's pulling CLX into your project. If so, change it to the VCL version instead (by just removing the 'Q' from the front of the unit name in your source).
EDIT: You might try going into the registry (D7 would be HKCU\Software\Borland\Delphi\7.0) and temporarily changing the name of the delphiCLXide entry in Known IDE Packages to something else (put an underscore in front of the name or something). Then start the IDE. You should get an error message about Delphi being unable to load the package, and asking if you want to try and load it again in the future. Answer 'Yes', and let the IDE continue to load. Then try again with your project and see what happens.
The step above removes CLX temporarily from loading in the IDE designer. (Don't worry, you can just rename the key again to put it back if it's not the problem. If it doesn't come back, make sure the IDE didn't add an entry in the Disabled Packages entry; if it did, just remove it.)
If this works, you can open the project options (.DOF) file for your project, and remove the CLX libraries from the Packages list. This prevents it from being included when your project is loaded.
Once you've established whether the problem actually
My first suggestion would be to use XP Mode or another VM infrastructure to run such an old Delphi version on Windows 7 (I do it that way).
Another potential method is to use the compatibility settings in Windows 7 to set it to XP and to exempt the Delphi 7 process from DEP (data execution prevention) policies the system may otherwise impose. I've had some trouble with enabled DEP with older Borland IDEs and also VS 2003.

How to have, Delphi source code visible during remote debugging with Delphi 2010

I'm starting with the Delphi 2010 remote debugger. There is some good information here and I can start and execute my program on the remote machine. I can't get Delphi to step through my source code though, despite the fact that when run locally, all works fine. All I get is the CPU view and any breakpoints I set get shown disabled when I start the program. My target machine has my exe file together with rsm and map files just built.
My source paths are declared relative to the project i.e
....\Source\MyFiles
but this should stand whilst debugging should it not?
I had a similar issue and found this web site very useful. http://delphi.wikia.com/wiki/Remote_Debugger
The first section "Using the Remote Debugger with Delphi 2010" contains a link to an updated version of the remotedbg140 application that fixed the problem for me.
Did you copy the .rsm file to the target too ?
The relative paths should be ok if it compiles (then the working dir is ok), at least it is working for me with D2009.
(about working dir: see Delphi debug a wrong unit )

Resources