Skip to content

Commit

Permalink
Enhancements and fixes for print_pi in gdbinit
Browse files Browse the repository at this point in the history
1) Outputs the default value and the offset of a property
2) Fixed output of property flags
  • Loading branch information
mhagstrand authored and nikic committed Feb 10, 2018
1 parent 5673c64 commit 01f7998
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,12 @@ end

define print_pi
set $pi = (zend_property_info *)$arg0
set $initial_offset = ((uint32_t)(zend_uintptr_t)(&((zend_object*)0)->properties_table[(0)]))
set $ptr_to_val = (zval*)((char*)$pi->ce->default_properties_table + $pi->offset - $initial_offset)
printf "[%p] {\n", $pi
printf " offset = %p\n", $pi->offset
printf " ce = [%p] %s\n", $pi->ce, $pi->ce->name->val
printf " flags = %d (", $pi->flags
printf " flags = 0x%x (", $pi->flags
if $pi->flags & 0x100
printf "ZEND_ACC_PUBLIC"
else
Expand All @@ -485,14 +488,20 @@ define print_pi
printf "ZEND_ACC_PRIVATE"
else
if $pi->flags & 0x800
printf "ZEND_ACC_CHANGED"
printf "ZEND_ACC_EARLY_BINDING"
else
if $pi->flags & 0x20000
printf "ZEND_ACC_SHADOW"
end
end
end
end
end
printf ")\n"
printf " name = "
print_zstr $pi->name
printf " default value: "
printzv $ptr_to_val
printf "}\n"
end

Expand Down

0 comments on commit 01f7998

Please sign in to comment.