notes icon indicating copy to clipboard operation
notes copied to clipboard

PHP gdb(.gdbinit) 指令列表 or PHP gdb(.gdbinit) commands list

Open lanlin opened this issue 5 years ago • 1 comments

1. set_ts

set the ts resource, it is impossible for gdb to call ts_resource_ex while no process is running, but we could get the resource from the argument of frame info.

2. ____executor_globals

portable way of accessing executor_globals, set $eg this also sets compiler_globals to $cg ZTS detection is automatically based on ext/standard module struct

3. print_cvs

Prints the compiled variables and their values. If a zend_execute_data pointer is set this will print the compiled variables of that scope. If no parameter is used it will use current_execute_data for scope.

usage: print_cvs [zend_execute_data *]

4. dump_bt

dumps the current execution stack.

usage: dump_bt executor_globals.current_execute_data

5. printzv

prints zval contents

6. print_global_vars

Prints the global variables

7. print_const_table

Dumps elements of Constants HashTable

usage: print_const_table executor_globals.zend_constants

8. print_ht

dumps elements of HashTable made of zval

9. print_htptr

dumps elements of HashTable made of pointers

10. print_htstr

dumps elements of HashTable made of strings

11. print_ft

dumps a function table (HashTable)

12. print_pi

Takes a pointer to an object's property and prints the property information

usage: print_pi <ptr>

13. printzn

print type and content of znode.

usage: printzn &opline->op1

14. printzops

dump operands of the current opline

15. print_zstr

print the length and contents of a zend string

usage: print_zstr <ptr> [max length]

16. zbacktrace

prints backtrace. This command is almost a short cut for

(gdb) ____executor_globals (gdb) dump_bt $eg.current_execute_data

17. lookup_root

lookup a refcounted in root

usage: lookup_root [ptr]

lanlin avatar Nov 20 '20 04:11 lanlin

.gdbinit 下载地址

https://github.com/php/php-src/blob/PHP-8.0.0/.gdbinit

其中 PHP-8.0.0 是你 PHP 的具体版本号

lanlin avatar Nov 20 '20 04:11 lanlin