GetStackTrace in Delphi 7?

巧了我就是萌 提交于 2019-12-08 15:45:07

问题


Using Delphi 7, how can I get a string representing the stack-trace from an Exception?

try
  SomethingDodgy();
except
  on E:Exception do begin
    // print stack trace
    Log.Write(/* ??? */);
  end;
end;

I hear there's a GetStackTrace function in the latest delphi, but I can't find anything for delphi 7. No, upgrading is not an option :)


回答1:


You could try using madExcept, a wonderful Exception handling framework.

madshi has heaps of sample code in there; I'm sure I've used the stack-trace stuff in there before.

As Dmitriy noted, the JCL also has stack-trace code; an old sample is here.




回答2:


I throw EurekaLog in the game. It's a great tool and not expensive at all.




回答3:


MemChk is pretty easy to use (especially to search/find memory leaks) and knows how to render a stack trace from a code address.




回答4:


The stack-trace in Win32 is not as good as .NET's or Java's (and the latest versoin of Delphi uses .NET stack trace).
Anyway, I found one link that provides more information on it here (It is at ExeEx so to allow to view that solution click the first link on the search).

See the bottom of the page there.



来源:https://stackoverflow.com/questions/1740266/getstacktrace-in-delphi-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!