madExcept,获取当前堆栈的顶部

发布于 2024-10-11 00:55:20 字数 449 浏览 0 评论 0原文

在 delphi 2007 应用程序中,我们使用 madExcept 来处理异常。我们使用标准对话框,让用户根据需要通过邮件向我们发送报告。

我们想为此功能添加一些内容。如果用户选择不发送完整报告,我们仍然希望将异常记录到文件中,但不是完整报告。我们需要异常类和消息,以及源文件和行号。

前两个很容易,但我找不到找到后者的直接方法。

我有 IMEException 接口形式的完整异常报告。据我所知,调用堆栈只能通过 BugReportSections 属性获得,该属性以纯文本形式提供堆栈。

在 madStackTrace.pas 中,有一个 StackTrace( ) 函数应该可以满足我的需求。它需要很多参数,并且文档的信息有点缺乏。

问题: 有谁知道输入StackTrace()的正确参数,以便它只从引发异常的线程返回堆栈的顶部项目?

In an delphi 2007 application, we have used madExcept to handle exeptions for us. We use the standard dialog, letting the user send us a report with mail if he want to.

We want to add a little to this functionality. If the user choose not to send a full report, we still want to log the exception to a file, but not a full report. We want the exception class and message, and the source file and line number.

The first two is easy, but I can't find a straight forward way of finding the latter.

I have the full exception report in the form of an IMEException interface. As far as I can see, the call stack is available only through the BugReportSections property, which gives me the stack in plain text.

In madStackTrace.pas, there is a StackTrace( )-function that should give me what I want. It takes a lot of parameters, and the documentation is a little short on information..

Question:
Does anybody know the right parameters to feed into StackTrace( ), so that it only return the top item of the stack from the thread where the exception was thrown?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

姜生凉生 2024-10-18 00:55:20

madStackTrace.pas 还有另一个函数,StackAddrToStr,它只接受一个地址并返回它的格式化文本。如果您位于崩溃线程的 except 块中,则可以将全局 ExceptAddr 变量传递给它。如果您处于 madExcept 回调之一,请改用“IMEException.ExceptAddr”。

madStackTrace.pas has another function, StackAddrToStr that just takes a single address and returns the formatted text for it. If you're in the except block for the crashing thread you can pass the global ExceptAddr variable to it. If you're in one of the madExcept callbacks use `IMEException.ExceptAddr' instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文