mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
GDB: apply ast pretty printing to specialized structures (#17884)
The `ZendAstPrettyPrinter` had logic to handle the various structures that are based on `zend_ast`, like `zend_ast_decl`, but the printer was only installed when the value was a `zend_ast`, meaning that for the specialized structures the details wouldn't be shown unless they were cast (in GDB) to `zend_ast`. Instead, just register the printer for the specialized structures too.
This commit is contained in:
parent
cc116067b2
commit
0b42749621
2 changed files with 20 additions and 2 deletions
|
@ -156,7 +156,11 @@ class ZendAstKindPrettyPrinter(gdb.printing.PrettyPrinter):
|
|||
pp_set.add_printer('zend_ast_kind', '^zend_ast_kind$', ZendAstKindPrettyPrinter)
|
||||
|
||||
class ZendAstPrettyPrinter(gdb.printing.PrettyPrinter):
|
||||
"Print a zend_ast"
|
||||
"""
|
||||
Print a zend_ast, or one of the specialized structures based on it:
|
||||
zend_ast_decl, zend_ast_list, zend_ast_op_array, zend_ast_zval, or
|
||||
zend_ast_znode
|
||||
"""
|
||||
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
|
@ -229,6 +233,11 @@ class ZendAstPrettyPrinter(gdb.printing.PrettyPrinter):
|
|||
|
||||
|
||||
pp_set.add_printer('zend_ast', '^_zend_ast$', ZendAstPrettyPrinter)
|
||||
pp_set.add_printer('zend_ast_decl', '^_zend_ast_decl$', ZendAstPrettyPrinter)
|
||||
pp_set.add_printer('zend_ast_list', '^_zend_ast_list$', ZendAstPrettyPrinter)
|
||||
pp_set.add_printer('zend_ast_op_array', '^_zend_ast_op_array$', ZendAstPrettyPrinter)
|
||||
pp_set.add_printer('zend_ast_zval', '^_zend_ast_zval$', ZendAstPrettyPrinter)
|
||||
pp_set.add_printer('zend_ast_znode', '^_zend_ast_znode$', ZendAstPrettyPrinter)
|
||||
|
||||
class ZvalPrettyPrinter(gdb.printing.PrettyPrinter):
|
||||
"Print a zval"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue