[xdebug-general] Temporary breakpoints

From: Damjan Cvetko <zobo[@]scene-si.org>
Date: Sun, 09 Dec 2007 10:55:11 +0100

Hi.
I opened a bug some time ago, says that temporary breakpoints are not
implemented. I see that this kind of breakpoints are quite useful for
"run to cursor". Here's a patch, that does the job.

Best regards,
-Zobo

Index: xdebug.c
===================================================================
RCS file: /repository/xdebug/xdebug.c,v
retrieving revision 1.408
diff -u -r1.408 xdebug.c
--- xdebug.c 11 Oct 2007 00:54:09 -0000 1.408
+++ xdebug.c 11 Oct 2007 18:08:52 -0000
@@ -1273,6 +1273,8 @@
         /* Increase hit counter */
         brk_info->hit_count++;
 
+ if (brk_info->temporary && brk_info->deleted == 1) return 0;
+ if (brk_info->temporary) brk_info->deleted = 1;
         /* If the hit_value is 0, the condition check is disabled */
         if (!brk_info->hit_value) {
                 return 1;
@@ -1298,6 +1300,7 @@
                         return 1;
                         break;
         }
+ if (brk_info->temporary) brk_info->deleted = 0;
         return 0;
 }
 
Index: xdebug_handler_dbgp.c
===================================================================
RCS file: /repository/xdebug/xdebug_handler_dbgp.c,v
retrieving revision 1.128
diff -u -r1.128 xdebug_handler_dbgp.c
--- xdebug_handler_dbgp.c 24 Aug 2007 01:37:54 -0000 1.128
+++ xdebug_handler_dbgp.c 11 Oct 2007 18:08:53 -0000
@@ -1047,6 +1047,7 @@
 
         child = xdebug_xml_node_init("breakpoint");
         brk = breakpoint_brk_info_fetch(admin->type, admin->key);
+ if (brk->deleted) return;
         breakpoint_brk_info_add(child, brk);
         xdebug_xml_add_attribute_ex(child, "id", xdebug_sprintf("%lu", admin->id), 0, 1);
         xdebug_xml_add_child(xml_node, child);
@@ -1081,6 +1082,7 @@
         brk_info->hit_count = 0;
         brk_info->hit_value = 0;
         brk_info->hit_condition = XDEBUG_HIT_DISABLED;
+ brk_info->deleted = 0;
 
         if (!CMD_OPTION('t')) {
                 RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS);
@@ -1096,6 +1098,9 @@
                 BREAKPOINT_CHANGE_OPERATOR();
                 brk_info->hit_value = strtol(CMD_OPTION('h'), NULL, 10);
         }
+ if (CMD_OPTION('r')) {
+ brk_info->temporary = 1;
+ }
 
         if (strcmp(CMD_OPTION('t'), "line") == 0) {
                 if (!CMD_OPTION('n')) {
Index: xdebug_handler_gdb.c
===================================================================
RCS file: /repository/xdebug/xdebug_handler_gdb.c,v
retrieving revision 1.87
diff -u -r1.87 xdebug_handler_gdb.c
--- xdebug_handler_gdb.c 9 Mar 2007 12:35:37 -0000 1.87
+++ xdebug_handler_gdb.c 11 Oct 2007 18:08:53 -0000
@@ -658,6 +658,7 @@
         extra_brk_info->hit_value = 0;
         extra_brk_info->hit_condition = XDEBUG_HIT_DISABLED;
         extra_brk_info->function_break_type = XDEBUG_BRK_FUNC_CALL;
+ extra_brk_info->deleted = 0;
 
         if (strstr(args->args[0], "::")) { /* class::method */
                 xdebug_explode("::", args->args[0], method, -1);
Index: xdebug_handlers.h
===================================================================
RCS file: /repository/xdebug/xdebug_handlers.h,v
retrieving revision 1.36
diff -u -r1.36 xdebug_handlers.h
--- xdebug_handlers.h 26 Feb 2007 14:43:30 -0000 1.36
+++ xdebug_handlers.h 11 Oct 2007 18:08:53 -0000
@@ -95,6 +95,7 @@
         int hit_count;
         int hit_value;
         int hit_condition;
+ int deleted;
 };
 
 struct _xdebug_eval_info {
Received on Sun Dec 09 2007 - 10:55:10 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST