简体   繁体   English

为什么有时需要重新启动Delphi 7才能使调试器正常工作

[英]Why do I need to restart Delphi 7 to get the debugger to work sometimes

At least 4 times a day I need to restart Delphi to get the debugger to stop at breakpoints again. 我每天至少需要重启4次,才能使调试器再次在断点处停止。 Sometimes I can trick it into working again by attaching to the process after a rebuild of the code. 有时,我可以通过在重建代码后附加到流程中来欺骗它重新工作。 But most of the time I can't and it is costing me a lot of time to go back and re-open all the files that I want. 但是大多数时候我做不到,这花费了我很多时间回去重新打开我想要的所有文件。

Nearly every time this happens I do get some sort of Fatal Error when trying to close Delphi. 几乎每次发生这种情况时,在尝试关闭Delphi时,我都会收到某种致命错误。 Is there any fix for this? 有没有解决办法? I've got the "latest" Delphi 7, running on WinXP with plenty of memory. 我已经在WinXP上运行了具有大量内存的“最新” Delphi 7。 Most of the other guys in my office get this problem too. 我办公室的其他大多数人也遇到了这个问题。

Our experience with Delphi 7 is similar to yours: Fairly constant crashes within the IDE, with abstract errors, invalid pointer references, and exceptions in the VCL library. 我们在Delphi 7中的经验与您相似:在IDE中发生相当恒定的崩溃,包括抽象错误,无效的指针引用以及VCL库中的异常。

It seems to depend on the complexity of the project you have loaded: Our main project is a 200,000+ line program with multiple MDI forms and third-party libraries. 这似乎取决于您所加载项目的复杂性:我们的主项目是一个200,000多个行程序,其中包含多个MDI表单和第三方库。 Virtually whenever we'd exit Delphi we'd have to deal with catastrophic fatal errors. 实际上,每当我们退出Delphi时,我们都必须处理灾难性的致命错误。 We got very adept at using the task manager to hunt down the Delphi32 process and kill it -- virtually the only way to get out sometimes. 我们非常擅长使用任务管理器来追踪Delphi32进程并终止它-这实际上是有时退出的唯一方法。

We've since upgraded to Delphi 2009 and it has significantly better stability. 从那以后,我们已升级到Delphi 2009,它的稳定性大大提高。 My feeling is that Delphi 7 has numerous bugs, and you will either have to live with them, or upgrade. 我的感觉是Delphi 7有很多错误,您要么必须忍受它们,要么升级。

While you are debugging, do you exit the program normally, or do you use the IDE to force debugging to stop / kill the application? 在调试时,您是否正常退出程序,还是使用IDE强制调试来停止/终止应用程序? I have found that using the IDE to force the application down causes problems after a while (resolved by restarting the IDE), while exiting the program from within the application causes no such trouble. 我发现使用IDE强制关闭应用程序会在一段时间后导致问题(通过重新启动IDE可以解决),而从应用程序内部退出程序则不会导致此类问题。

Caveat: my experience is with Delphi 6. 注意:我的经验是使用Delphi 6。

I've had this in D7 too - but really only with one particular project (admittedly very large, many many forms and home-brewed custom components). 我在D7中也有这个功能-但实际上只有一个特定项目(非常大,很多形式和自制的自定义组件)。 Other projects (some equally large) were fine. 其他项目(同样大)也可以。

My feeling was that it was somehow related to using frames and/or forms that were subclassed from other frames/forms, where you would have the descendant form open in the IDE/debugger but not the ancestor form. 我的感觉是,它与使用从其他框架/窗体子类化的框架和/或窗体有关,在IDE /调试器中您将打开后代窗体,而不是祖先窗体。

Because, just like you, I felt it was a monstrous pain to shut down and restart the IDE half a dozen times a day, I took the trouble to create a .DSK file for the project, that had all the parent form stuff in it, so that when Delphi started-up that project it opened all those other forms 'automatically'. 因为就像您一样,我感觉每天关闭和重新启动IDE都非常痛苦,所以我很麻烦地为该项目创建一个.DSK文件,其中包含所有父表单内容,因此当Delphi启动该项目时,它会“自动”打开所有其他表格。 Once I was sure I'd got the contents of the DSK right, I made the .DSK file read only...! 一旦确定可以正确读取DSK的内容,就将.DSK文件设置为只读...!

It meant that the editor would 'forget' which files I had open at the time, but at least it would always automatically open up all the stuff that seemed to make the IDE 'behave'. 这意味着编辑器将“忘记”我当时打开的文件,但至少它将始终自动打开似乎使IDE表现良好的所有内容。 If I was going to be working on a particular handful of files for a few days, I'd just manually add them to the .DSK file. 如果几天内我将要处理少量文件,则只需将它们手动添加到.DSK文件中。

I seem to recall that Delphi would make some passing complaint about the file being read-only, but this method took away about 80% of our daily pain. 我似乎记得,Delphi会抱怨文件是只读的,但是这种方法减轻了我们每天80%的痛苦。

And then the other thing I did was to have the Task Manager load up, minimized, as part of my system startup. 然后,我要做的另一件事是在系统启动过程中加载并最小化任务管理器。 At least then it was a simple case of ALT-TAB to get to something that could kill the IDE. 至少到那时,这是ALT-TAB的一个简单案例,它可以使某些东西杀死IDE。 :-) :-)

Okay, following on from my pervious response in this question, here's a sample DSK file. 好的,在我对这个问题的先前答复之后,这是一个示例DSK文件。 I can't post this as a comment to my response otherwise I would. 我不能将其作为对我的回复的评论,否则我会发表。 :-) :-)

There's really nothing much to them, they're quite straightforward and a glance through this ought to help you see this. 对于他们来说,实际上并没有什么太大的意义,他们非常简单明了,对此一目了然,应该可以帮助您了解这一点。 I'd actually advise that you just load up Delphi, switch on the 'autosave desktop' option (it's in Environment or Editor, I forget which), arrange the IDE as you want it (with the various source files open, etc), then save/close the project. 我实际上建议您只是加载Delphi,打开“自动保存桌面”选项(在环境或编辑器中,我忘记了),按需要排列IDE(打开各种源文件,等等),然后保存/关闭项目。 You will find a MyProject.dsk (etc) file in the project directory - just make that read-only (or follow the advice in the article you linked to in the comments, and make a backup copy of it somewhere that you can always bring back whenever you need to). 您将在项目目录中找到MyProject.dsk(etc)文件-使其只读(或遵循注释中链接的文章中的建议,并在随时可以带到的地方制作备份副本)随时返回)。

Anyway, here's a sample DSK to give you an idea of what you're playing with. 无论如何,这是一个示例DSK,可让您大致了解自己在玩什么。 They are just INI-type text files, you can hack them in Notepad if you so wish. 它们只是INI类型的文本文件,您可以根据需要在记事本中对其进行修改。 :-) :-)

[Modules]
Module0=C:\Projects\GUIPlay\src\du_FrameUtils.pas
Module1=C:\Projects\GUIPlay\src\du_BaseDialogs.pas
Module2=C:\Projects\GUIPlay\src\dm_DataMain.pas
Module3=C:\Projects\GUIPlay\src\du_Main.pas
Count=4
EditWindowCount=1

[C:\Projects\GUIPlay\src\du_FrameUtils.pas]
ModuleType=SourceModule
FormState=1
FormOnTop=0

[C:\Projects\GUIPlay\src\du_BaseDialogs.pas]
ModuleType=SourceModule
FormState=1
FormOnTop=0

[C:\Projects\GUIPlay\src\dm_DataMain.pas]
ModuleType=SourceModule
FormState=1
FormOnTop=1

[C:\Projects\GUIPlay\src\du_Main.pas]
ModuleType=SourceModule
FormState=1
FormOnTop=1

[C:\Program Files\Borland\Delphi7\Projects\ProjectGroup1.bpg]
FormState=0
FormOnTop=0

[C:\Projects\GUIPlay\src\GUIPlay.dpr]
FormState=0
FormOnTop=0

[C:\Projects\GUIPlay\src\GUIPlay.todo]
FormState=0
FormOnTop=0

[EditWindow0]
ViewCount=4
CurrentView=2
View0=0
View1=1
View2=2
View3=3
CodeExplorer=CodeExplorer@EditWindow0
MessageView=MessageView@EditWindow0
Create=1
Visible=1
State=0
Left=212
Top=157
Width=1127
Height=757
MaxLeft=-1
MaxTop=-1
ClientWidth=1119
ClientHeight=723
LeftPanelSize=140
LeftPanelClients=CodeExplorer@EditWindow0
LeftPanelData=000004000000000000000000000000000000000000000000000100000000000000000C000000436F64654578706C6F726572FFFFFFFF
RightPanelSize=0
BottomPanelSize=0
BottomPanelClients=MessageView@EditWindow0
BottomPanelData=00000400010000000B0000004D6573736167655669657700000000000000000000000000000000000100000000000000000B0000004D65737361676556696577FFFFFFFF

[View0]
Module=C:\Projects\GUIPlay\src\du_FrameUtils.pas
CursorX=1
CursorY=1
TopLine=1
LeftCol=1

[View1]
Module=C:\Projects\GUIPlay\src\du_BaseDialogs.pas
CursorX=1
CursorY=1
TopLine=1
LeftCol=1

[View2]
Module=C:\Projects\GUIPlay\src\dm_DataMain.pas
CursorX=1
CursorY=1
TopLine=1
LeftCol=1

[View3]
Module=C:\Projects\GUIPlay\src\du_Main.pas
CursorX=1
CursorY=1
TopLine=1
LeftCol=1

[Watches]
Count=0

[Breakpoints]
Count=0

[AddressBreakpoints]
Count=0

[Main Window]
Create=1
Visible=1
State=2
Left=0
Top=0
Width=1571
Height=143
MaxLeft=-1
MaxTop=-1
MaxWidth=1579
MaxHeight=143
ClientWidth=1571
ClientHeight=109

[ProjectManager]
Create=1
Visible=1
State=0
Left=1188
Top=135
Width=345
Height=762
MaxLeft=-1
MaxTop=-1
ClientWidth=337
ClientHeight=736
TBDockHeight=305
LRDockWidth=438
Dockable=1

[AlignmentPalette]
Create=1
Visible=0
State=0
Left=200
Top=144
Width=156
Height=84
MaxLeft=-1
MaxTop=-1
ClientWidth=150
ClientHeight=60

[PropertyInspector]
Create=1
Visible=1
State=0
Left=3
Top=147
Width=272
Height=783
MaxLeft=-1
MaxTop=-1
ClientWidth=264
ClientHeight=757
TBDockHeight=783
LRDockWidth=272
Dockable=1
SplitPos=85
ArrangeBy=Name
SelectedItem=Name
ExpandedItems=
HiddenCategories=

[ObjectTree]
Create=1
Visible=0
State=0
Left=0
Top=142
Width=190
Height=314
MaxLeft=-1
MaxTop=-1
ClientWidth=182
ClientHeight=288
TBDockHeight=314
LRDockWidth=190
Dockable=1

[CodeExplorer@EditWindow0]
Create=1
Visible=1
State=0
Left=0
Top=12
Width=140
Height=711
MaxLeft=-1
MaxTop=-1
ClientWidth=140
ClientHeight=711
TBDockHeight=305
LRDockWidth=140
Dockable=1

[MessageView@EditWindow0]
Create=1
Visible=0
State=0
Left=12
Top=0
Width=1107
Height=66
MaxLeft=-1
MaxTop=-1
ClientWidth=1107
ClientHeight=66
TBDockHeight=66
LRDockWidth=443
Dockable=1

[DockHosts]
DockHostCount=0

As you can see, really it's a list of files to re-open, along with some sense of the position/size of the windows and the order in which to open the files. 如您所见,它实际上是要重新打开的文件的列表,以及对窗口的位置/大小和打开文件的顺序的某种了解。

Best of luck! 祝你好运! :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Delphi:为什么有时使用此代码会收到 I/O 错误 103? - Delphi: Why do I sometimes get an I/O Error 103 with this code? 无法使Delphi 2007的远程调试器正常工作? - Cannot get the remote debugger for Delphi 2007 to work correctly? 如何纠正这个运行时错误,为什么我会在 Delphi 中得到它? - How to correct this runtime error and why do i get it in Delphi? 为什么Delphi 2009有时(通常不是这样)坚持要求我构建? - Why does Delphi 2009 sometimes (more often that not) insist I build? Delphi:我需要使用DBChart部署BDE吗? - Delphi: Do I need to deploy BDE with DBChart? 我是否需要在Delphi中释放IDispatch - Do I need to Free IDispatch in Delphi Delphi(DataSnap)我是否需要在身份验证上进行线程化? - Delphi (DataSnap) Do I need threading on authentication? 我需要在Delphi中完成记录数组吗? - Do I need to finalize array of records in Delphi? 为什么我需要在Delphi 2009中指定Canvas的字体来改变字体大小? - Why do I need to assign the Canvas's font to change font size in Delphi 2009? 为什么我需要在我的Delphi dll中使用Sharemem,它只使用WideString参数公开一个函数? - Why do I need Sharemem in my Delphi dll which only exposes a function with WideString parameters?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM