10
votes

Let's say I have an EXE named A, which loads a DLL named B, which in turn loads another DLL named C. All of these three are written in Delphi. I have the source for all three.

If I want to debug DLL B, I have no problem. I go to Run|Parameters and enter A.EXE as the host. When I click run, Delphi runs A, which loads B, and I can debug to my heart's content.

But debugging DLL C is another matter.
It looks like Delphi will only let me debug a DLL loaded directly from the EXE. But this is a DLL loaded from another DLL.

Is there some way to do this? Thanks.

This is Delphi 7.

1
I think modern Delphi debugger lets you debug all the way through no probs. - David Heffernan
Delphi-XE2 has an option to 'Debug spawned processes' under Options|Dubugger Options|Embarcadero Debuggers. Does Delphi-7 have this? Is it 'checked'? Have you tried setting Run|Params for DLL C to A.EXE? - James L.
Another thought, you might be able to load the symbol table after the DLL C is loaded. XE2 has a debug 'Modules' window where you can right-click a module and force it to reload the symbol table, as discussed here: stackoverflow.com/a/12707464/822072 -- perhaps Delph-7 has the same? - James L.
James L., "Debug spawned processes" did the trick. Thank you. I never knew that was there before. If you'll put that in an answer, I'll accept it. - David Dubois
Are you sure you can't open DLL "C" in the Delphi IDE and set it's "host" as A.Exe? I really doubt Delphi cares much about how the DLL's are loaded, direct or indirect. I'd look for the problem somewhere else, maybe your "B" DLL is loading a different "C" DLL from a different location, maybe you're not setting the brakepoints in routines that are being called. - Cosmin Prund

1 Answers

9
votes

Use the "Debug spawned processes" check box.

In Delphi 7, this is under Tools | Debugger Options | General.

In Delphi XE-2 and XE-5 it is found under Tools | Options | Debugger Options | Embarcadero Debuggers.