Bug #72680 [Opn->Csd]: Variable $i conflict in .gdbinit
| From: | krakjoe@php.net | Date: | Thu, 12 Jan 2017 09:12:30 +0000 |
| Subject: | Bug #72680 [Opn->Csd]: Variable $i conflict in .gdbinit | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206550@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72680&edit=1
ID: 72680
Updated by: krakjoe@php.net
Reported by: th3s3v3n dot shell at gmail dot com
Summary: Variable $i conflict in .gdbinit
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Ubuntu 14.04
PHP Version: 5.6.24
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of mhagstrand@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1ee1f79e27fb4006d0400b38163b2ec0786fd130
Log: Fixed bug #72680 gdbinit print_cvs not prepared for PHP 7
Previous Comments:
------------------------------------------------------------------------
[2016-07-26 15:05:52] th3s3v3n dot shell at gmail dot com
Description:
------------
In the gdb script .gdbinit , the life cycle of a variable is the whole calling procedure as soon as
it is declared, instead of the block of function where it is declared in .
in the print_cvs , variable $i is used to count the offset of the CVs.
(If you want to use print_cvs , maybe you must use the EX_CV_NUM() macro to fix the bug 70008 [ https://bugs.php.net/bug.php?id=70008 ] )
Then it call
printzv. But in the function printzv , when the zvalue's type is 4
(array) or 5 (object) , the function ____printzv_contents will execute code:
while $i > 0
printf " "
set $i = $i - 1
end
$i will become 0.
So the loop in the print_cvs will be endless.
Test script:
---------------
aa.php
<?php
$a = 'vdf';
$b = array(1);
$c = array(2);
sleep(1);
# gdb php
(gdb) b sleep
(gdb) b sleep
(gdb) source .gdbinit
(gdb) r aa.php
(gdb) print_cvs
Expected result:
----------------
Compiled variables count: 3
0 = a
[0xf7bfd5d4] (refcount=1) string(3): "vdf"
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}
2 = c
[0xf7bfe79c] (refcount=1) array(1): {
0 => [0xf7bfe72c] (refcount=1) long: 2
}
Actual result:
--------------
in the 5.6.24:
(gdb) print_cvs
Compiled variables count: 3
0 = a
[0xf7bfd5d4] (refcount=1) string(3): "vdf"
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}0
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
---Type <return> to continue, or q <return> to quit---
in the old version (for example 5.4.34):
Compiled variables count: 3
0 = a
[0xf7bfd5d4] (refcount=1) string(3): "vdf"
1 = b
[0xf7bfd59c] (refcount=1) array(1): {
0 => [0xf7bfd5b8] (refcount=1) long: 1
}
1 = b
Structure has no component named operator!=.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72680&edit=1