I am a developer working on Delphi. In my project I have added a DLL file which is built in VC++. I need to debug the DLL file to fix some issues.
So what are the steps needed to follow in order to debug DLL file with Delphi code?
You cannot debug the DLL from inside of Delphi, unless you do not mind stepping through the DLL's raw x86 assembly instructions. Otherwise, you need to load the DLL's source code into VC++ and use VC++'s debugger, specifying your Delphi application as the executable to use for the debugging session.
Probably you can also use Windows debugging tools (WinDbg) if you don't want to use VC++, but Delphi can't debug VC++ code because it has no support for its symbol files format.
Related
I use Borland Delphi 2006 (folder name: C:\Program files\borland\BDS\4.0), and I want to enable debug DCUs. Where can I find this option? in tools->options->debugger options it doesn't exist.
Note: I have also Embarcadero developer studio, but I hate it. My project is written under BDS 4.0 too.
A screenshot:
You may be confused by the fact that debug .dcu's is not a debugger option, but a compiler option.
Is the compiler the one which generates and includes the symbols required to debug inside the Delphi RTL/VCL.
The debug DCUILs (.NET) or DCUs (Win32) contain debug information and are built with stack frames. When this option is checked, the compiler prepends the debug DCUIL/DCU path to the unit search path specified in Debug Source Path on the Directories/Conditionals page.
The option is under the compiler options in each project, in:
Project\Options\Compiler\Debugging\Use debug DCUs
Note I really don't have BDS2006 right now, the closest version I have is BDS2007, but AFAIK the option is named the same.
I have EXE and 2 DLL used by this EXE. All binary were compiled by Delphi XE2.
How to debug 2 DLL at one time while running EXE?
The second IDE can't attach to the process what is under debugging by the first IDE.
In fact you don't need to do anything special for this to work. You don't need to run multiple IDEs and you don't need to attach to processes. Start debugging your executable and simply step into the code in the DLLs. The debugger takes care of it all for you.
I have solved debugger issue by the following steps:
Open any source file of each of two DLLs.
Add any breakpoint to each of two DLLs (maybe optional step).
Run host application on one of two DLLs.
I have an application written in Delphi 7 which uses a c++ dll written in BCB 5.
I want to debug this dll from the Delphi IDE is this possible?
If it's possible which are the steps to debug?
As additional information I have the full source code of the dll.
It has been a while since I have dealt with C++ / Delphi together. But if I remember correctly, you can use the BCB IDE to run the Delphi application (compiled already) that uses your DLL. Basically, in your project settings in BCB, you can set a program to run when you click the "run" button, and I believe that you will be able to set breakpoints and stuff that will be caught when functions of your DLL are being called by that application. Still, this implies that you have BCB.
My recollection, and it's been a while since I last tried this, is that you need the C++ Builder IDE to do this.
It should be possible:
I have done it quite often to debug a BCB5 dll within the Delphi 6 IDE. My delphi 6 application uses the DLL and I can then step from the delphi code into the bcb code (and back). So I might work with Delphi 7 too.
Delphi isn't configured by default to do that. At that time I found an explanation on the web how to do it. Not sure, but it might have been the following page: http://www.delphifaq.com/faq/delphi/delphi_ide/f178.shtml
You will also need to compile the dll in debug mode and to indicate the path to the source code of the dll in the project options of your delphi application.
The CGRC.exe in Delphi 2010 support using dot as resource name. I wish to use it in Delphi 2007 IDE as well. Is that possible to do so?
In Delphi 2007 IDE, when we compile a project that has .RC file, the build message will show something like:
BRCC Command Line
-w32 -foC:\Users\coder\Project\account.core.res -iC:\Users\coder\Project\developer -dDEBUG C:\Users\coder\Project\account.core.rc
However, it doesn't really use BRCC32.EXE to compile the RC files as I rename the
C:\Program Files (x86)\CodeGear\RAD Studio\5.0\bin\brcc32.exe
to something else.
Delphi 2007 evidently doesn't give you an option of what to run. If it already gave you an option to directly run RC, then it would provide you no benefit to use CGRC instead. The documentation tells you that CGRC does nothing but translate the BRCC command-line syntax into the syntax that Microsoft's RC requires, and then it runs RC.
The utility is probably provided so that the IDE only needs one command-line-generating subroutine instead of two or more. With this utility, the IDE can generate a single set of command-line options, so it only has to vary the EXE file it invokes based on the project options.
It seems that you were hinting at the possibility of replacing the brcc32.exe file that Delphi 2007 provides with the cgrc.exe file Delphi 2010 provides. But Delphi doesn't actually run brcc32.exe, apparently. That suggests that the actual resource-compilation ability is in a DLL that's shared by both brcc32.exe and the IDE or the code compiler. You don't want to go down the path of replacing DLLs.
So I guess the answer to your question is no. You'll have to find some other way of achieving whatever it is you're try to do.
In Delphi 2007 the only way I found is to run RC.EXE or in a pre-build script or in a build tool script (I use CCNet).
I would like to look at real symbols for an external dll compiled with bcc (bcc32) inside Delphi debugging. The problem is that it seems that bcc only allows externals symbols (tds file) and delphi does not see this symbols. So is there a way to force bcc32/ilink32 to embed symbols inside the dll or Delphi to understand dll with tds symbols?
Thank you,
Max
Try your project using C++ Builder: that allows you to integrate your Delphi and C++ code in one project (or have multiple projects in one project group: a C++ DLL and a Delphi host).
Since they use the same debugging format, it is way easier to debug.