madExcept,获取当前堆栈的顶部 [英] madExcept, getting top of current stack

查看:284
本文介绍了madExcept,获取当前堆栈的顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在delphi 2007应用程序中,我们使用了madExcept来处理我们的exeptions。我们使用标准对话框,让用户向我们发送邮件报告。

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.

我以 IMEException 接口的形式提供了完整的异常报告。据我所见,只有通过 BugReportSections 属性可以使用调用堆栈,这样才能以纯文本形式提供堆栈。

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.

在madStackTrace.pas中,有一个 StackTrace()功能,应该给我我想要的。它需要很多参数,并且文档有一点点信息..

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..

问题:
有人知道正确的参数要进入 StackTrace(),以便它只从抛出异常的线程返回堆栈的顶部项目。

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?

推荐答案

madStackTrace.pas具有另一个功能, StackAddrToStr 只需要一个地址并返回格式化的文本它。如果您处于崩溃线程的块之外,您可以将全局 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.

这篇关于madExcept,获取当前堆栈的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆