[xdebug-dev] xdebug xdebug/xdebug_handler_dbgp.c - fixed #73: komodo beta 4.3.7 crash

From: Shane Caraveo <shane[@]caraveo.com>
Date: Thu, 15 Jul 2004 01:58:49 +0200

Date: Thu Jul 15 01:58:49 CEST 2004
User: Shane Caraveo
Directory: xdebug

Log Message:
[2.00]
- fixed #73: komodo beta 4.3.7 crash
- fixed dbgp error handler to work correctly and provide a response that is correct for the protocol
#- bug entry does not identify what the real bug was, see also bugs.activestate.com for bug # 32630
Modified files:
           xdebug/xdebug_handler_dbgp.c (version: 1.47)

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- xdebug/xdebug_handler_dbgp.c:1.46 Sat Jul 10 10:58:30 2004 GMT
+++ xdebug/xdebug_handler_dbgp.c Wed Jul 14 21:58:48 2004 GMT
@@ -1534,7 +1534,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.46 $";
+ return "$Revision: 1.47 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
@@ -1692,7 +1692,7 @@
 int xdebug_dbgp_error(xdebug_con *context, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack)
 {
         char *errortype;
- xdebug_xml_node *response;
+ xdebug_xml_node *response, *error;
         TSRMLS_FETCH();
 
         if (exception_type) {
@@ -1700,6 +1700,26 @@
         } else {
                 errortype = error_type(type);
         }
+
+ if (exception_type) {
+ XG(status) = DBGP_STATUS_BREAK;
+ XG(reason) = DBGP_REASON_EXCEPTION;
+ } else {
+ switch (type) {
+ case E_CORE_ERROR:
+ /* no break - intentionally */
+ case E_ERROR:
+ /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */
+ case E_COMPILE_ERROR:
+ case E_USER_ERROR:
+ XG(status) = DBGP_STATUS_STOPPING;
+ XG(reason) = DBGP_REASON_ABORTED;
+ break;
+ default:
+ XG(status) = DBGP_STATUS_BREAK;
+ XG(reason) = DBGP_REASON_ERROR;
+ }
+ }
 /*
         runtime_allowed = (
                 (type != E_ERROR) &&
@@ -1708,9 +1728,19 @@
                 (type != E_USER_ERROR)
         ) ? XDEBUG_BREAKPOINT | XDEBUG_RUNTIME : 0;
 */
+
         response = xdebug_xml_node_init("response");
- xdebug_xml_add_attribute_ex(response, "exception", xdstrdup(errortype), 0, 1);
- xdebug_xml_add_text(response, xdstrdup(message));
+ xdebug_xml_add_attribute_ex(response, "command", XG(lastcmd), 0, 0);
+ xdebug_xml_add_attribute_ex(response, "transaction_id", XG(lasttransid), 0, 1);
+ xdebug_xml_add_attribute(response, "status", xdebug_dbgp_status_strings[XG(status)]);
+ xdebug_xml_add_attribute(response, "reason", xdebug_dbgp_reason_strings[XG(reason)]);
+
+ error = xdebug_xml_node_init("error");
+ xdebug_xml_add_attribute_ex(error, "code", xdebug_sprintf("%lu", type), 0, 1);
+ xdebug_xml_add_attribute_ex(error, "exception", xdstrdup(errortype), 0, 1);
+ xdebug_xml_add_text(error, xdstrdup(message));
+ xdebug_xml_add_child(response, error);
+
         send_message(context, response);
         xdebug_xml_node_dtor(response);
         if (!exception_type) {
Received on Thu Jul 15 2004 - 01:58:58 BST

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