轉自:
http://www.cnblogs.com/sandman/archive/2010/12/05/1897063.html
自己的開發機器稱為主機,運行程序的機器稱為目標機;
一、在主機編譯執行程序
1、project->options->linker中的EXE and DLL options選項組中的include remote debug symbols打上勾
這樣就可以生成rsm為擴展名的文件,該文件名稱於你的項目同名。
2、project->options->Debugging中的勾可以全部選上,這是在你的程序支持debug(正式發布產品時要去掉這些選項,Delphi默認設置是選則大部分的)
3、Tools->Environment Options->Preferences的Compling and running選擇組中選上Show compiler progress(可選項,在編譯或者運行時顯示編譯過程,建議使用)
二、拷貝Project1.exe和Project1.rsm到目標機器的運行目錄(該目錄可以是你的安裝目錄,也可以任意)
注意:主機的代碼不需和目標機的exe和rsm文件一致,就是說在進行第一步后不能改動你的代碼
三、目標機安裝borland的遠程調試工具rdebug,delphi7光盤中就有,或者google一下。
四、啟動目標機的rdebug,啟動后目標機的托盤圖標中會出現一個小“蟲子”debug的圖標
注意:遠程調試工具不需正常運行才能進行遠程調試
五、主機的Delphi的遠程調試設置
1、Delphi中選擇Run->load process->Remote
2、Remote Path中輸入目標機器的運行目錄
3、Remote Host中輸入目標機IP
4、Working Directory 中輸入目標機器的運行目錄
5、選擇LOAd
六、主機按F9調試即可
補充:
bccide.dll,bordbk140.dll,bordbk140N.dll,comp32x.dll,DCC140.dll,rmtdbg140.exe
文件都在2010的bin目錄下。
另一個介紹:
Sometimes is good to debug directly on the client computer, because the development computer does not have the problem. Of course, in such cases is not appropriate (and often not even possible) to install Delphi on the client computer and for this cases Delphi offer the possibility of remote debugging. How to do?
I show remote debugging on Delphi 2010 (service pack 4 and 5 required - fixed some problems), but remote debugging is supported on old Delphi too - only difference is filenames (see below).
In first step install debugger support on target computer. You can download remote debugging support from Embarcadero or from Delphi directory copy this files (for Delphi 2010 - Delphi version 14, so for another version please use proper files - maybe can be stability problem with Delphi 2005 or 2006).
bccide.dll bordbk140.dll bordbk140N.dll comp32x.dll DCC140.dll rmtdbg140.exe
Now register files with:
regsvr32 bordbk140.dll regsvr32 bordbk140n.dll
Ok, so necessary tasks are done (this can be necessary only for first time) and start debugging.
On target computer start remote debugger (rmtdbg140.exe) - when started small icon is showed in tray (green bug).
Now on project enable Remote debug symbols and Debug information. With first option compiler will create RSM files during compilation.
Compiled binary file with rsm files copy on client computer. In menu Run select Load Process …
… and in Remote tab fill fields (see screenshot - directories are from target computer).
Now only click on Load and if everything is good, program will stop on first line of program (probably on first line in dpr file) and you can set breakpoints or everything like during normal debugging. And this is all.
When problems with communication try for example ping (and check firewall or stupid anti viruses and so on).
Update: simple demo - download
Update: maybe for some windows configuration remote debugging working only when everything is in same directory