From da5db1c9b2125540d45fe581f6fd3c369e549985 Mon Sep 17 00:00:00 2001 From: Mitch Hagstrand Date: Wed, 14 Feb 2018 14:39:01 -0600 Subject: Fixed print_const_table function and zval types in ____printzv_contents 1. Fixed print_const_table to work in ZE3 2. Removed ____print_const_table to use more generic ____print_ht 3. Fixed up zval types in ____printzv_contents --- .gdbinit | 74 ++++++++++++++++++++++++++++------------------------------------ 1 file changed, 32 insertions(+), 42 deletions(-) (limited to '.gdbinit') diff --git a/.gdbinit b/.gdbinit index 53ad8728a0..5a2675d37e 100644 --- a/.gdbinit +++ b/.gdbinit @@ -171,7 +171,7 @@ define ____printzv_contents printf "UNDEF" end if $type == 1 - printf "NULL" + printf "NULL" end if $type == 2 printf "bool: false" @@ -179,15 +179,15 @@ define ____printzv_contents if $type == 3 printf "bool: true" end - if $type == 4 + if $type == 4 printf "long: %ld", $zvalue->value.lval - end - if $type == 5 - printf "double: %f", $zvalue->value.dval - end - if $type == 6 - printf "string: %s", $zvalue->value.str->val - end + end + if $type == 5 + printf "double: %f", $zvalue->value.dval + end + if $type == 6 + printf "string: %s", $zvalue->value.str->val + end if $type == 7 printf "array: " if ! $arg1 @@ -245,25 +245,31 @@ define ____printzv_contents printf "const: %s", $zvalue->value.str->val end if $type == 12 - printf "const_ast" + printf "CONSTANT_AST" end if $type == 13 - printf "_IS_BOOL" + printf "_BOOL" end if $type == 14 - printf "IS_CALLABLE" + printf "CALLABLE" end if $type == 15 printf "indirect: " ____printzv $zvalue->value.zv $arg1 end - if $type == 16 - printf "string_offset" - end if $type == 17 printf "pointer: %p", $zvalue->value.ptr end - if $type > 17 + if $type == 18 + printf "ITERABLE" + end + if $type == 19 + printf "VOID" + end + if $type == 20 + printf "_ERROR" + end + if $type == 16 || $type > 20 printf "unknown type %d", $type end printf "\n" @@ -283,38 +289,18 @@ define ____printzv end end -define ____print_const_table - set $ht = $arg0 - set $p = $ht->pListHead - - while $p != 0 - set $const = (zend_constant *) $p->pData - - set $i = $ind - while $i > 0 - printf " " - set $i = $i - 1 - end - - if $p->nKeyLength > 0 - ____print_str $p->arKey $p->nKeyLength - printf " => " - else - printf "%d => ", $p->h - end - - ____printzv_contents &$const->value 0 - set $p = $p->pListNext - end -end - define print_const_table set $ind = 1 printf "[%p] {\n", $arg0 - ____print_const_table $arg0 + ____print_ht $arg0 4 printf "}\n" end +document print_const_table + Dumps elements of Constants HashTable + Example: print_const_table executor_globals.zend_constants +end + define ____print_ht set $ht = (HashTable*)$arg0 set $n = $ind @@ -361,6 +347,10 @@ define ____print_ht set $func = (zend_function*)$p->val.value.ptr printf "\"%s\"\n", $func->common.function_name->val end + if $arg1 == 4 + set $const = (zend_constant *)$p->val.value.ptr + ____printzv $const 1 + end end set $i = $i + 1 end -- cgit v1.2.1