工具来跟踪应用程序而无需更改代码? [英] tool to trace application without code changes?

查看:48
本文介绍了工具来跟踪应用程序而无需更改代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一个相当大的WPF应用程序,并且需要为其很大一部分生成应用程序跟踪.由于项目的复杂性,如果可能的话,我希望在不对代码库进行任何更改的情况下执行此操作.我最需要知道堆栈增量,即何时进行函数调用或返回.有没有一种工具或方法可以(最好)不更改代码就能获得我的踪迹?甚至无需编写将跟踪调用添加到代码中的工具就可以做到吗?

I've inherited a rather large WPF application, and I need to generate application traces for a significant portion of it. Because of the complexity of the project, I'd like to do this without making any changes to the code base, if possible. I mostly need to know the stack deltas, ie when a function call or return takes place. Is there a tool or methodology that will get me this trace with (preferably) no code changes? Is this even possible to do without writing a tool to add Trace calls to the code?

如果仅限于特定的函数调用,我想我可以接受.我有一个可以通过导入表重写将dll函数调用重定向到自定义存根的Win32 api调用的工具,该存根在那时记录了调用堆栈.如果没有这样的工具可以在.NET上开箱即用",那么有人知道FAQ或解释.NET DLL链接如何工作的内容(导出表,thunk等)吗?

If it were limited to specific function calls, i think i could live with that. I have a tool that can do that for win32 api calls, via import table rewriting to redirect the dll function call to a custom stub that logs the call stack at that point. If there is no such tool that works 'out of the box' on .NET, does anyone know of a FAQ or something that explains how .NET DLL linkage works (export table, thunks, etc)?

推荐答案

要给您一个有用的答案,重要的是要知道为什么为什么您需要应用程序跟踪.

To give you an answer that would be useful, it really is important to know why you need an application trace.

我可以想到,其中之一:

I can think, one of:

  1. 出于分析目的(在体系结构级别理解事物).在这种情况下,合适的是静态代码分析工具,例如 NDepend ;

出于记录目的(再一次,为什么特别需要知道方法的入口和出口?).在这种情况下,由于您不想更改源,因此在执行之前就注入方面的方面导向框架可能就是您想要的,例如,

For logging purposes (once again, why specifically would you need to know method entrance and exits?). In this case, since you don't want to have to change the source, an aspect orientation framework that injects aspects just before execution is probably what you're looking for, e.g., PostSharp.

用于性能分析.在这种情况下,请使用Visual Studio随附的工具或商业工具,例如 ANTS Profiler .

For performance analysis purposes. In this case, use the tool that comes with Visual Studio, or a commercial tool such as ANTS Profiler.

存在其他适用于拦截方法调用的AOP解决方案(例如, Spring.NET ),但是这些要求更改源(尽管相对较小),您已经说过您对此不感兴趣.

Other AOP solutions exist that would be suited to intercepting method calls (e.g., Spring.NET) but these require changes to the source (albeit relatively small ones) which you've already said that you're not interested in.

这篇关于工具来跟踪应用程序而无需更改代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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