Skip to content
Permalink
Browse files

Fixed issue #1652: Problems with detach in debugger init stage

  • Loading branch information...
derickr committed Aug 23, 2019
1 parent 8d9d444 commit b8526c7614b255d4455efbc2e6ed4dfa9eb9bc35
Showing with 80 additions and 3 deletions.
  1. +5 −0 tests/bug01388-01.phpt
  2. +73 −0 tests/bug01388-21.phpt
  3. +0 −2 xdebug_com.c
  4. +2 −1 xdebug_handler_dbgp.c
@@ -19,6 +19,7 @@ $commands = array(
'breakpoint_list',
"breakpoint_set -t line -f file://{$filename} -n 4",
'breakpoint_list',
'detach',
);
dbgpRunFile( $filename, $commands );
@@ -58,3 +59,7 @@ dbgpRunFile( $filename, $commands );
-> breakpoint_list -i 8
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="8"><breakpoint type="line" resolved="unresolved" filename="file://bug01388-01.inc" lineno="4" state="enabled" hit_count="0" hit_value="0" id=""></breakpoint><breakpoint type="line" resolved="unresolved" filename="file://bug01388-01.inc" lineno="4" state="enabled" hit_count="0" hit_value="0" id=""></breakpoint></response>

-> detach -i 9
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="9" status="stopping" reason="ok"></response>
@@ -0,0 +1,73 @@
--TEST--
Test for bug #1388: Resolved Breakpoint: attributes shown
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('dbgp');
?>
--FILE--
<?php
require 'dbgp/dbgpclient.php';
$filename = realpath( dirname(__FILE__) . '/bug01388-01.inc' );
$commands = array(
'step_into',
'feature_get -n resolved_breakpoints',
"breakpoint_set -t line -f file://{$filename} -n 4",
'breakpoint_list',
'feature_set -n resolved_breakpoints -v 1',
'feature_get -n resolved_breakpoints',
'breakpoint_list',
"breakpoint_set -t line -f file://{$filename} -n 4",
'breakpoint_list',
'detach',
);
dbgpRunFile( $filename, $commands );
?>
--EXPECTF--
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug01388-01.inc" language="PHP" xdebug:language_version="" protocol_version="1.0" appid="" idekey=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 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="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file://bug01388-01.inc" lineno="%d"></xdebug:message></response>

-> feature_get -i 2 -n resolved_breakpoints
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="2" feature_name="resolved_breakpoints" supported="1"><![CDATA[0]]></response>

-> breakpoint_set -i 3 -t line -f file://bug01388-01.inc -n 4
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3" id=""></response>

-> breakpoint_list -i 4
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="4"><breakpoint type="line" filename="file://bug01388-01.inc" lineno="4" state="enabled" hit_count="0" hit_value="0" id=""></breakpoint></response>

-> feature_set -i 5 -n resolved_breakpoints -v 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="resolved_breakpoints" success="1"></response>

-> feature_get -i 6 -n resolved_breakpoints
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="6" feature_name="resolved_breakpoints" supported="1"><![CDATA[1]]></response>

-> breakpoint_list -i 7
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="7"><breakpoint type="line" resolved="unresolved" filename="file://bug01388-01.inc" lineno="4" state="enabled" hit_count="0" hit_value="0" id=""></breakpoint></response>

-> breakpoint_set -i 8 -t line -f file://bug01388-01.inc -n 4
<?xml version="1.0" encoding="iso-8859-1"?>
<notify xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" name="breakpoint_resolved"><breakpoint type="line" resolved="resolved" filename="file://bug01388-01.inc" lineno="8" state="enabled" hit_count="0" hit_value="0" id=""></breakpoint></notify>

<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="8" id="" resolved="resolved"></response>

-> breakpoint_list -i 9
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="9"><breakpoint type="line" resolved="unresolved" filename="file://bug01388-01.inc" lineno="4" state="enabled" hit_count="0" hit_value="0" id=""></breakpoint><breakpoint type="line" resolved="unresolved" filename="file://bug01388-01.inc" lineno="4" state="enabled" hit_count="0" hit_value="0" id=""></breakpoint></response>

-> detach -i 10
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="10" status="stopping" reason="ok"></response>
@@ -456,8 +456,6 @@ static void xdebug_init_debugger()

zend_string_release(ini_val);
zend_string_release(ini_name);

xdebug_mark_debug_connection_active();
}
} else if (XG(context).socket == -1) {
XG(context).handler->log(XDEBUG_LOG_ERR, "Could not connect to client. :-(\n");
@@ -2386,6 +2386,7 @@ int xdebug_dbgp_init(xdebug_con *context, int mode)
context->inhibit_notifications = 0;
context->resolved_breakpoints = 0;

xdebug_mark_debug_connection_active();
xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC);

return 1;
@@ -2602,7 +2603,7 @@ int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file,

xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC);

return 1;
return xdebug_is_debug_connection_active_for_current_pid();
}

xdebug_set *get_executable_lines_from_oparray(function_stack_entry *fse)

0 comments on commit b8526c7

Please sign in to comment.
You can’t perform that action at this time.