有没有办法限制 xdebug 生成的跟踪深度?

发布于 2024-12-07 06:17:35 字数 169 浏览 2 评论 0原文

这个问题确实说明了一切。

我试图找出为什么 php 应用程序行为不当,但是 xdebug 向我抛出的大量数据使我很难理解流程。

如果我可以设置跟踪的深度,以便跳过任何超过 x 层深度的调用,那么会更容易理解发生了什么。有什么想法可以让 xdebug 做到这一点,或者有我可以使用的替代工具吗?

The question says it all, really.

I am trying to figure out why a php app is misbehaving, but the sheer amount of data thrown at me by xdebug makes it hard to understand the flow.

If I could set the depth of the trace such that any call more than x levels deep was skipped, then it would be easier to understand what was happening. Any ideas how to make xdebug do this, or is there an alternative tool I can use?

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

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

发布评论

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

评论(3

双手揣兜 2024-12-14 06:17:35

Xdebug 对文件的函数/执行跟踪当前不支持此功能,并且 Xdebug 的堆栈跟踪也始终显示整个堆栈,我刚刚向问题跟踪器添加了一个功能请求:http://bugs.xdebug.org/view.php?id=722

德里克

Xdebug's function/execution tracing to file does currently not support this, and Xdebug's stacktraces always also show the whole stack I've just added a feature request to the issue tracker for it: http://bugs.xdebug.org/view.php?id=722

Derick

泛泛之交 2024-12-14 06:17:35

您可以通过调用 functions xdebug_start_trace()< 来告诉 Xdebug 在哪里启动和停止函数跟踪代码中的 /code> 和 xdebug_stop_trace()

使用 Xdebug 2.4 或更高版本,您还可以通过调用 function 限制 Xdebug 仅跟踪某些函数的执行xdebug_start_function_monitor(数组 $list_of_functions_to_monitor )。该数组包含您要跟踪的函数列表。

You can tell Xdebug where to start and stop the function tracing by calling functions xdebug_start_trace() and xdebug_stop_trace() in the code.

With Xdebug version 2.4 or higher, you can also limit Xdebug to only trace execution of some functions by calling function xdebug_start_function_monitor( array $list_of_functions_to_monitor ). The array contains the list of functions you want to trace.

栀梦 2024-12-14 06:17:35

一个简单的技巧:

给定一个跟踪文件,file_name,您可以使用:

grep -E '[[:digit:]][[:space:]]{,n}->' file_name

with n = 2L + 1 仅显示具有深度的函数调用L

例如,

grep -E '[[:digit:]][[:space:]]{,3}->' file_name

只会给您顶层调用。

输入图片此处描述

A cheap trick:

Given a trace file, file_name you can use:

grep -E '[[:digit:]][[:space:]]{,n}->' file_name

with n = 2L + 1 to only show function calls with a depth of L.

So for example

grep -E '[[:digit:]][[:space:]]{,3}->' file_name

Will give you just the top level call.

enter image description here

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