[xdebug-dev] xdebug xdebug/xdebug.c xdebug/xdebug_handler_dbgp.c xdebug/xdebug_handler_dbgp.h xdebug/xdebug_handler_gdb.c xdebug/xdebug_handler_gdb.h xdebug/xdebug_handlers.h - Correctly add namespace definitions to XML.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 26 Feb 2007 15:43:30 +0100

Date: Mon Feb 26 15:43:30 CET 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[1.00]
- Correctly add namespace definitions to XML.
- Added the xdebug namespace that adds extra information to breakpoints
  if available.
- Stopped the use of <error> elements for exception breakpoints, as that
  violates the protocol.

Modified files:
           xdebug/xdebug.c (version: 1.373)
           xdebug/xdebug_handler_dbgp.c (version: 1.117)
           xdebug/xdebug_handler_dbgp.h (version: 1.20)
           xdebug/xdebug_handler_gdb.c (version: 1.86)
           xdebug/xdebug_handler_gdb.h (version: 1.31)
           xdebug/xdebug_handlers.h (version: 1.36)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.372
retrieving revision 1.373
diff -u -r1.372 -r1.373
--- xdebug/xdebug.c:1.372 Mon Feb 19 21:16:08 2007 GMT
+++ xdebug/xdebug.c Mon Feb 26 13:43:30 2007 GMT
@@ -1273,7 +1273,7 @@
                         if (!extra_brk_info->disabled && (extra_brk_info->function_break_type == breakpoint_type)) {
                                 if (handle_hit_value(extra_brk_info)) {
                                         if (fse->user_defined == XDEBUG_INTERNAL || (breakpoint_type == XDEBUG_BRK_FUNC_RETURN)) {
- if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), fse->filename, fse->lineno, XDEBUG_BREAK)) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), fse->filename, fse->lineno, XDEBUG_BREAK, NULL, NULL)) {
                                                         return 0;
                                                 }
                                         } else {
@@ -2077,7 +2077,7 @@
                 /* Check if we have a breakpoint on this exception */
                 if (xdebug_hash_find(XG(context).exception_breakpoints, exception_ce->name, strlen(exception_ce->name), (void *) &extra_brk_info)) {
                         if (handle_hit_value(extra_brk_info)) {
- if (!XG(context).handler->remote_error(&(XG(context)), 0, exception_ce->name, Z_STRVAL_P(message), Z_STRVAL_P(file), Z_LVAL_P(line), XG(stack))) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), Z_STRVAL_P(file), Z_LVAL_P(line), XDEBUG_BREAK, exception_ce->name, Z_STRVAL_P(message))) {
                                         XG(remote_enabled) = 0;
                                 }
                         }
@@ -2178,7 +2178,7 @@
         if (XG(remote_enabled)) {
                 if (xdebug_hash_find(XG(context).exception_breakpoints, error_type_str, strlen(error_type_str), (void *) &extra_brk_info)) {
                         if (handle_hit_value(extra_brk_info)) {
- if (!XG(context).handler->remote_error(&(XG(context)), 0, error_type_str, buffer, error_filename, error_lineno, XG(stack))) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), error_filename, error_lineno, XDEBUG_BREAK, error_type_str, buffer)) {
                                         XG(remote_enabled) = 0;
                                 }
                         }
@@ -2580,7 +2580,7 @@
                 file = zend_get_executed_filename(TSRMLS_C);
                 lineno = zend_get_executed_lineno(TSRMLS_C);
 
- if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK)) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK, NULL, NULL)) {
                         XG(remote_enabled) = 0;
                 }
                 RETURN_TRUE;
@@ -2868,7 +2868,7 @@
                 if (XG(context).do_break) {
                         XG(context).do_break = 0;
 
- if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK)) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK, NULL, NULL)) {
                                 XG(remote_enabled) = 0;
                                 return;
                         }
@@ -2886,21 +2886,21 @@
                 if (XG(context).do_finish && XG(context).next_level == level) { /* Check for "finish" */
                         XG(context).do_finish = 0;
 
- if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP)) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP, NULL, NULL)) {
                                 XG(remote_enabled) = 0;
                                 return;
                         }
                 } else if (XG(context).do_next && XG(context).next_level >= level) { /* Check for "next" */
                         XG(context).do_next = 0;
 
- if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP)) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP, NULL, NULL)) {
                                 XG(remote_enabled) = 0;
                                 return;
                         }
                 } else if (XG(context).do_step) { /* Check for "step" */
                         XG(context).do_step = 0;
 
- if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP)) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_STEP, NULL, NULL)) {
                                 XG(remote_enabled) = 0;
                                 return;
                         }
@@ -2947,7 +2947,7 @@
                                                 EG(error_reporting) = old_error_reporting;
                                         }
                                         if (break_ok && handle_hit_value(brk)) {
- if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK)) {
+ if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK, NULL, NULL)) {
                                                         XG(remote_enabled) = 0;
                                                         break;
                                                 }

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- xdebug/xdebug_handler_dbgp.c:1.116 Sun Jan 14 16:00:58 2007 GMT
+++ xdebug/xdebug_handler_dbgp.c Mon Feb 26 13:43:30 2007 GMT
@@ -1228,6 +1228,8 @@
         xdebug_xml_node *message;
 
         message = xdebug_xml_node_init("stream");
+ xdebug_xml_add_attribute(message, "xmlns", "urn:debugger_protocol_v1");
+ xdebug_xml_add_attribute(message, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug");
         xdebug_xml_add_attribute_ex(message, "type", (char *)name, 0, 0);
         xdebug_xml_add_text_encodel(message, xdstrndup(str, str_length), str_length);
         send_message(&XG(context), message TSRMLS_CC);
@@ -2178,7 +2180,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.116 $";
+ return "$Revision: 1.117 $";
 }
 
 static int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
@@ -2194,6 +2196,8 @@
                 }
 
                 response = xdebug_xml_node_init("response");
+ xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1");
+ xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug");
                 ret = xdebug_dbgp_parse_option(context, option, 0, response TSRMLS_CC);
                 if (ret != 1) {
                         send_message(context, response TSRMLS_CC);
@@ -2238,6 +2242,8 @@
         }
 
         response = xdebug_xml_node_init("init");
+ xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1");
+ xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug");
 
 /* {{{ XML Init Stuff*/
         child = xdebug_xml_node_init("engine");
@@ -2329,6 +2335,8 @@
         XG(status) = DBGP_STATUS_STOPPED;
         XG(reason) = DBGP_REASON_OK;
         response = xdebug_xml_node_init("response");
+ xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1");
+ xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug");
         /* lastcmd and lasttransid are not always set (for example when the
          * connection is severed before the first command is send) */
         if (XG(lastcmd) && XG(lasttransid)) {
@@ -2414,6 +2422,8 @@
 */
 
         response = xdebug_xml_node_init("response");
+ xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1");
+ xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug");
         xdebug_xml_add_attribute_ex(response, "command", XG(lastcmd), 0, 0);
         xdebug_xml_add_attribute_ex(response, "transaction_id", XG(lasttransid), 0, 0);
         xdebug_xml_add_attribute(response, "status", xdebug_dbgp_status_strings[XG(status)]);
@@ -2436,20 +2446,37 @@
         return 1;
 }
 
-int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type)
+int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, const char *file, long lineno, int type, char *exception, char *message)
 {
- xdebug_xml_node *response;
+ xdebug_xml_node *response, *error_container;
         TSRMLS_FETCH();
 
         XG(status) = DBGP_STATUS_BREAK;
         XG(reason) = DBGP_REASON_OK;
 
         response = xdebug_xml_node_init("response");
+ xdebug_xml_add_attribute(response, "xmlns", "urn:debugger_protocol_v1");
+ xdebug_xml_add_attribute(response, "xmlns:xdebug", "http://xdebug.org/dbgp/xdebug");
         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_container = xdebug_xml_node_init("xdebug:message");
+ if (file) {
+ xdebug_xml_add_attribute_ex(error_container, "filename", xdstrdup(file), 0, 1);
+ }
+ if (lineno) {
+ xdebug_xml_add_attribute_ex(error_container, "lineno", xdebug_sprintf("%lu", lineno), 0, 1);
+ }
+ if (exception) {
+ xdebug_xml_add_attribute_ex(error_container, "exception", xdstrdup(exception), 0, 1);
+ }
+ if (message) {
+ xdebug_xml_add_text(error_container, xdstrdup(message));
+ }
+ xdebug_xml_add_child(response, error_container);
+
         send_message(context, response TSRMLS_CC);
         xdebug_xml_node_dtor(response);
 

[FILE: /xdebug/xdebug_handler_dbgp.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- xdebug/xdebug_handler_dbgp.h:1.19 Thu Dec 28 21:58:37 2006 GMT
+++ xdebug/xdebug_handler_dbgp.h Mon Feb 26 13:43:30 2007 GMT
@@ -90,7 +90,7 @@
 int xdebug_dbgp_init(xdebug_con *context, int mode);
 int xdebug_dbgp_deinit(xdebug_con *context);
 int xdebug_dbgp_error(xdebug_con *context, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack);
-int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type);
+int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, const char *file, long lineno, int type, char *exception, char *message);
 int xdebug_dbgp_register_eval_id(xdebug_con *context, function_stack_entry *fse);
 int xdebug_dbgp_unregister_eval_id(xdebug_con *context, function_stack_entry *fse, int eval_id);
 char *xdebug_dbgp_get_revision(void);

[FILE: /xdebug/xdebug_handler_gdb.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- xdebug/xdebug_handler_gdb.c:1.85 Sun Jan 14 16:00:59 2007 GMT
+++ xdebug/xdebug_handler_gdb.c Mon Feb 26 13:43:30 2007 GMT
@@ -421,7 +421,7 @@
         }
 }
 
-static void print_sourceline(xdebug_con *h, char *file, int begin, int end, int offset, int response_format TSRMLS_DC)
+static void print_sourceline(xdebug_con *h, const char *file, int begin, int end, int offset, int response_format TSRMLS_DC)
 {
         int fd;
         fd_buf fd_buffer = { NULL, 0 };
@@ -1341,7 +1341,7 @@
 
 char *xdebug_gdb_get_revision(void)
 {
- return "$Revision: 1.85 $";
+ return "$Revision: 1.86 $";
 }
 
 int xdebug_gdb_init(xdebug_con *context, int mode)
@@ -1453,7 +1453,7 @@
         return 1;
 }
 
-int xdebug_gdb_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type)
+int xdebug_gdb_breakpoint(xdebug_con *context, xdebug_llist *stack, const char *file, long lineno, int type, char *exception_type, char *message)
 {
         function_stack_entry *i;
         int ret;

[FILE: /xdebug/xdebug_handler_gdb.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- xdebug/xdebug_handler_gdb.h:1.30 Thu Dec 28 21:58:37 2006 GMT
+++ xdebug/xdebug_handler_gdb.h Mon Feb 26 13:43:30 2007 GMT
@@ -73,7 +73,7 @@
 int xdebug_gdb_init(xdebug_con *context, int mode);
 int xdebug_gdb_deinit(xdebug_con *context);
 int xdebug_gdb_error(xdebug_con *context, int type, char *exception_type, char *message, const char *file, const uint lineno, xdebug_llist *stack);
-int xdebug_gdb_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type);
+int xdebug_gdb_breakpoint(xdebug_con *context, xdebug_llist *stack, const char *file, long lineno, int type, char *exception_type, char *message);
 char *xdebug_gdb_get_revision(void);
 
 #define xdebug_handler_gdb { \

[FILE: /xdebug/xdebug_handlers.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- xdebug/xdebug_handlers.h:1.35 Thu Dec 28 21:58:37 2006 GMT
+++ xdebug/xdebug_handlers.h Mon Feb 26 13:43:30 2007 GMT
@@ -112,7 +112,7 @@
         int (*remote_error)(xdebug_con *h, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack);
 
         /* Breakpoints */
- int (*remote_breakpoint)(xdebug_con *h, xdebug_llist *stack, char *file, long lineno, int type);
+ int (*remote_breakpoint)(xdebug_con *h, xdebug_llist *stack, const char *file, long lineno, int type, char *exception, char *message);
 
         /* Eval ID registration and removal */
         int (*register_eval_id)(xdebug_con *h, function_stack_entry *fse);
Received on Mon Feb 26 2007 - 15:43:35 GMT

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