全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3592
推到 Plurk!
推到 Facebook!

windows xp無法debug AP端程式的問題

答題得分者是:SleepWalker
binbinalia
一般會員


發表:14
回覆:23
積分:7
註冊:2003-11-05

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-09-19 16:32:34 IP:59.125.xxx.xxx 訂閱

之前有看到別人提出這個問題,
但解決方法都很模糊.
就是,同一個程式在windows 2000 debug都會跳入中斷點,
但在windows xp home就不會.
我只裝delphi5,
直接new application隨便敲些程式碼debug是沒問題的,
但我要debug的程式是由一支主程式呼叫起來的.

系統的架構大概是, 主程式是一支exe檔,
它會call其他dll檔來做事.
我打開client端dll的source,
在run|parameter|local|host application設exe檔的路徑,
output direction指向dll檔存放路徑,
然後就run了.
exe檔有被執行起來,
但是中斷點都會變綠色叉叉,
執行dll檔也不會跳入中斷點.
我有勾選"include remote debug symbols"也沒有用.
有前輩遇過這種問題知道如何解的嗎?

SleepWalker
一般會員


發表:16
回覆:20
積分:12
註冊:2004-06-21

發送簡訊給我
#2 引用回覆 回覆 發表時間:2006-10-05 15:40:00 IP:220.229.xxx.xxx 未訂閱

http://www.nsonic.de/Delphi/txt_WIS00559.htm

PROBLEM

When debugging a DLL in Delphi 5 on Windows XP, you are unable to set breakpoints in the code. Delphi will stop execution when exceptions are thrown, but it is unable to find the line of source that matches up with the exception.

This is problem is not specific to an isapi DLL. It can happen with a regular DLL too. It is caused when the DLL is built to a directory different than the one the DPR file is in, which happens to be the case more often with an isapi DLL because you want to build to your webserver's scripts or isapi directory.

When Delphi attempts to load the symbol table for the DLL, it fails so it can't set any breakpoints. You can see this if you open the View | Debug Windows | Modules dialog. Find the entry for your DLL. It will not have a Path specified. If you right click on your DLL and choose "Reload Symbol Table..." you will be prompted to specify a path to the DLL. It will default in the name of you DLL and if you click OK without specifying the path you will get an error indicating that Delphi was unable to find your DLL. This is exactly the problem.

This problem is not specific to the webservers OmniHttpd or IIS.

It does not help to add the DLL's directory to the system path or to Delphi's search path, or to the project's search path. It also does not help to run Delphi or your DLL's host application under XP's compatibility modes for other version's of Windows.


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.

系統時間:2024-04-25 19:34:49
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!