Table of Contents
Xdebug document (4) function tracking, xdebug document function tracking
Output format
The Script
The Results
VIM syntax file
Home Backend Development PHP Tutorial Xdebug document (4) function tracking, xdebug document function tracking_PHP tutorial

Xdebug document (4) function tracking, xdebug document function tracking_PHP tutorial

Jul 12, 2016 am 08:50 AM
xdebug

Xdebug document (4) function tracking, xdebug document function tracking

Xdebug allows you to record all function calls, including parameters and return values, into files in different formats.

These so-called "function tracing" features can help you face a new application, or you want to figure out what the program is doing when it is running. Function tracing can optionally display the values ​​of variables passed by a function or method, as well as the return value. Tracking of these two elements is not enabled by default.

Output format

There are three output formats. One has human-readable tracking information, another is more suitable for computer programs to parse, and the last uses HTML to format the tracking information. You can switch between these two ill-conceived formats using the xdebug_trace_format setting. There are also settings that control what information is written to the trace file. For example, set up variables (xdebug.collect_params) and return values ​​(xdebug.collect_return). The following examples show the effect of different settings of human-readable function trace information:

The Script

<?<span>php
</span><span>$str</span> = "Xdebug"<span>;
</span><span>function</span> ret_ord( <span>$c</span><span> )
{
    </span><span>return</span> <span>ord</span>( <span>$c</span><span> );
}

</span><span>foreach</span> ( <span>str_split</span>( <span>$str</span> ) <span>as</span> <span>$char</span><span> )
{
    </span><span>echo</span> <span>$char</span>, ": ", ret_ord( <span>$char</span> ), "\n"<span>;
}
</span>?>
Copy after login


The Results

The following are the results when xdebug.collect_params is set to different values. When not in a web environment, the 2 value does not include mouse prompts.

Default value:

TRACE START [2007-05-06 14:37:06]

0.0003 114112 -> {main}() ../trace.php:0

0.0004 114272 -> str_split() ../trace.php:8

0.0153 117424 -> ret_ord() ../trace.php:10

0.0165 117584 -> ord() ../trace.php:5

0.0166 117584 -> ret_ord() ../trace.php:10

0.0167 117584 -> ord() ../trace.php:5

0.0168 117584 -> ret_ord() ../trace.php:10

0.0168 117584 -> ord() ../trace.php:5

0.0170 117584 -> ret_ord() ../trace.php:10

0.0170 117584 -> ord() ../trace.php:5

0.0172 117584 -> ret_ord() ../trace.php:10

0.0172 117584 -> ord() ../trace.php:5

0.0173 117584 -> ret_ord() ../trace.php:10

0.0174 117584 -> ord() ../trace.php:5

0.0177 41152

TRACE END [2007-05-06 14:37:07]

Collect_params=1:

TRACE START [2007-05-06 14:37:11]
Copy after login
    0.0003     114112   -> {main}() ../trace.php:0
Copy after login
Copy after login
Copy after login
Copy after login
    0.0004     114272     -> str_split(string(6)) ../trace.php:8
Copy after login
    0.0007     117424     -> ret_ord(string(1)) ../trace.php:10
Copy after login
    0.0007     117584       -> ord(string(1)) ../trace.php:5
Copy after login
    0.0009     117584     -> ret_ord(string(1)) ../trace.php:10
Copy after login
    0.0009     117584       -> ord(string(1)) ../trace.php:5
Copy after login
    0.0010     117584     -> ret_ord(string(1)) ../trace.php:10
Copy after login
    0.0011     117584       -> ord(string(1)) ../trace.php:5
Copy after login
    0.0012     117584     -> ret_ord(string(1)) ../trace.php:10
Copy after login
    0.0013     117584       -> ord(string(1)) ../trace.php:5
Copy after login
    0.0014     117584     -> ret_ord(string(1)) ../trace.php:10
Copy after login
    0.0014     117584       -> ord(string(1)) ../trace.php:5
Copy after login
    0.0016     117584     -> ret_ord(string(1)) ../trace.php:10
Copy after login
    0.0016     117584       -> ord(string(1)) ../trace.php:5
Copy after login
    0.0019      41152
Copy after login
Copy after login
Copy after login
Copy after login
TRACE END   [2007-05-06 14:37:11]
Copy after login

Collect_params=3:

TRACE START [2007-05-06 14:37:13]
Copy after login
    0.0003     114112   -> {main}() ../trace.php:0
Copy after login
Copy after login
Copy after login
Copy after login
    0.0004     114272     -> str_split('Xdebug') ../trace.php:8
Copy after login
Copy after login
Copy after login
    0.0007     117424     -> ret_ord('X') ../trace.php:10
Copy after login
    0.0007     117584       -> ord('X') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0009     117584     -> ret_ord('d') ../trace.php:10
Copy after login
    0.0009     117584       -> ord('d') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0010     117584     -> ret_ord('e') ../trace.php:10
Copy after login
    0.0011     117584       -> ord('e') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0012     117584     -> ret_ord('b') ../trace.php:10
Copy after login
    0.0013     117584       -> ord('b') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0014     117584     -> ret_ord('u') ../trace.php:10
Copy after login
    0.0014     117584       -> ord('u') ../trace.php:5
Copy after login
Copy after login
    0.0016     117584     -> ret_ord('g') ../trace.php:10
Copy after login
    0.0016     117584       -> ord('g') ../trace.php:5
Copy after login
Copy after login
    0.0019      41152
Copy after login
Copy after login
Copy after login
Copy after login
TRACE END   [2007-05-06 14:37:13]
Copy after login

Collect_params=4:

TRACE START [2007-05-06 14:37:16]
Copy after login
    0.0003     114112   -> {main}() ../trace.php:0
Copy after login
Copy after login
Copy after login
Copy after login
    0.0004     114272     -> str_split('Xdebug') ../trace.php:8
Copy after login
Copy after login
Copy after login
    0.0007     117424     -> ret_ord($c = 'X') ../trace.php:10
Copy after login
Copy after login
    0.0007     117584       -> ord('X') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0009     117584     -> ret_ord($c = 'd') ../trace.php:10
Copy after login
Copy after login
    0.0009     117584       -> ord('d') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0010     117584     -> ret_ord($c = 'e') ../trace.php:10
Copy after login
    0.0011     117584       -> ord('e') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0012     117584     -> ret_ord($c = 'b') ../trace.php:10
Copy after login
    0.0013     117584       -> ord('b') ../trace.php:5
Copy after login
Copy after login
Copy after login
    0.0014     117584     -> ret_ord($c = 'u') ../trace.php:10
Copy after login
    0.0014     117584       -> ord('u') ../trace.php:5
Copy after login
Copy after login
    0.0016     117584     -> ret_ord($c = 'g') ../trace.php:10
Copy after login
    0.0016     117584       -> ord('g') ../trace.php:5
Copy after login
Copy after login
    0.0019      41152
Copy after login
Copy after login
Copy after login
Copy after login
TRACE END   [2007-05-06 14:37:16]
Copy after login

In addition to the xdebug.collet_params settings, there are other settings that affect the output of the trace file. "show_mem_delta=1" can display memory usage in two different columns.

TRACE START [2007-05-06 14:37:26]
Copy after login
    0.0003     114112  +114112   -> {main}() ../trace.php:0
Copy after login
    0.0004     114272     +160     -> str_split('Xdebug') ../trace.php:8
Copy after login
    0.0007     117424    +3152     -> ret_ord($c = 'X') ../trace.php:10
Copy after login
    0.0007     117584     +160       -> ord('X') ../trace.php:5
Copy after login
    0.0009     117584       +0     -> ret_ord($c = 'd') ../trace.php:10
Copy after login
    0.0009     117584       +0       -> ord('d') ../trace.php:5
Copy after login
    0.0011     117584       +0     -> ret_ord($c = 'e') ../trace.php:10
Copy after login
    0.0011     117584       +0       -> ord('e') ../trace.php:5
Copy after login
    0.0013     117584       +0     -> ret_ord($c = 'b') ../trace.php:10
Copy after login
    0.0013     117584       +0       -> ord('b') ../trace.php:5
Copy after login
    0.0014     117584       +0     -> ret_ord($c = 'u') ../trace.php:10
Copy after login
    0.0015     117584       +0       -> ord('u') ../trace.php:5
Copy after login
    0.0016     117584       +0     -> ret_ord($c = 'g') ../trace.php:10
Copy after login
    0.0017     117584       +0       -> ord('g') ../trace.php:5
Copy after login
    0.0019      41152
Copy after login
Copy after login
Copy after login
Copy after login
TRACE END   [2007-05-06 14:37:26]
Copy after login

"collect_return=1" displays the return value of the called function:

TRACE START [2007-05-06 14:37:35]
Copy after login
    0.0003     114112   -> {main}() ../trace.php:0
Copy after login
Copy after login
Copy after login
Copy after login
    0.0004     114272     -> str_split('Xdebug') ../trace.php:8
Copy after login
Copy after login
Copy after login
                          >=> array (0 => 'X', 1 => 'd', 2 => 'e', 3 => 'b', 4 => 'u', 5 => 'g')
Copy after login
    0.0007     117424     -> ret_ord($c = 'X') ../trace.php:10
Copy after login
Copy after login
    0.0007     117584       -> ord('X') ../trace.php:5
Copy after login
Copy after login
Copy after login
                            >=> 88
Copy after login
                          >=> 88
Copy after login
    0.0009     117584     -> ret_ord($c = 'd') ../trace.php:10
Copy after login
Copy after login
    0.0009     117584       -> ord('d') ../trace.php:5
Copy after login
Copy after login
Copy after login
                            >=> 100
Copy after login
                          >=> 100
Copy after login
    0.0011     117584     -> ret_ord($c = 'e') ../trace.php:10
Copy after login
    0.0011     117584       -> ord('e') ../trace.php:5
Copy after login
Copy after login
Copy after login
                            >=> 101
Copy after login
                          >=> 101
Copy after login
    0.0013     117584     -> ret_ord($c = 'b') ../trace.php:10
Copy after login
    0.0013     117584       -> ord('b') ../trace.php:5
Copy after login
Copy after login
Copy after login
                            >=> 98
Copy after login
                          >=> 98
Copy after login
    0.0015     117584     -> ret_ord($c = 'u') ../trace.php:10
Copy after login
    0.0016     117584       -> ord('u') ../trace.php:5
Copy after login
                            >=> 117
Copy after login
                          >=> 117
Copy after login
    0.0017     117584     -> ret_ord($c = 'g') ../trace.php:10
Copy after login
    0.0018     117584       -> ord('g') ../trace.php:5
Copy after login
                            >=> 103
Copy after login
                          >=> 103
Copy after login
                        >=> 1
Copy after login
    0.0021      41152
Copy after login
TRACE END   [2007-05-06 14:37:35]
Copy after login

"collect_assignments=1" displays variable assignment, see xdebug.collect_assignments setting for details.

The "xdebug.trace_format" setting changes the output format to make it easier to parse but harder to understand. This is most useful for parsing trace files with third-party tools.

Version: 2.0.0RC4-dev
Copy after login
TRACE START [2007-05-06 18:29:01]
Copy after login
1       0       0       0.010870       114112  {main}  1       ../trace.php   0
Copy after login
2       1       0       0.032009       114272  str_split      0       ../trace.php   8
Copy after login
2       1       1       0.032073       116632
Copy after login
2       2       0       0.033505       117424  ret_ord 1       ../trace.php   10
Copy after login
3       3       0       0.033531       117584  ord     0       ../trace.php   5
Copy after login
3       3       1       0.033551       117584
Copy after login
2       2       1       0.033567       117584
Copy after login
2       4       0       0.033718       117584  ret_ord 1       ../trace.php   10
Copy after login
3       5       0       0.033740       117584  ord     0       ../trace.php   5
Copy after login
3       5       1       0.033758       117584
Copy after login
2       4       1       0.033770       117584
Copy after login
2       6       0       0.033914       117584  ret_ord 1       ../trace.php   10
Copy after login
3       7       0       0.033936       117584  ord     0       ../trace.php   5
Copy after login
3       7       1       0.033953       117584
Copy after login
2       6       1       0.033965       117584
Copy after login
2       8       0       0.034108       117584  ret_ord 1       ../trace.php   10
Copy after login
3       9       0       0.034130       117584  ord     0       ../trace.php   5
Copy after login
3       9       1       0.034147       117584
Copy after login
2       8       1       0.034160       117584
Copy after login
2       10      0       0.034302       117584  ret_ord 1       ../trace.php   10
Copy after login
3       11      0       0.034325       117584  ord     0       ../trace.php   5
Copy after login
3       11      1       0.034342       117584
Copy after login
2       10      1       0.034354       117584
Copy after login
2       12      0       0.034497       117584  ret_ord 1       ../trace.php   10
Copy after login
3       13      0       0.034519       117584  ord     0       ../trace.php   5
Copy after login
3       13      1       0.034536       117584
Copy after login
2       12      1       0.034549       117584
Copy after login
1       0       1       0.034636       117584
Copy after login
TRACE END   [2007-05-06 18:29:01]
Copy after login

VIM syntax file

Xdebug carries a VIM syntax file to highlight the syntax of the tracking file. The syntax file name is: xt.vim. In order for VIM to recognize the new format, you need to do this:

augroup filetypedetect
Copy after login
au BufNewFile,BufRead *.xt  setf xt
Copy after login
augroup END
Copy after login

After doing this, the opened tracking file will look like this:

<strong>TRACE START</strong> <strong>[2007-05-15 20:06:02]</strong>
Copy after login
    0.0003     115208   <strong>-></strong> <strong>{main}()</strong> ../trace.php<strong>:0</strong>
Copy after login
    0.0004     115368     <strong>-></strong> <strong>str_split() </strong>../trace.php<strong>:8</strong>
Copy after login
    0.0006     118520     <strong>-></strong> <strong>ret_ord() </strong>../trace.php<strong>:10</strong>
Copy after login
    0.0007     118680       <strong>-></strong> <strong>ord() </strong>../trace.php<strong>:5</strong>
Copy after login
    0.0008     118680     <strong>-></strong> <strong>ret_ord() </strong>../trace.php<strong>:10</strong>
Copy after login
    0.0009     118680       <strong>-></strong> <strong>ord() </strong>../trace.php<strong>:5</strong>
Copy after login
    0.0010     118680     <strong>-></strong> <strong>ret_ord() </strong>../trace.php<strong>:10</strong>
Copy after login
    0.0010     118680       <strong>-></strong> <strong>ord() </strong>../trace.php<strong>:5</strong>
Copy after login
    0.0012     118680     <strong>-></strong> <strong>ret_ord() </strong>../trace.php<strong>:10</strong>
Copy after login
    0.0012     118680       <strong>-></strong> <strong>ord() </strong>../trace.php<strong>:5</strong>
Copy after login
    0.0014     118680     <strong>-></strong> <strong>ret_ord() </strong>../trace.php<strong>:10</strong>
Copy after login
    0.0014     118680       <strong>-></strong> <strong>ord() </strong>../trace.php<strong>:5</strong>
Copy after login
    0.0016     118680     <strong>-></strong> <strong>ret_ord() </strong>../trace.php<strong>:10</strong>
Copy after login
    0.0016     118680       <strong>-></strong> <strong>ord() </strong>../trace.php<strong>:5</strong>
Copy after login
    0.0019      54880
Copy after login
<strong>TRACE END</strong>   <strong>[2007-05-15 20:06:02]<br></strong>
Copy after login

相关设置:

xdebug.auto_trace

类型: boolean, 默认值: 0

打开此设置时,脚本在运行前函数调用追踪将开启。这将可能追踪auto_prepend_file设置的代码文件。

xdebug.collect_assignments

类型: boolean, 默认值: 0, 始于 Xdebug > 2.1

用于控制xdebug是否添加变量赋予到函数追踪当中。

xdebug.collect_includes

类型: boolean, 默认值: 1

用于控制xdebug是否将include(), include_once(), require() 或 require_once() 引用的文件名写入到跟踪文件中。

xdebug.collect_params

类型: integer, 默认值: 0

默认为0时,该设置控制xdebug不管是函数追踪还是堆栈跟踪都会收集调用函数的参数。

默认0值是考虑到大规模脚本会占用大量内存,所以不会为了大脚本来运行它。你可以安全地打开此设置,但你会预料到会一些脚本上的问题像大量函数调用兼庞大的数据结构作为参数传递。Xdebug2不会有增加内存使用的问题,因为它不会存储到内存,而是只存入磁盘中。这只需要你有足够的磁盘使用量即可。

该设置有4种设置值。每种都会呈现不同的信息。以下表格展示各种设置值信息:

Value

Argument   Information   Shown

0

无.

1

展示变量元素的值类型和值。

2

展示变量元素的值类型和值,并附带滑鼠提示显示完整信息。(CLI模式下不存在滑鼠提示)

3

完整变量内容(内容受限于以下设置: xdebug.var_display_max_children,xdebug.var_display_max_data and xdebug.var_display_max_depth.)

4

完整变量内容和名称。

5

PHP   序列化变量内容,不含名称。(2.3版本新特性)

xdebug.collect_return

Type: boolean, Default value: 0

Control whether the return value of the function call is written to the trace file.

To achieve computerized trace files (xdebug.trace_format=1), Xdebug 2.3 or above must be used.

xdebug.show_mem_delta

Type: integer, Default value: 0

When this setting is not 0, the trace file that can be read manually will show the difference in the amount of memory occupied by each function call. If xdebug is set up to generate computer-readable trace files, they will always display information like this.

xdebug.trace_enable_trigger

Type: boolean, Default value: 0, since Xdebug > 2.2

When set to 1, you can use the XDEBUG_TRACE GET/POST parameter or set a cookie value named XDEBUG_TRACE to trigger the generation of a trace file. Tracking data files will be written to predefined folders. To prevent xdebug from generating a trace file on every request, you need to set xdebug.auto_trace to 0. The trigger itself can be accessed by setting xdebug.trace_enable_trigger_value.

xdebug.trace_enable_trigger_value

Type: string, Default value: "", since Xdebug > 2.3

This setting is used to limit who can take advantage of the XDEBUG_TRACE function described in xdebug.trace_enable_trigger. When changing from the default null value, the cookie, GET or POST value needs to match the share hidden setting in the generated settings for the trace file.

xdebug.trace_format

Type: integer, Default value: 0

The format of the tracking file.

描述

0

显示人类可读性排版式文件:时间点,内存量,内存增量(如果xdebug.show_mem_delta 开启), 层级, 函数名, 函数参数 (如果 xdebug.collect_params 开启),文件名和行号。

1

用两种不同记录编写记算机可读格式文件。其记录不同在于一个插入堆栈边框,一个移除堆栈边框。以下表格列出记录中每个栏位区别。

2

使用HTML写成跟踪文件。

value

Description

0

Show human-readable formatted file: time point, amount of memory, memory delta (if xdebug.show_mem_delta is turned on), level, function name, function parameters (if xdebug.collect_params is turned on), file name and line number.

1

Create a computer-readable format file using two different records. The difference between the records is that one inserts the stack border and the other removes the stack border. The following table lists the differences between each field in the record.

2

Use HTML to write tracking files.

计算机化格式的栏位:

Record type

Record type

1

2

3

4

5

6

7

8

9

10

11

12 - ...

Entry

level

function #

always '0'

time index

memory usage

function name

user-defined (1)   or internal function (0)

name of   the include/require file

filename

line number

no. of parameters

parameters   (as many as specified in field 11) - tab separated

Exit

level

function #

always '1'

time index

memory usage

empty

Return

level

function #

always 'R'

empty

return value

empty

1

2

3

4

5

6

7

8

9

10

11

12 - ...

Entry

level function # always '0' time index memory usage function name user-defined (1)   or internal function (0) name of   the include/require file filename line number no. of parameters parameters   (as many as specified in field 11) - tab separated

Exit

level function # always '1' time index memory usage

empty

Return

level function # always 'R'

empty

return value

empty

xdebug.trace_options

Type: integer, Default value: 0

When set to 1, the tracking file will add content later instead of overwriting it directly in subsequent requests.

xdebug.trace_output_dir

Type: string, Default value: /tmp

Trace the file writing path and ensure that the user has write permissions to the directory when running PHP.

xdebug.trace_output_name

Type: string, Default value: trace.%c

This setting determines the file name to which tracking information is written. This setting uses a format identifier, similar to sprintf() and strftime(). Several format identifiers can be used to format file names. The suffix '.xt' is automatically added to the file name.

Format identifier list:

标识符

意义

格式范例

文件范例

%c

当前工作路径的crc32效验值

trace.%c

trace.1258863198.xt

%p

进程标识符

trace.%p

trace.5174.xt

%r

随机数

trace.%r

trace.072db0.xt

%s

脚本名 2

cachegrind.out.%s

cachegrind.out._home_httpd_html_test_xdebug_test_php

%t

时间截 (秒)

trace.%t

trace.1179434742.xt

%u

时间截 (微秒)

trace.%u

trace.1179434749_642382.xt

%H

$_SERVER['HTTP_HOST']

trace.%H

trace.kossu.xt

%R

$_SERVER['REQUEST_URI']

trace.%R

trace._test_xdebug_test_php_var=1_var2=2.xt

%U

$_SERVER['UNIQUE_ID'] 3

trace.%U

trace.TRX4n38AAAEAAB9gBFkAAAAB.xt

%S

session_id   (来源$_COOKIE,如果有设置)

trace.%S

trace.c70c1ec2375af58f74b390bbdd2a679d.xt

%%

literal %

trace.%%

trace.%%.xt

Identifier

Meaning

Format example

File Example

%c

Crc32 validation value of the current working path trace.%c trace.1258863198.xt

%p

Process Identifier trace.%p trace.5174.xt

%r

Random number trace.%r trace.072db0.xt

%s

Script name 2 cachegrind.out.%s cachegrind.out._home_httpd_html_test_xdebug_test_php

%t

Time cutoff (seconds) trace.%t trace.1179434742.xt

%u

Time cutoff (microseconds) trace.%u trace.1179434749_642382.xt

%H

$_SERVER['HTTP_HOST'] trace.%H trace.kossu.xt

%R

$_SERVER['REQUEST_URI'] trace.%R trace._test_xdebug_test_php_var=1_var2=2.xt

%U

$_SERVER['UNIQUE_ID'] 3 trace.%U trace.TRX4n38AAAEAAB9gBFkAAAAB.xt

%S

session_id (source $_COOKIE, if set) trace.%S trace.c70c1ec2375af58f74b390bbdd2a679d.xt

%%

literal % trace.%% trace.%%.xt

2 This is not available for tracking filenames.

3 New features in version 2.2. This feature is set by the Apache mod_unique_id module.

xdebug.var_display_max_children

Type: integer, default value: 128

This setting controls the display of the number of array elements and object properties when using xdebug_var_dump(), xdebug.show_local_vars or the trace function.

If it is not restricted, it can be set to -1 value.

This setting is not affected by Remot_Debuggin in any way.

xdebug.var_display_max_data

Type: integer, default value: 512

This setting controls the maximum string length displayed when using xdebug_var_dump(), xdebug.show_local_vars or the trace function.

If it is not restricted, it can be set to -1 value.

This setting is not affected by Remot_Debugging in any way.

xdebug.var_display_max_depth

Type: integer, default value: 3

This setting controls the display level of array elements and object properties when using xdebug_var_dump(), xdebug.show_local_vars or the trace function.

The maximum value is 1023, you can set it to -1 to indicate the maximum value.

This setting is not affected by Remot_Debugging in any way.

Related functions:

string xdebug_get_tracefile_name()

Returns the script file name of the current trace output. This function is available when xdebug.auto_trace is turned on.

void xdebug_start_trace( string trace_file [, integer options] )

Start a new function trace

At a certain point starts the function trace merged into the file specified by the parameter trace_file. If no file name is specified, the trace file is stored in the directory specified by the xdebug.trace_output_dir setting. Once a filename is specified in the first argument, the name is relative to the current working directory. However, the current working directory may be different from what you expect, so it is best to specify an absolute directory when specifying the file name. The PHP function getcwd() can point out the current working directory.

The trace file name is generally "{trace_file}.xt". If xdebug.auto_trace is turned on, then the "{filename}" part of the file name "{filename}.xt" is determined by setting xdebug.trace_output_name. The parameter options is a bit value, and there are three options:

XDEBUG_TRACE_APPEND (1)

Make trace files open in append mode instead of overwrite mode.

XDEBUG_TRACE_COMPUTERIZED (2)

Creates a trace file whose format is described by "xdebug.trace_format".

XDEBUG_TRACE_HTML (4)

Create tracking files in html table.

XDEBUG_TRACE_NAKED_FILENAME (8)

Generally speaking, Xdebug will add ".xt" to the end of the file name you specify as the first parameter. Using the XDEBUG_TRACE_NAKED_FILENAME option, ".xt" will not be added (new feature of Xdebug 2.3).

Unlike Xdebug 1, Xdebug 2 does not occupy memory during function calls. , but it will write to disk and relieve the pressure on memory usage. Settings such as xdebug.collect_includes, xdebug.collect_params and xdebug.collect_return will affect what kind of information is recorded in the trace file, while xdebug.trace_format affects the format of the file information.

void xdebug_stop_trace()

Stop tracing function calls and close tracing files.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1133567.htmlTechArticleXdebug Document (4) Function Tracking, xdebug Document Function Tracking Xdebug allows you to call all functions, including parameters and Return values ​​are logged to files in different formats. These so-called functions...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Will enabling XDebug on a production server make PHP slower? Will enabling XDebug on a production server make PHP slower? Sep 22, 2023 pm 10:41 PM

Yes, debuggers like XDebug can slow down PHP server performance. This is why the debugger is not placed in a server environment. They are deployed in different environments to avoid unnecessary overhead. Debug messages cannot be displayed in applications that are already in production. When debugging behavior is added to the server, the debugging engine is attached to the PHP process. It starts receiving messages to stop at the breakpoint, but this is not required behavior as it would give a performance hit to other processes, thus stopping the PHP parser. On the other hand, when debuggers are installed, they tend to open ports in the server because they are not intended for use in a production environment. Opening a port in your server is just as bad as opening a door for hackers to snoop through.

Debugging library in PHP8.0: Xdebug Debugging library in PHP8.0: Xdebug May 14, 2023 am 08:09 AM

Debugging is an inevitable part of PHP development. In order to help developers debug their own code more easily, PHP8.0 introduced a very useful tool in its debugging library: Xdebug. This article will introduce some of the main features of Xdebug and how to use it to simplify the process of PHP debugging. Xdebug is an open source debugging tool that can capture errors in PHP applications and provide detailed error stack trace information, as well as the variables being used. It helps developers detect and troubleshoot code

Using Xdebug debugging technology in ThinkPHP6 Using Xdebug debugging technology in ThinkPHP6 Jun 20, 2023 pm 09:14 PM

ThinkPHP6 is a popular PHP framework that uses a variety of technologies to make development more convenient. One such technology is debugging tools such as Xdebug. In this article, we will explore how to use Xdebug for debugging in ThinkPHP6. Install and configure Xdebug Before you start using Xdebug, you first need to install and enable it. In the php.ini file, you can add the following configuration: [xdebug]zend_extension=x

Development tools in PHP Development tools in PHP May 23, 2023 am 08:18 AM

PHP is a programming language widely used in web development. For PHP development tools, choosing a suitable tool can make the developer's work more efficient and convenient. In this article, we will discuss several common PHP development tools, including integrated development environments (IDEs), text editors, and debugging tools. 1. Integrated development environment (IDE) PhpStorm PhpStorm is a powerful PHP development environment developed by JetBrains. It not only supports PH

How to use the php extension XDebug for efficient debugging and performance optimization How to use the php extension XDebug for efficient debugging and performance optimization Jul 29, 2023 pm 08:57 PM

How to use the PHP extension XDebug for efficient debugging and performance optimization When developing and debugging PHP applications, we often encounter a variety of problems, including incorrect calls, inefficient code, and performance bottlenecks. XDebug is a powerful PHP extension that can help us quickly locate, debug and optimize these problems. This article will introduce how to use XDebug for efficient debugging and performance optimization, and provide some code examples. Install and configure XDebug First, we need to install XDebug

A Practical Guide to PHP Server Optimization: From Beginner to Mastery A Practical Guide to PHP Server Optimization: From Beginner to Mastery Feb 19, 2024 pm 05:03 PM

1. Overview of PHP server optimization PHP server optimization refers to improving the performance and stability of the PHP server by adjusting server configuration, optimizing PHP code, and using cache. Common optimization methods include: 1. Optimize PHP code Optimizing PHP code is one of the most direct ways to improve PHP server performance. Methods to optimize PHP code include: using faster algorithms and data structures to avoid unnecessary database queries and recycling caching techniques to improve performance using code analysis tools to find performance bottlenecks 2. Optimize PHP server configuration Optimizing PHP server configuration can also improve performance PHP server performance and stability. Methods to optimize PHP server configuration include: increasing PHP memory limit, adjusting the number of PHP processes, and optimizing

PHP development: Breakpoint debugging and unit testing using Xdebug and PHPUnit PHP development: Breakpoint debugging and unit testing using Xdebug and PHPUnit Jun 15, 2023 pm 07:55 PM

PHP developers often encounter debugging and testing issues during the development process. To address these issues, we can use some tools to help us better debug and test. Among them, Xdebug and PHPUnit are two essential tools for PHP developers. In this article, we will introduce the basic usage of Xdebug and PHPUnit, including how to use breakpoint debugging and unit testing. Xdebug is a debugger and analyzer for PHP. byX

Swoole debugging tips: Use Xdebug to debug high-concurrency applications Swoole debugging tips: Use Xdebug to debug high-concurrency applications Jun 13, 2023 am 09:19 AM

With the rapid development of Internet technology, more and more applications adopt high-concurrency architecture to achieve fast response and high scalability. Swoole, as a popular PHP extension in the field of high concurrency, provides developers with extremely rich functions and good performance. However, when we use Swoole to develop high-concurrency applications, we often encounter various problems, the most troublesome of which is how to debug the program. This article will introduce how to use Xdebug to debug Swoole applications. 1. What is

See all articles