On Wed, 14 Apr 2010, Xavier Puig wrote:
> My xdebug jumps in IF condition, for example:
>
> 1<?php
> 2 $var="zero"."one"."two"."three";
> 3
> 4 $var2=526;
> 5 if($var2-550 > 0)
> 6 $var=500;
> 7 else
> 8 $var=1000;
> 9 $var="string";
>
> I run dbgp protocol, allways "step_into" and the steps are:
> line 2
> line 4
> line 5
> line 9
>
> I don't know if the conditional was true or false, the only way to know it i
> send command "context_get" and see what value have $var.
>
> Is there any way to know more detail(the maxim) of steps of execution, I must
> have something like this:
<snip>
Xdebug only can break when PHP hits the EXT_STMT opcode. If we check
with VLD and your script, you see they're only at lines 2, 4, 5 and 9:
compiled vars: !0 = $var, !1 = $var2
line # * op fetch ext return operands
---------------------------------------------------------------------------------
2 0 > EXT_STMT
1 CONCAT ~0 'zero', 'one'
2 CONCAT ~1 ~0, 'two'
3 CONCAT ~2 ~1, 'three'
4 ASSIGN !0, ~2
4 5 EXT_STMT
6 ASSIGN !1, 526
5 7 EXT_STMT
8 SUB ~5 !1, 550
9 IS_SMALLER ~6 0, ~5
6 10 > JMPZ ~6, ->13
11 > ASSIGN !0, 500
12 > JMP ->14
8 13 > ASSIGN !0, 1000
9 14 > EXT_STMT
15 ASSIGN !0, 'string'
10 16 > RETURN 1
If you change your script to:
<?php
$var="zero"."one"."two"."three";
$var2=526;
if($var2-550 > 0) {
$var=500;
} else {
$var=1000; }
$var="string";
then more EXT_STMT opcodes are inserted:
compiled vars: !0 = $var, !1 = $var2
line # * op fetch ext return operands
---------------------------------------------------------------------------------
2 0 > EXT_STMT
1 CONCAT ~0 'zero', 'one'
2 CONCAT ~1 ~0, 'two'
3 CONCAT ~2 ~1, 'three'
4 ASSIGN !0, ~2
4 5 EXT_STMT
6 ASSIGN !1, 526
5 7 EXT_STMT
8 SUB ~5 !1, 550
9 IS_SMALLER ~6 0, ~5
10 > JMPZ ~6, ->14
6 11 > EXT_STMT
12 ASSIGN !0, 500
7 13 > JMP ->16
8 14 > EXT_STMT
15 ASSIGN !0, 1000
9 16 > EXT_STMT
17 ASSIGN !0, 'string'
10 18 > RETURN 1
and Xdebug will correctly break where you expect it. There isn't much I can do
about this, however if you use braces liberally, you won't run into this issue.
Derick
-- Like Xdebug? Consider a donation: http://xdebug.org/donate.php Xdebug | http://xdebug.org | xdebug-general@lists.xdebug.org twitter: @derickr and @xdebugReceived on Sat May 01 2010 - 16:54:54 BST
This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST