[xdebug-dev] xdebug xdebug/xdebug_handler_dbgp.c - conform to spec on stopping/stopped status, this fixes post mortem support since a status of stopped means no more communication is allowed

From: Shane Caraveo <shane[@]caraveo.com>
Date: Fri, 24 Aug 2007 03:07:57 +0200

Date: Fri Aug 24 03:07:57 CEST 2007
User: Shane Caraveo
Directory: xdebug

Log Message:
[4.00]
- conform to spec on stopping/stopped status, this fixes post mortem support since a status of stopped means no more communication is allowed
- it will probably break someone's post mortem implementation

Modified files:
           xdebug/xdebug_handler_dbgp.c (version: 1.127)

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -r1.126 -r1.127
--- xdebug/xdebug_handler_dbgp.c:1.126 Tue Jul 31 19:44:55 2007 GMT
+++ xdebug/xdebug_handler_dbgp.c Thu Aug 23 23:07:57 2007 GMT
@@ -201,7 +201,7 @@
         DBGP_FUNC_ENTRY(stderr, XDEBUG_DBGP_NONE)
         DBGP_FUNC_ENTRY(stdout, XDEBUG_DBGP_NONE)
 
- DBGP_CONT_FUNC_ENTRY(stop, XDEBUG_DBGP_NONE)
+ DBGP_FUNC_ENTRY(stop, XDEBUG_DBGP_NONE)
         DBGP_CONT_FUNC_ENTRY(run, XDEBUG_DBGP_NONE)
         DBGP_CONT_FUNC_ENTRY(step_into, XDEBUG_DBGP_NONE)
         DBGP_CONT_FUNC_ENTRY(step_out, XDEBUG_DBGP_NONE)
@@ -1326,8 +1326,9 @@
 
 DBGP_FUNC(stop)
 {
- XG(status) = DBGP_STATUS_STOPPING;
- zend_bailout();
+ XG(status) = DBGP_STATUS_STOPPED;
+ xdebug_xml_add_attribute(*retval, "status", xdebug_dbgp_status_strings[XG(status)]);
+ xdebug_xml_add_attribute(*retval, "reason", xdebug_dbgp_reason_strings[XG(reason)]);
 }
 
 DBGP_FUNC(run)
@@ -1374,7 +1375,7 @@
 
 DBGP_FUNC(detach)
 {
- XG(status) = DBGP_STATUS_STOPPING;
+ XG(status) = DBGP_STATUS_STOPPED;
         XG(remote_enabled) = 0;
         XG(remote_enable) = 0;
 }
@@ -2228,10 +2229,10 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.126 $";
+ return "$Revision: 1.127 $";
 }
 
-static int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
+static int xdebug_dbgp_cmdloop(xdebug_con *context, int bail TSRMLS_DC)
 {
         char *option;
         int ret;
@@ -2253,7 +2254,11 @@
                 xdebug_xml_node_dtor(response);
 
                 free(option);
- } while (1 != ret);
+ } while (1 != ret && XG(status) != DBGP_STATUS_STOPPED);
+
+ if (bail && XG(status) == DBGP_STATUS_STOPPED) {
+ zend_bailout();
+ }
         return ret;
 
 }
@@ -2374,7 +2379,7 @@
         context->eval_id_lookup = xdebug_hash_alloc(64, (xdebug_hash_dtor) xdebug_hash_eval_info_dtor);
         context->eval_id_sequence = 0;
 
- xdebug_dbgp_cmdloop(context TSRMLS_CC);
+ xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC);
 
         return 1;
 }
@@ -2385,7 +2390,7 @@
         xdebug_var_export_options *options;
         TSRMLS_FETCH();
 
- XG(status) = DBGP_STATUS_STOPPED;
+ XG(status) = DBGP_STATUS_STOPPING;
         XG(reason) = DBGP_REASON_OK;
         response = xdebug_xml_node_init("response");
         xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1");
@@ -2402,7 +2407,7 @@
         send_message(context, response TSRMLS_CC);
         xdebug_xml_node_dtor(response);
 
- xdebug_dbgp_cmdloop(context TSRMLS_CC);
+ xdebug_dbgp_cmdloop(context, 0 TSRMLS_CC);
 
         if (XG(stdio).php_body_write != NULL && OG(php_body_write)) {
                 OG(php_body_write) = XG(stdio).php_body_write;
@@ -2494,7 +2499,7 @@
                 xdfree(errortype);
         }
 
- xdebug_dbgp_cmdloop(context TSRMLS_CC);
+ xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC);
 
         return 1;
 }
@@ -2542,7 +2547,7 @@
         XG(lastcmd) = NULL;
         XG(lasttransid) = NULL;
 
- xdebug_dbgp_cmdloop(context TSRMLS_CC);
+ xdebug_dbgp_cmdloop(context, 1 TSRMLS_CC);
 
         return 1;
 }
Received on Fri Aug 24 2007 - 03:08:40 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST