Skip to content

Commit c654973

Browse files
authored
.gdbinit: Update print_ht for new compact packed arrays representation (php#8966)
1 parent 75a9a5f commit c654973

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

Diff for: .gdbinit

+21-11
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ define ____print_ht
318318
set $n = $n - 1
319319
end
320320

321-
if $ht->u.v.flags & 4
321+
set $packed = $ht->u.v.flags & 4
322+
if $packed
322323
printf "Packed"
323324
else
324325
printf "Hash"
@@ -329,36 +330,45 @@ define ____print_ht
329330
set $i = 0
330331
set $ind = $ind + 1
331332
while $i < $num
332-
set $p = (Bucket*)($ht->arData + $i)
333+
if $packed
334+
set $val = (zval*)($ht->arPacked + $i)
335+
set $key = (zend_string*)0
336+
set $h = $i
337+
else
338+
set $bucket = (Bucket*)($ht->arData + $i)
339+
set $val = &$bucket->val
340+
set $key = $bucket->key
341+
set $h = $bucket->h
342+
end
333343
set $n = $ind
334-
if $p->val.u1.v.type > 0
344+
if $val->u1.v.type > 0
335345
while $n > 0
336346
printf " "
337347
set $n = $n - 1
338348
end
339349
printf "[%d] ", $i
340-
if $p->key
341-
____print_str $p->key->val $p->key->len
350+
if $key
351+
____print_str $key->val $key->len
342352
printf " => "
343353
else
344-
printf "%d => ", $p->h
354+
printf "%d => ", $h
345355
end
346356
if $arg1 == 0
347-
printf "%p\n", (zval *)&$p->val
357+
printf "%p\n", $val
348358
end
349359
if $arg1 == 1
350-
set $zval = (zval *)&$p->val
360+
set $zval = $val
351361
____printzv $zval 1
352362
end
353363
if $arg1 == 2
354-
printf "%s\n", (char*)$p->val.value.ptr
364+
printf "%s\n", (char*)$val->value.ptr
355365
end
356366
if $arg1 == 3
357-
set $func = (zend_function*)$p->val.value.ptr
367+
set $func = (zend_function*)$val->value.ptr
358368
printf "\"%s\"\n", $func->common.function_name->val
359369
end
360370
if $arg1 == 4
361-
set $const = (zend_constant *)$p->val.value.ptr
371+
set $const = (zend_constant *)$val->value.ptr
362372
____printzv $const 1
363373
end
364374
end

0 commit comments

Comments
 (0)