Skip to content

Commit 1ee1f79

Browse files
mhagstrandkrakjoe
authored andcommitted
Fixed bug #72680 gdbinit print_cvs not prepared for PHP 7
1 parent ef42f49 commit 1ee1f79

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

.gdbinit

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,35 @@ document ____executor_globals
2929
end
3030

3131
define print_cvs
32-
____executor_globals
33-
set $p = $eg.current_execute_data.CVs
34-
set $c = $eg.current_execute_data.op_array.last_var
35-
set $v = $eg.current_execute_data.op_array.vars
36-
set $i = 0
32+
if $argc == 0
33+
____executor_globals
34+
set $cv_ex_ptr = $eg.current_execute_data
35+
else
36+
set $cv_ex_ptr = (zend_execute_data *)$arg0
37+
end
38+
set $cv_count = $cv_ex_ptr.func.op_array.last_var
39+
set $cv = $cv_ex_ptr.func.op_array.vars
40+
set $cv_idx = 0
41+
set $callFrameSize = (sizeof(zend_execute_data) + sizeof(zval) - 1) / sizeof(zval)
3742

38-
printf "Compiled variables count: %d\n", $c
39-
while $i < $c
40-
printf "%d = %s\n", $i, $v[$i].name
41-
if $p[$i] != 0
42-
printzv *$p[$i]
43-
else
44-
printf "*uninitialized*\n"
45-
end
46-
set $i = $i + 1
43+
printf "Compiled variables count: %d\n\n", $cv_count
44+
while $cv_idx < $cv_count
45+
printf "[%d] '%s'\n", $cv_idx, $cv[$cv_idx].val
46+
set $zvalue = ((zval *) $cv_ex_ptr) + $callFrameSize + $cv_idx
47+
printzv $zvalue
48+
set $cv_idx = $cv_idx + 1
4749
end
4850
end
4951

52+
document print_cvs
53+
Prints the compiled variables and their values.
54+
If a zend_execute_data pointer is set this will print the compiled
55+
variables of that scope. If no parameter is used it will use
56+
current_execute_data for scope.
57+
58+
usage: print_cvs [zend_execute_data *]
59+
end
60+
5061
define dump_bt
5162
set $ex = $arg0
5263
while $ex
@@ -563,7 +574,7 @@ end
563574

564575
document print_zstr
565576
print the length and contents of a zend string
566-
usage: print_zstr [ptr]
577+
usage: print_zstr <ptr>
567578
end
568579

569580
define zbacktrace

0 commit comments

Comments
 (0)