DELPHI写的DLL,调试问题
有源码,可以在DELPHI中进行源码级调试吗?
[解决办法]
可以
1.在Run-Parameters-Host Appliction,选择宿主文件
2.Project-Option中选择Debuging中的Debug information即可
[解决办法]
delphi5,在XP的环境下会有这种事情发生。
[解决办法]
但断点无效。不能调试
注意 输出路径
用绝对路径 输出 断点一般有效
[解决办法]
d5 一样 用绝对路径 输出(option 的 output)
[解决办法]
断点无效,你的EXE是调用你调试的这个DLL吗?
[解决办法]
可以调试DLL,这个我做过,不过有点忘记了。
1.在Run-Parameters-Host Appliction,选择宿主文件
这个应该是:当前项目为DLL项目,运行的是DLL,DLL和EXE在项目组里面。
2.Project-Option中选择Debuging中的Debug information即可
这个应该是:EXE、DLL最好都选择编译DEBUG信息。
[解决办法]
我这几天也在调试DLL,如一楼所说,在断点处可以停下,就是得到的值全是Accessible value!
求解~
[解决办法]
关注
[解决办法]
SOLUTION A
Build your DLL to the same directory as the DPR file. If you just set the "Output Directory " entry to be empty on the
Directories/Conditionals tab of the project options, then this will automatically happen.
Either use this directory as your webserver 's scripts or isapi directory, or move the DPR/DOF/CFG/RES files to your webserver 's
scripts or isapi directory. If you do the later through the Delphi menu option File | Save Project As, the Delphi will fix up the
directories of your source files in the uses section of the DPR for you. It is not necessary to move the PAS files.
That should be it. Build and debug happily ever after. The only downside to this is that you have to either change your webserver setup or move your project file to your scripts or isapi directory which is a annoying if you are using a source control system and you are the only one with this setup.
SOLUTION B
Before compiling, change the linking options of your project to include Remote Debugging Symbols.
Before debugging, open a file (an empty text file will do) from the directory your DLL is in. That directory will become the current
directory for Delphi. When you start debugging, Delphi will correctly find your DLL and load its Symbol Table because it is in this
directory.
I don 't like this solution because you have to always make sure that the directory your DLL is in always the current directory for Delphi before debugging.
SOLUTION C
Before compiling, change the linking options of your project to include Remote Debugging Symbols.
After you have started to debug, open the View | Debug Windows | Modules dialog. Find the entry for your DLL. If this is an isapi
DLL, make sure you have made a request to the webserver so your DLL will already be loaded, otherwise you won 't find it in this list. Right click on your DLL and choose "Reload Symbol Table... " and enter in the full path and filename for your DLL and click OK. This will then properly load the Symbol Table.
A downside to this solution (other than you have to do it every time) is that you can 't debug any code the executes when your DLL is first loaded.
Solution D
I can 't get any of the solutions to work, the only thing that works is when I manually define the dll path in View\DebugWindows\Modules.
-> Just wanted to tell you I got it working. I checked Remote Debug info in the linker tab, and now it works!
一般有问题都是DLL和EXE在不同目录的情况下,在你指定不同输出目录时尤其常见。EXE,DLL和源码在同一目录肯定没有问题,有时需要你打开本目录一个源码文件,和因为delphi的当前目录也有关系。一般情况下,如果源码能调试了,再将host和输入文件指定到不同目录也是可以的。
总之,这是一个问题,但它是一个可以解决的问题。
[解决办法]
刚才试了一下,不错~
调试Dll需要注意几点
1.应用程序与dll源文件应放在一个目录下
2.project---> option中的输出目录应设置为dll源文件的输出路径
3.加宿主文件
4.Project-Option中选择Debuging中的Debug information