[xdebug-dev] xdebug xdebug/xdebug_handler_dbgp.c - Fixed issues with recognizing eval'ed statements in the top scope of the

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sat, 26 May 2007 21:55:44 +0200

Date: Sat May 26 21:55:43 CEST 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[2.00]
- Fixed issues with recognizing eval'ed statements in the top scope of the
  script. This might address issue #270.

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

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- xdebug/xdebug_handler_dbgp.c:1.119 Wed Apr 04 09:11:04 2007 GMT
+++ xdebug/xdebug_handler_dbgp.c Sat May 26 17:55:43 2007 GMT
@@ -674,14 +674,17 @@
 }
 
 
-static int check_evaled_code(function_stack_entry *fse, char **filename, int *lineno TSRMLS_DC)
+static int check_evaled_code(function_stack_entry *fse, char **filename, int *lineno, int use_fse TSRMLS_DC)
 {
         char *end_marker;
         xdebug_eval_info *ei;
+ char *filename_to_use;
 
- end_marker = fse->filename + strlen(fse->filename) - strlen("eval()'d code");
+ filename_to_use = use_fse ? fse->filename : *filename;
+
+ end_marker = filename_to_use + strlen(filename_to_use) - strlen("eval()'d code");
         if (strcmp("eval()'d code", end_marker) == 0) {
- if (xdebug_hash_find(XG(context).eval_id_lookup, fse->filename, strlen(fse->filename), (void *) &ei)) {
+ if (xdebug_hash_find(XG(context).eval_id_lookup, filename_to_use, strlen(filename_to_use), (void *) &ei)) {
                         *filename = xdebug_sprintf("dbgp://%lu", ei->id);
                 }
                 return 1;
@@ -706,7 +709,7 @@
         xdebug_xml_add_attribute_ex(tmp, "where", xdstrdup(tmp_fname), 0, 1);
         xdebug_xml_add_attribute_ex(tmp, "level", xdebug_sprintf("%ld", nr), 0, 1);
         if (fse_prev) {
- if (check_evaled_code(fse_prev, &tmp_filename, &tmp_lineno TSRMLS_CC)) {
+ if (check_evaled_code(fse_prev, &tmp_filename, &tmp_lineno, 1 TSRMLS_CC)) {
                         xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("eval"), 0, 1);
                         xdebug_xml_add_attribute_ex(tmp, "filename", tmp_filename, 0, 0);
                 } else {
@@ -715,9 +718,16 @@
                 }
                 xdebug_xml_add_attribute_ex(tmp, "lineno", xdebug_sprintf("%lu", fse_prev->lineno TSRMLS_CC), 0, 1);
         } else {
- xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("file"), 0, 1);
- xdebug_xml_add_attribute_ex(tmp, "filename", xdebug_path_to_url(zend_get_executed_filename(TSRMLS_C) TSRMLS_CC), 0, 1);
- xdebug_xml_add_attribute_ex(tmp, "lineno", xdebug_sprintf("%lu", zend_get_executed_lineno(TSRMLS_C)), 0, 1);
+ tmp_filename = zend_get_executed_filename(TSRMLS_C);
+ tmp_lineno = zend_get_executed_lineno(TSRMLS_C);
+ if (check_evaled_code(fse, &tmp_filename, &tmp_lineno, 0 TSRMLS_CC)) {
+ xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("eval"), 0, 1);
+ xdebug_xml_add_attribute_ex(tmp, "filename", tmp_filename, 0, 0);
+ } else {
+ xdebug_xml_add_attribute_ex(tmp, "type", xdstrdup("file"), 0, 1);
+ xdebug_xml_add_attribute_ex(tmp, "filename", xdebug_path_to_url(tmp_filename), 0, 1);
+ }
+ xdebug_xml_add_attribute_ex(tmp, "lineno", xdebug_sprintf("%lu", tmp_lineno), 0, 1);
         }
 
         xdfree(tmp_fname);
@@ -2183,7 +2193,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.119 $";
+ return "$Revision: 1.120 $";
 }
 
 static int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
@@ -2472,7 +2482,13 @@
 
         error_container = xdebug_xml_node_init("xdebug:message");
         if (file) {
- xdebug_xml_add_attribute_ex(error_container, "filename", xdstrdup(file), 0, 1);
+ char *tmp_filename = file;
+ int tmp_lineno = lineno;
+ if (check_evaled_code(NULL, &tmp_filename, &tmp_lineno, 0 TSRMLS_CC)) {
+ xdebug_xml_add_attribute_ex(error_container, "filename", xdstrdup(tmp_filename), 0, 1);
+ } else {
+ 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);
Received on Sat May 26 2007 - 21:55:45 BST

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