Permalink
Browse files

- Move the allocation defines into xdebug_mm.h

- Lower case the XDEBUG_STR_* functions

SVN Rev: 877
  • Loading branch information...
1 parent 01afa4d commit 2e0eed5d4c6aac205b7912a296d0b9e27a1bfdcf @derickr derickr committed Oct 12, 2003
Showing with 324 additions and 212 deletions.
  1. +2 −2 Makefile.in
  2. +2 −2 config.m4
  3. +3 −0 package.xml
  4. +0 −15 php_xdebug.h
  5. +1 −0 usefulstuff.c
  6. +20 −19 xdebug.c
  7. +12 −0 xdebug.dsp
  8. +9 −0 xdebug.mak
  9. +9 −0 xdebug_4_3.mak
  10. +1 −0 xdebug_code_coverage.h
  11. +2 −1 xdebug_handler_dbgp.c
  12. +9 −9 xdebug_handler_gdb.c
  13. +2 −1 xdebug_handler_gdb.h
  14. +2 −1 xdebug_handler_php3.c
  15. +2 −1 xdebug_handlers.c
  16. +37 −0 xdebug_mm.h
  17. +1 −0 xdebug_profiler.c
  18. +103 −0 xdebug_str.c
  19. +37 −0 xdebug_str.h
  20. +69 −149 xdebug_var.c
  21. +1 −12 xdebug_var.h
View
@@ -1,7 +1,7 @@
-# $Id: Makefile.in,v 1.10 2003-10-07 10:56:42 derick Exp $
+# $Id: Makefile.in,v 1.11 2003-10-12 14:28:58 derick Exp $
LTLIBRARY_NAME = libxdebug.la
-LTLIBRARY_SOURCES = xdebug.c xdebug_com.c xdebug_llist.c xdebug_hash.c xdebug_var.c xdebug_handlers.c xdebug_handler_dbgp.c xdebug_handler_php3.c xdebug_handler_gdb.c usefulstuff.c xdebug_profiler.c
+LTLIBRARY_SOURCES = xdebug.c xdebug_com.c xdebug_llist.c xdebug_hash.c xdebug_handlers.c xdebug_handler_dbgp.c xdebug_handler_php3.c xdebug_handler_gdb.c usefulstuff.c xdebug_str.c xdebug_var.c xdebug_profiler.c
LTLIBRARY_SHARED_NAME = xdebug.la
LTLIBRARY_SHARED_LIBADD = $(XDEBUG_SHARED_LIBADD)
View
@@ -1,11 +1,11 @@
-dnl $Id: config.m4,v 1.15 2003-10-07 10:56:42 derick Exp $
+dnl $Id: config.m4,v 1.16 2003-10-12 14:28:58 derick Exp $
dnl config.m4 for extension xdebug
PHP_ARG_ENABLE(xdebug, whether to enable eXtended debugging support,
[ --enable-xdebug Enable Xdebug support])
if test "$PHP_XDEBUG" != "no"; then
- PHP_NEW_EXTENSION(xdebug, xdebug.c xdebug_code_coverage.c xdebug_com.c xdebug_handler_dbgp.c xdebug_handler_gdb.c xdebug_handler_php3.c xdebug_handlers.c xdebug_llist.c xdebug_hash.c xdebug_profiler.c xdebug_superglobals.c xdebug_var.c usefulstuff.c, $ext_shared)
+ PHP_NEW_EXTENSION(xdebug, xdebug.c xdebug_code_coverage.c xdebug_com.c xdebug_handler_dbgp.c xdebug_handler_gdb.c xdebug_handler_php3.c xdebug_handlers.c xdebug_llist.c xdebug_hash.c xdebug_profiler.c xdebug_str.c xdebug_superglobals.c xdebug_var.c usefulstuff.c, $ext_shared)
AC_DEFINE(HAVE_XDEBUG,1,[ ])
dnl Check for new current_execute_data field in zend_executor_globals
View
@@ -86,8 +86,11 @@ Xdebug also provides:
<file role="src" name="xdebug_hash.h"/>
<file role="src" name="xdebug_llist.c"/>
<file role="src" name="xdebug_llist.h"/>
+ <file role="src" name="xdebug_mm.h"/>
<file role="src" name="xdebug_profiler.c"/>
<file role="src" name="xdebug_profiler.h"/>
+ <file role="src" name="xdebug_str.c"/>
+ <file role="src" name="xdebug_str.h"/>
<file role="src" name="xdebug_superglobals.c"/>
<file role="src" name="xdebug_superglobals.h"/>
<file role="src" name="xdebug_var.c"/>
View
@@ -42,21 +42,6 @@ extern zend_module_entry xdebug_module_entry;
#include "TSRM.h"
#endif
-/* Memory allocators */
-#if 0
-#define xdmalloc emalloc
-#define xdcalloc ecalloc
-#define xdrealloc erealloc
-#define xdfree efree
-#define xdstrdup estrdup
-#else
-#define xdmalloc malloc
-#define xdcalloc calloc
-#define xdrealloc realloc
-#define xdfree free
-#define xdstrdup strdup
-#endif
-
PHP_MINIT_FUNCTION(xdebug);
PHP_MSHUTDOWN_FUNCTION(xdebug);
PHP_RINIT_FUNCTION(xdebug);
View
@@ -27,6 +27,7 @@
#include <io.h>
#endif
#include "php_xdebug.h"
+#include "xdebug_mm.h"
#include "usefulstuff.h"
#define READ_BUFFER_SIZE 128
View
@@ -53,6 +53,7 @@
#include "xdebug_code_coverage.h"
#include "xdebug_com.h"
#include "xdebug_llist.h"
+#include "xdebug_mm.h"
#include "xdebug_var.h"
#include "xdebug_profiler.h"
#include "xdebug_superglobals.h"
@@ -1027,26 +1028,26 @@ static char* return_trace_stack_frame(function_stack_entry* i, int html TSRMLS_D
if (html) {
/* Start row */
- XDEBUG_STR_ADDL(&str, "<tr>", 4, 0);
+ xdebug_str_addl(&str, "<tr>", 4, 0);
/* Do timestamp */
- XDEBUG_STR_ADD(&str, "<td bgcolor='#ffffff' align='center'>", 0);
- XDEBUG_STR_ADD(&str, xdebug_sprintf("%.6f", i->time - XG(start_time)), 1);
- XDEBUG_STR_ADDL(&str, "</td>", 5, 0);
+ xdebug_str_add(&str, "<td bgcolor='#ffffff' align='center'>", 0);
+ xdebug_str_add(&str, xdebug_sprintf("%.6f", i->time - XG(start_time)), 1);
+ xdebug_str_addl(&str, "</td>", 5, 0);
/* Do rest of line */
- XDEBUG_STR_ADD(&str, "<td bgcolor='#ffffff' align='left'><pre>", 0);
+ xdebug_str_add(&str, "<td bgcolor='#ffffff' align='left'><pre>", 0);
for (j = 0; j < i->level - 1; j++) {
- XDEBUG_STR_ADDL(&str, " ", 2, 0);
+ xdebug_str_addl(&str, " ", 2, 0);
}
- XDEBUG_STR_ADD(&str, xdebug_sprintf("-></pre></td><td bgcolor='#ffffff'>%s(", tmp_name), 1);
+ xdebug_str_add(&str, xdebug_sprintf("-></pre></td><td bgcolor='#ffffff'>%s(", tmp_name), 1);
} else {
- XDEBUG_STR_ADD(&str, xdebug_sprintf("%10.4f ", i->time - XG(start_time)), 1);
- XDEBUG_STR_ADD(&str, xdebug_sprintf("%10lu ", i->memory), 1);
+ xdebug_str_add(&str, xdebug_sprintf("%10.4f ", i->time - XG(start_time)), 1);
+ xdebug_str_add(&str, xdebug_sprintf("%10lu ", i->memory), 1);
for (j = 0; j < i->level; j++) {
- XDEBUG_STR_ADDL(&str, " ", 2, 0);
+ xdebug_str_addl(&str, " ", 2, 0);
}
- XDEBUG_STR_ADD(&str, xdebug_sprintf("-> %s(", tmp_name), 1);
+ xdebug_str_add(&str, xdebug_sprintf("-> %s(", tmp_name), 1);
}
xdfree(tmp_name);
@@ -1055,32 +1056,32 @@ static char* return_trace_stack_frame(function_stack_entry* i, int html TSRMLS_D
char *tmp_varname;
if (c) {
- XDEBUG_STR_ADDL(&str, ", ", 2, 0);
+ xdebug_str_addl(&str, ", ", 2, 0);
} else {
c = 1;
}
tmp_varname = i->vars[j].name ? xdebug_sprintf("$%s = ", i->vars[j].name) : xdstrdup("");
- XDEBUG_STR_ADD(&str, tmp_varname, 1);
+ xdebug_str_add(&str, tmp_varname, 1);
if (html) {
- XDEBUG_STR_ADD(&str, php_escape_html_entities(i->vars[j].value, strlen(i->vars[j].value), &new_len, 1, 1, NULL TSRMLS_CC), 0);
+ xdebug_str_add(&str, php_escape_html_entities(i->vars[j].value, strlen(i->vars[j].value), &new_len, 1, 1, NULL TSRMLS_CC), 0);
} else {
- XDEBUG_STR_ADD(&str, i->vars[j].value, 0);
+ xdebug_str_add(&str, i->vars[j].value, 0);
}
}
if (html) {
/* Do filename and line no */
- XDEBUG_STR_ADD(&str, xdebug_sprintf(")</td><td bgcolor='#ffffff'>%s<b>:</b>%d</td>", i->filename, i->lineno), 1);
+ xdebug_str_add(&str, xdebug_sprintf(")</td><td bgcolor='#ffffff'>%s<b>:</b>%d</td>", i->filename, i->lineno), 1);
#if MEMORY_LIMIT
/* Do memory */
- XDEBUG_STR_ADD(&str, xdebug_sprintf("<td bgcolor='#ffffff' align='right'>%lu</td>", i->memory), 1);
+ xdebug_str_add(&str, xdebug_sprintf("<td bgcolor='#ffffff' align='right'>%lu</td>", i->memory), 1);
#endif
/* Close row */
- XDEBUG_STR_ADD(&str, xdebug_sprintf("</tr>\n"), 0);
+ xdebug_str_add(&str, xdebug_sprintf("</tr>\n"), 0);
} else {
- XDEBUG_STR_ADD(&str, xdebug_sprintf(") %s:%d\n", i->filename, i->lineno), 1);
+ xdebug_str_add(&str, xdebug_sprintf(") %s:%d\n", i->filename, i->lineno), 1);
}
return str.d;
View
@@ -135,6 +135,10 @@ SOURCE=.\xdebug_llist.c
# End Source File
# Begin Source File
+SOURCE=.\xdebug_str.c
+# End Source File
+# Begin Source File
+
SOURCE=.\xdebug_superglobals.c
# End Source File
# Begin Source File
@@ -191,10 +195,18 @@ SOURCE=.\xdebug_llist.h
# End Source File
# Begin Source File
+SOURCE=.\xdebug_mm.h
+# End Source File
+# Begin Source File
+
SOURCE=.\xdebug_profiler.h
# End Source File
# Begin Source File
+SOURCE=.\xdebug_str.h
+# End Source File
+# Begin Source File
+
SOURCE=.\xdebug_superglobals.h
# End Source File
# Begin Source File
View
@@ -53,6 +53,7 @@ CLEAN :
-@erase "$(INTDIR)\xdebug_hash.obj"
-@erase "$(INTDIR)\xdebug_llist.obj"
-@erase "$(INTDIR)\xdebug_profiler.obj"
+ -@erase "$(INTDIR)\xdebug_str.obj"
-@erase "$(INTDIR)\xdebug_superglobals.obj"
-@erase "$(INTDIR)\xdebug_var.obj"
-@erase "$(OUTDIR)\php_xdebug.dll"
@@ -82,6 +83,7 @@ LINK32_OBJS= \
"$(INTDIR)\xdebug_hash.obj" \
"$(INTDIR)\xdebug_llist.obj" \
"$(INTDIR)\xdebug_profiler.obj" \
+ "$(INTDIR)\xdebug_str.obj" \
"$(INTDIR)\xdebug_superglobals.obj" \
"$(INTDIR)\xdebug_var.obj"
@@ -115,6 +117,7 @@ CLEAN :
-@erase "$(INTDIR)\xdebug_hash.obj"
-@erase "$(INTDIR)\xdebug_llist.obj"
-@erase "$(INTDIR)\xdebug_profiler.obj"
+ -@erase "$(INTDIR)\xdebug_str.obj"
-@erase "$(INTDIR)\xdebug_superglobals.obj"
-@erase "$(INTDIR)\xdebug_var.obj"
-@erase "$(OUTDIR)\php_xdebug.dll"
@@ -146,6 +149,7 @@ LINK32_OBJS= \
"$(INTDIR)\xdebug_hash.obj" \
"$(INTDIR)\xdebug_llist.obj" \
"$(INTDIR)\xdebug_profiler.obj" \
+ "$(INTDIR)\xdebug_str.obj" \
"$(INTDIR)\xdebug_superglobals.obj" \
"$(INTDIR)\xdebug_var.obj"
@@ -252,6 +256,11 @@ SOURCE=.\xdebug_profiler.c
"$(INTDIR)\xdebug_profiler.obj" : $(SOURCE) "$(INTDIR)"
+SOURCE=.\xdebug_str.c
+
+"$(INTDIR)\xdebug_str.obj" : $(SOURCE) "$(INTDIR)"
+
+
SOURCE=.\xdebug_superglobals.c
"$(INTDIR)\xdebug_superglobals.obj" : $(SOURCE) "$(INTDIR)"
View
@@ -53,6 +53,7 @@ CLEAN :
-@erase "$(INTDIR)\xdebug_hash.obj"
-@erase "$(INTDIR)\xdebug_llist.obj"
-@erase "$(INTDIR)\xdebug_profiler.obj"
+ -@erase "$(INTDIR)\xdebug_str.obj"
-@erase "$(INTDIR)\xdebug_superglobals.obj"
-@erase "$(INTDIR)\xdebug_var.obj"
-@erase "$(OUTDIR)\php_xdebug.dll"
@@ -82,6 +83,7 @@ LINK32_OBJS= \
"$(INTDIR)\xdebug_hash.obj" \
"$(INTDIR)\xdebug_llist.obj" \
"$(INTDIR)\xdebug_profiler.obj" \
+ "$(INTDIR)\xdebug_str.obj" \
"$(INTDIR)\xdebug_superglobals.obj" \
"$(INTDIR)\xdebug_var.obj"
@@ -115,6 +117,7 @@ CLEAN :
-@erase "$(INTDIR)\xdebug_hash.obj"
-@erase "$(INTDIR)\xdebug_llist.obj"
-@erase "$(INTDIR)\xdebug_profiler.obj"
+ -@erase "$(INTDIR)\xdebug_str.obj"
-@erase "$(INTDIR)\xdebug_superglobals.obj"
-@erase "$(INTDIR)\xdebug_var.obj"
-@erase "$(OUTDIR)\php_xdebug.dll"
@@ -146,6 +149,7 @@ LINK32_OBJS= \
"$(INTDIR)\xdebug_hash.obj" \
"$(INTDIR)\xdebug_llist.obj" \
"$(INTDIR)\xdebug_profiler.obj" \
+ "$(INTDIR)\xdebug_str.obj" \
"$(INTDIR)\xdebug_superglobals.obj" \
"$(INTDIR)\xdebug_var.obj"
@@ -252,6 +256,11 @@ SOURCE=.\xdebug_profiler.c
"$(INTDIR)\xdebug_profiler.obj" : $(SOURCE) "$(INTDIR)"
+SOURCE=.\xdebug_str.c
+
+"$(INTDIR)\xdebug_str.obj" : $(SOURCE) "$(INTDIR)"
+
+
SOURCE=.\xdebug_superglobals.c
"$(INTDIR)\xdebug_superglobals.obj" : $(SOURCE) "$(INTDIR)"
View
@@ -21,6 +21,7 @@
#include "php.h"
#include "xdebug_hash.h"
+#include "xdebug_mm.h"
typedef struct xdebug_coverage_line {
int lineno;
View
@@ -23,8 +23,9 @@
#include "php_globals.h"
#include "php_xdebug.h"
#include "xdebug_com.h"
-#include "xdebug_llist.h"
#include "xdebug_handler_dbgp.h"
+#include "xdebug_llist.h"
+#include "xdebug_mm.h"
#include "xdebug_var.h"
#ifdef PHP_WIN32
View
@@ -721,14 +721,14 @@ char *xdebug_handle_breakpoint(xdebug_con *context, xdebug_arg *args)
/* If there are more second parameters to the "break" command, then we
* concat them and use it as a conditional statement */
if (args->c > 1) {
- XDEBUG_STR_ADD(&eval, args->args[1], 0);
+ xdebug_str_add(&eval, args->args[1], 0);
for (i = 2; i < args->c; i++) {
- XDEBUG_STR_ADD(&eval, " ", 0);
- XDEBUG_STR_ADD(&eval, args->args[i], 0);
+ xdebug_str_add(&eval, " ", 0);
+ xdebug_str_add(&eval, args->args[i], 0);
}
extra_brk_info->condition = xdstrdup(eval.d);
- XDEBUG_STR_FREE(&eval);
+ xdebug_str_free(&eval);
}
/* Add breakpoint to the list */
@@ -847,21 +847,21 @@ char *xdebug_handle_eval(xdebug_con *context, xdebug_arg *args)
EG(error_reporting) = 0;
/* Concat all arguments back together */
- XDEBUG_STR_ADD(&buffer, args->args[0], 0);
+ xdebug_str_add(&buffer, args->args[0], 0);
for (i = 1; i < args->c; i++) {
- XDEBUG_STR_ADD(&buffer, " ", 0);
- XDEBUG_STR_ADD(&buffer, args->args[i], 0);
+ xdebug_str_add(&buffer, " ", 0);
+ xdebug_str_add(&buffer, args->args[i], 0);
}
XG(breakpoints_allowed) = 0;
if (zend_eval_string(buffer.d, &retval, "xdebug eval" TSRMLS_CC) == FAILURE) {
- XDEBUG_STR_FREE(&buffer);
+ xdebug_str_free(&buffer);
EG(error_reporting) = old_error_reporting;
XG(breakpoints_allowed) = 1;
return make_message(context, XDEBUG_E_EVAL, "Error evaluating code");
} else {
- XDEBUG_STR_FREE(&buffer);
+ xdebug_str_free(&buffer);
EG(error_reporting) = old_error_reporting;
ret_value = get_variable(context, NULL, &retval);
SENDMSG(context->socket, xdebug_sprintf("%s\n", ret_value));
View
@@ -19,8 +19,9 @@
#ifndef __HAVE_XDEBUG_HANDLER_GDB_H__
#define __HAVE_XDEBUG_HANDLER_GDB_H__
-#include "xdebug_handlers.h"
#include <string.h>
+#include "xdebug_handlers.h"
+#include "xdebug_mm.h"
#define XDEBUG_INIT 1
#define XDEBUG_BREAKPOINT 2
View
@@ -21,8 +21,9 @@
#include "php_globals.h"
#include "php_xdebug.h"
#include "xdebug_com.h"
-#include "xdebug_llist.h"
#include "xdebug_handler_php3.h"
+#include "xdebug_llist.h"
+#include "xdebug_mm.h"
#include "xdebug_var.h"
#ifdef PHP_WIN32
View
@@ -16,12 +16,13 @@
+----------------------------------------------------------------------+
*/
-#include "xdebug_com.h"
#include "php_xdebug.h"
+#include "xdebug_com.h"
#include "xdebug_handlers.h"
#include "xdebug_handler_dbgp.h"
#include "xdebug_handler_gdb.h"
#include "xdebug_handler_php3.h"
+#include "xdebug_mm.h"
xdebug_remote_handler_info handlers[] = {
{ "dbgp", "DBGp - Common DeBuGger Protocol", xdebug_handler_dbgp },
Oops, something went wrong.

0 comments on commit 2e0eed5

Please sign in to comment.