11

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.

David Dubois
  • 3,842
  • 3
  • 18
  • 36
  • I think modern Delphi debugger lets you debug all the way through no probs. – David Heffernan Oct 18 '12 at 22:46
  • 2
    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. Oct 18 '12 at 23:00
  • 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: http://stackoverflow.com/a/12707464/822072 -- perhaps Delph-7 has the same? – James L. Oct 18 '12 at 23:10
  • 1
    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 Oct 19 '12 at 10:34
  • 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 Oct 22 '12 at 08:50

1 Answers1

9

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.

David Dubois
  • 3,842
  • 3
  • 18
  • 36
  • 3
    This answer was given by James L. in a comment to the original post, but he declined to post it as an answer. I put the answer here to make it easier for future visitors to find it. – David Dubois Feb 13 '14 at 11:48
  • 1
    @ david - people like you make stackoverflow better! – Gabriel Jul 05 '18 at 07:19