Skip to content

Commit d73789e

Browse files
committed
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.
1 parent d303225 commit d73789e

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

.gdbinit

+25-14
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ define ____printzv_contents
165165
set $type = $zvalue->u1.v.type
166166

167167
# 15 == IS_INDIRECT
168-
if $type > 5 && $type != 15
168+
if $type > 5 && $type < 12
169169
printf "(refcount=%d) ", $zvalue->value.counted->gc.refcount
170170
end
171171

@@ -215,12 +215,8 @@ define ____printzv_contents
215215
if ! $arg1
216216
if $handlers->get_properties == &zend_std_get_properties
217217
if $zobj->properties
218+
printf "\nProperties "
218219
set $ht = $zobj->properties
219-
else
220-
set $ht = &$zobj->ce->properties_info
221-
end
222-
printf "\nProperties "
223-
if $ht
224220
set $ind = $ind + 1
225221
____print_ht $ht 1
226222
set $ind = $ind - 1
@@ -230,7 +226,19 @@ define ____printzv_contents
230226
set $i = $i - 1
231227
end
232228
else
233-
echo "not found"
229+
printf " {\n"
230+
set $ht = &$zobj->ce->properties_info
231+
set $k = 0
232+
set $num = $ht->nNumUsed
233+
while $k < $num
234+
set $p = (Bucket*)($ht->arData + $k)
235+
set $name = $p->key
236+
set $prop = (zend_property_info*)$p->val.value.ptr
237+
set $val = (zval*)((char*)$zobj + $prop->offset)
238+
printf "%s => ", $name->val
239+
printzv $val
240+
set $k = $k + 1
241+
end
234242
end
235243
end
236244
end
@@ -250,17 +258,20 @@ define ____printzv_contents
250258
printf "CONSTANT_AST"
251259
end
252260
if $type == 13
253-
printf "_BOOL"
261+
printf "indirect: "
262+
____printzv $zvalue->value.zv $arg1
254263
end
255264
if $type == 14
256-
printf "CALLABLE"
265+
printf "pointer: %p", $zvalue->value.ptr
257266
end
258267
if $type == 15
259-
printf "indirect: "
260-
____printzv $zvalue->value.zv $arg1
268+
printf "_ERROR"
269+
end
270+
if $type == 16
271+
printf "_BOOL"
261272
end
262273
if $type == 17
263-
printf "pointer: %p", $zvalue->value.ptr
274+
printf "CALLABLE"
264275
end
265276
if $type == 18
266277
printf "ITERABLE"
@@ -269,9 +280,9 @@ define ____printzv_contents
269280
printf "VOID"
270281
end
271282
if $type == 20
272-
printf "_ERROR"
283+
printf "_NUMBER"
273284
end
274-
if $type == 16 || $type > 20
285+
if $type > 20
275286
printf "unknown type %d", $type
276287
end
277288
printf "\n"

0 commit comments

Comments
 (0)