madExcept,获取当前堆栈的顶部
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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 theexcept
block for the crashing thread you can pass the globalExceptAddr
variable to it. If you're in one of the madExcept callbacks use `IMEException.ExceptAddr' instead.