From d73789ef91ebd15f6b72529e78041d366f586611 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 26 Feb 2019 17:26:16 +0100 Subject: [PATCH] Sync types in .gdbinit, improve property dumping If an object doesn't have a property table, we need to go through the property into table and read the corresponding slots. --- .gdbinit | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/.gdbinit b/.gdbinit index 56c11e4206b..8e54830ef2a 100644 --- a/.gdbinit +++ b/.gdbinit @@ -165,7 +165,7 @@ define ____printzv_contents set $type = $zvalue->u1.v.type # 15 == IS_INDIRECT - if $type > 5 && $type != 15 + if $type > 5 && $type < 12 printf "(refcount=%d) ", $zvalue->value.counted->gc.refcount end @@ -215,12 +215,8 @@ define ____printzv_contents if ! $arg1 if $handlers->get_properties == &zend_std_get_properties if $zobj->properties + printf "\nProperties " set $ht = $zobj->properties - else - set $ht = &$zobj->ce->properties_info - end - printf "\nProperties " - if $ht set $ind = $ind + 1 ____print_ht $ht 1 set $ind = $ind - 1 @@ -230,7 +226,19 @@ define ____printzv_contents set $i = $i - 1 end else - echo "not found" + printf " {\n" + set $ht = &$zobj->ce->properties_info + set $k = 0 + set $num = $ht->nNumUsed + while $k < $num + set $p = (Bucket*)($ht->arData + $k) + set $name = $p->key + set $prop = (zend_property_info*)$p->val.value.ptr + set $val = (zval*)((char*)$zobj + $prop->offset) + printf "%s => ", $name->val + printzv $val + set $k = $k + 1 + end end end end @@ -250,18 +258,21 @@ define ____printzv_contents printf "CONSTANT_AST" end if $type == 13 - printf "_BOOL" - end - if $type == 14 - printf "CALLABLE" - end - if $type == 15 printf "indirect: " ____printzv $zvalue->value.zv $arg1 end - if $type == 17 + if $type == 14 printf "pointer: %p", $zvalue->value.ptr end + if $type == 15 + printf "_ERROR" + end + if $type == 16 + printf "_BOOL" + end + if $type == 17 + printf "CALLABLE" + end if $type == 18 printf "ITERABLE" end @@ -269,9 +280,9 @@ define ____printzv_contents printf "VOID" end if $type == 20 - printf "_ERROR" + printf "_NUMBER" end - if $type == 16 || $type > 20 + if $type > 20 printf "unknown type %d", $type end printf "\n"