Skip to content

Commit

Permalink
Merge branch 'xdebug_2_1'
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Mar 26, 2012
2 parents 24c9442 + 308f95d commit a11e47d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/bug00774.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$someVar = 'someVal';
header('Location: index.php');
exit(0);
?>
40 changes: 40 additions & 0 deletions tests/bug00774.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--TEST--
Test for bug #774: Xdebug generates a "bailout without bailout address"
--FILE--
<?php
require 'dbgp/dbgpclient.php';
$data = file_get_contents(dirname(__FILE__) . '/bug00774.inc');

$commands = array(
'step_into',
'eval -- JF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10=',
'stack_get',
'run',
'detach',
);

dbgpRun( $data, $commands );
?>
--EXPECTF--
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///tmp/xdebug-dbgp-test.php" language="PHP" protocol_version="1.0" appid="" idekey=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>

-> step_into -i 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file:///tmp/xdebug-dbgp-test.php" lineno="2"></xdebug:message></response>

-> eval -i 2 -- JF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10=
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="2"><property address="" type="null"></property></response>

-> stack_get -i 3
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="3"><stack where="{main}" level="0" type="file" filename="file:///tmp/xdebug-dbgp-test.php" lineno="2"></stack></response>

-> run -i 4
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="stopping" reason="ok"></response>

-> detach -i 5
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="detach" transaction_id="5" status="stopping" reason="ok"></response>
16 changes: 16 additions & 0 deletions xdebug_handler_dbgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,11 +1250,21 @@ static int xdebug_do_eval(char *eval_string, zval *ret_zval TSRMLS_DC)
zend_op_array *original_active_op_array = EG(active_op_array);
zend_execute_data *original_execute_data = EG(current_execute_data);
int original_no_extensions = EG(no_extensions);
#if PHP_VERSION_ID < 50200
zend_bool original_bailout_set = EG(bailout_set);
jmp_buf original_bailout;
#else
jmp_buf *original_bailout = EG(bailout);
#endif
#if PHP_VERSION_ID >= 50300
void **original_argument_stack_top = EG(argument_stack)->top;
void **original_argument_stack_end = EG(argument_stack)->end;
#endif

#if PHP_VERSION_ID < 50200
memcpy(&original_bailout, &EG(bailout), sizeof(jmp_buf));
#endif

/* Remember error reporting level */
old_error_reporting = EG(error_reporting);
EG(error_reporting) = 0;
Expand All @@ -1275,6 +1285,12 @@ static int xdebug_do_eval(char *eval_string, zval *ret_zval TSRMLS_DC)
EG(active_op_array) = original_active_op_array;
EG(current_execute_data) = original_execute_data;
EG(no_extensions) = original_no_extensions;
#if PHP_VERSION_ID < 50200
EG(bailout_set) = original_bailout_set;
memcpy(&EG(bailout), &original_bailout, sizeof(jmp_buf));
#else
EG(bailout) = original_bailout;
#endif
#if PHP_VERSION_ID >= 50300
EG(argument_stack)->top = original_argument_stack_top;
EG(argument_stack)->end = original_argument_stack_end;
Expand Down

0 comments on commit a11e47d

Please sign in to comment.