[php-src] PR #17227: GDB script improvements

From: Date: Fri, 20 Dec 2024 17:38:46 +0000
Subject: [php-src] PR #17227: GDB script improvements
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-30075@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/17227 Author: arnaud-lb Improve the Python GDB script in the following ways: - Support IS_INDIRECT, IS_PTR, IS_ALIAS_PTR when printing zvals: ``` (gdb) p $z1 $3 = (zval *) 0x7ffff7a5f040 (gdb) p *$z1 $4 = indirect: ((zval*) 0x7ffff7a58628) "foo" = { ... (zval fields) } (gdb) p $z2 $6 = (zval *) 0x1356580 (gdb) p *$z2 $7 = ptr: ((void*) 0x7ffff7a02018) = { ... (zval fields) } ``` - Pretty print the ce_flags field when pretty printing a zend_class_entry ``` (gdb) p Z_CE_P($z2) $9 = "C" = { type = 2 '\002', name = "C", <anonymous> = { parent = 0x0, parent_name = 0x0 }, refcount = 1, ce_flags = 4872 = ZEND_ACC_LINKED | ZEND_ACC_HAS_TYPE_HINTS | ZEND_ACC_TOP_LEVEL | ZEND_ACC_CONSTANTS_UPDATED, ... (other zend_class_entry fields) ``` - Pretty print the const flags when pretty printing a zend_class_constant ``` (gdb) p $c $4 = (zend_class_constant *) 0x7ffff7a02220 (gdb) p *$c $5 = { value.u2.constant_flags = 1 = ZEND_ACC_PUBLIC, ... (other zend_class_constant fields) } ``` - Added a minimal zend_property_info pretty printer to pretty print the flags field ``` (gdb) p $p $10 = (struct _zend_property_info *) 0x7ffff7a02258 (gdb) p *$p $11 = { offset = 40, flags = 1 = ZEND_ACC_PUBLIC, name = "foo", ... (other zend_property_info fields) } ``` - Added minimal zend_function, zend_op_array, and zend_internal_function pretty printers: - The the string value is the function/method name, function type (user/internal), and location (when application) - Pretty print fn_flags field ``` (gdb) p $f $13 = (zend_function *) 0x7ffff7a022a0 (gdb) p *$f $14 = user method "C"::"foo" "Command line code":1 = { type = 2 '\002', quick_arg_flags = 2, op_array = method "C"::"foo" "Command line code":1 = { type = 2 '\002', arg_flags = "\000\000", fn_flags = 33554466 = ZEND_ACC_PROTECTED | ZEND_ACC_FINAL | ZEND_ACC_DONE_PASS_TWO, ... (other fields) } ``` - Added a minimal zend_op pretty printer to pretty print the opcode ``` (gdb) p $f.op_array.opcodes[0] $15 = { opcode = 62 = ZEND_RETURN, ... (other zend_op fields) } ``` - Added a few gdb commands: - print_fn_flags, print_ce_flags, print_prop_flags, print_const_flags - print_opcode ``` (gdb) print_fn_flags 33554466 ZEND_ACC_PROTECTED | ZEND_ACC_FINAL | ZEND_ACC_DONE_PASS_TWO (gdb) print_ce_flags 4872 ZEND_ACC_LINKED | ZEND_ACC_HAS_TYPE_HINTS | ZEND_ACC_TOP_LEVEL | ZEND_ACC_CONSTANTS_UPDATED (gdb) print_prop_flags 1 ZEND_ACC_PUBLIC (gdb) print_const_flags 1 ZEND_ACC_PUBLIC (gdb) print_opcode 1 ZEND_ADD ``` - Small refactors

« previous php.git-pulls (#30075) next »