Delphi - 如何重新启用调试器异常通知?

时间:2022-12-03 13:12:49

I opened a project (created in D2007/08) in D2009 and it would compile but throw tons of exceptions when executed. Strange thing, but I know the project's a mess, so I want to go ahead and fix it. Well, not really fix all of it, just make it work would be enough.

我在D2009中打开了一个项目(在D2007 / 08中创建),它将编译但在执行时会抛出大量异常。奇怪的是,但我知道这个项目很乱,所以我想继续修复它。好吧,并没有真正解决所有问题,只要让它工作就足够了。

When I ran it, I got some Debugger Exception Notification (the little message dialogue with Break, Continue, Help buttons) and I wanted to proceed and see if would perhaps work when skip over the exception. I checked the little "Ignore this exception type" check box in the bottom left corner and clicked Continue. Now I no longer get the Exception Notification, but the application still doesn't run. I just get a couple of vague error boxes and have very little idea what's going on.

当我运行它时,我得到了一些调试器异常通知(带有Break,Continue,Help按钮的小消息对话),我想继续看看是否可以在跳过异常时工作。我检查了左下角的“忽略此异常类型”复选框,然后单击继续。现在我不再获得异常通知,但应用程序仍然无法运行。我只是得到了几个模糊的错误框,并且很少知道发生了什么。

I would like to re-enable the exception type I previously selected to be ignored. But I can't find the option anywhere. Where should I look for this? Can anyone help?

我想重新启用我之前选择的异常类型被忽略。但我无法在任何地方找到这个选项。我应该在哪里寻找这个?有人可以帮忙吗?

2 个解决方案

#1


The following is extracted from this page on the Delphi Q&A by Rob Kennedy: (CC licensed) although it relates to Delphi 2005 it may help.

以下内容摘自Rob Kennedy在Delphi Q&A上的这一页:( CC许可)虽然它与Delphi 2005有关,但它可能有所帮助。

Why do I continue getting error messages even after I have written an exception handler?

In its default settings, the Delphi IDE notifies you whenever an exception occurs in your program, as in Figure 1. What’s important to realize is that at that point, none of your program’s exception-handling code has run yet. It’s all Delphi itself; its special status as a debugger allows it to get first notification of any exception in your program, even before your program knows about it.

在默认设置中,Delphi IDE会在程序中发生异常时通知您,如图1所示。重要的是要意识到,此时程序的异常处理代码尚未运行。这都是德尔福本身;它作为调试器的特殊状态允许它获得程序中任何异常的第一个通知,甚至在程序知道它之前。

Delphi  - 如何重新启用调试器异常通知?

Avoiding notification

If you do not want to be notified when an exception occurs, you have a few options.

如果您不希望在发生异常时收到通知,则可以选择几个选项。

  • You can use Delphi’s “advanced breakpoints” to disable exception handling around a region of code. To begin, set a breakpoint on the line of code where you want the IDE to ignore exceptions. Right-click on the breakpoint dot in the gutter and open the breakpoint-property dialog. In the advanced section are some check boxes. (See Figure 2.) Clear the “Break” box to prevent the debugger from interrupting your program at that line, and set the “Ignore subsequent exceptions” box.

    您可以使用Delphi的“高级断点”来禁用代码区域周围的异常处理。首先,在希望IDE忽略异常的代码行上设置断点。右键单击装订线中的断点点,然后打开断点属性对话框。在高级部分是一些复选框。 (参见图2.)清除“Break”框以防止调试器在该行中断您的程序,并设置“忽略后续例外”框。

    Afterward, set another breakpoint where you want the debugger to resume handling exceptions. Change its properties to handle subsequent exceptions.

    然后,设置另一个断点,希望调试器继续处理异常。更改其属性以处理后续异常。

Delphi  - 如何重新启用调试器异常通知?

  • You can tell the debugger to ignore certain kinds of exceptions. Figure 3 shows Delphi’s language-exception options. Add an exception class to the list, and all exceptions of that type and of any descendant types will pass through to your program without Delphi interfering.
  • 您可以告诉调试器忽略某些类型的异常。图3显示了Delphi的语言异常选项。将一个异常类添加到列表中,该类型和任何后代类型的所有异常都将传递给您的程序,而不会影响Delphi。

Delphi  - 如何重新启用调试器异常通知?

  • In an option related to the previous one, you can tell the debugger not to interrupt on any exceptions. To do that, clear the “Notify on language exceptions” check box.

    在与前一个相关的选项中,您可以告诉调试器不要中断任何异常。为此,请清除“语言例外通知”复选框。

  • Finally, you can turn off integrated debugging altogether. Delphi will not notify you of exceptions, and it will also not stop at breakpoints or allow use of the “Pause” button. Turn off integrated debugging in the debugger options, as shown in Figure 5 for Delphi 2005.

    最后,您可以完全关闭集成调试。德尔福不会通知您异常情况,也不会在断点处停止或允许使用“暂停”按钮。关闭调试器选项中的集成调试,如图5中的Delphi 2005所示。

Delphi  - 如何重新启用调试器异常通知?

#2


I have found the ignored exception types in

我找到了被忽略的异常类型

(Main menu) Tools >> Options >> Debugger Options >> CodeGear Debuggers >> Language Exceptions >> and there is the list of exception types ignored.

(主菜单)工具>>选项>>调试器选项>> CodeGear调试器>>语言异常>>并且忽略了异常类型列表。

It's somewhat more hidden than in D2005 but very close to what was said in the article referenced by Stuart Dunkeld.

它比D2005更隐蔽,但非常接近Stuart Dunkeld引用的文章中所说的内容。

#1


The following is extracted from this page on the Delphi Q&A by Rob Kennedy: (CC licensed) although it relates to Delphi 2005 it may help.

以下内容摘自Rob Kennedy在Delphi Q&A上的这一页:( CC许可)虽然它与Delphi 2005有关,但它可能有所帮助。

Why do I continue getting error messages even after I have written an exception handler?

In its default settings, the Delphi IDE notifies you whenever an exception occurs in your program, as in Figure 1. What’s important to realize is that at that point, none of your program’s exception-handling code has run yet. It’s all Delphi itself; its special status as a debugger allows it to get first notification of any exception in your program, even before your program knows about it.

在默认设置中,Delphi IDE会在程序中发生异常时通知您,如图1所示。重要的是要意识到,此时程序的异常处理代码尚未运行。这都是德尔福本身;它作为调试器的特殊状态允许它获得程序中任何异常的第一个通知,甚至在程序知道它之前。

Delphi  - 如何重新启用调试器异常通知?

Avoiding notification

If you do not want to be notified when an exception occurs, you have a few options.

如果您不希望在发生异常时收到通知,则可以选择几个选项。

  • You can use Delphi’s “advanced breakpoints” to disable exception handling around a region of code. To begin, set a breakpoint on the line of code where you want the IDE to ignore exceptions. Right-click on the breakpoint dot in the gutter and open the breakpoint-property dialog. In the advanced section are some check boxes. (See Figure 2.) Clear the “Break” box to prevent the debugger from interrupting your program at that line, and set the “Ignore subsequent exceptions” box.

    您可以使用Delphi的“高级断点”来禁用代码区域周围的异常处理。首先,在希望IDE忽略异常的代码行上设置断点。右键单击装订线中的断点点,然后打开断点属性对话框。在高级部分是一些复选框。 (参见图2.)清除“Break”框以防止调试器在该行中断您的程序,并设置“忽略后续例外”框。

    Afterward, set another breakpoint where you want the debugger to resume handling exceptions. Change its properties to handle subsequent exceptions.

    然后,设置另一个断点,希望调试器继续处理异常。更改其属性以处理后续异常。

Delphi  - 如何重新启用调试器异常通知?

  • You can tell the debugger to ignore certain kinds of exceptions. Figure 3 shows Delphi’s language-exception options. Add an exception class to the list, and all exceptions of that type and of any descendant types will pass through to your program without Delphi interfering.
  • 您可以告诉调试器忽略某些类型的异常。图3显示了Delphi的语言异常选项。将一个异常类添加到列表中,该类型和任何后代类型的所有异常都将传递给您的程序,而不会影响Delphi。

Delphi  - 如何重新启用调试器异常通知?

  • In an option related to the previous one, you can tell the debugger not to interrupt on any exceptions. To do that, clear the “Notify on language exceptions” check box.

    在与前一个相关的选项中,您可以告诉调试器不要中断任何异常。为此,请清除“语言例外通知”复选框。

  • Finally, you can turn off integrated debugging altogether. Delphi will not notify you of exceptions, and it will also not stop at breakpoints or allow use of the “Pause” button. Turn off integrated debugging in the debugger options, as shown in Figure 5 for Delphi 2005.

    最后,您可以完全关闭集成调试。德尔福不会通知您异常情况,也不会在断点处停止或允许使用“暂停”按钮。关闭调试器选项中的集成调试,如图5中的Delphi 2005所示。

Delphi  - 如何重新启用调试器异常通知?

#2


I have found the ignored exception types in

我找到了被忽略的异常类型

(Main menu) Tools >> Options >> Debugger Options >> CodeGear Debuggers >> Language Exceptions >> and there is the list of exception types ignored.

(主菜单)工具>>选项>>调试器选项>> CodeGear调试器>>语言异常>>并且忽略了异常类型列表。

It's somewhat more hidden than in D2005 but very close to what was said in the article referenced by Stuart Dunkeld.

它比D2005更隐蔽,但非常接近Stuart Dunkeld引用的文章中所说的内容。