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 u开发者_C百科nderstand 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?
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
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.
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.
精彩评论