This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for bug2457


Hi,

Here's a simple patch for bug2457 (Incorrect handling of erroneous
breakpoint conditions).

It just postpones the update of the breakpoint condition until it has
been parsed successfully.

If there is a parsing error, the condition is set to NULL.

Best Regards,
/fc
### Eclipse Workspace Patch 1.0
#P gdb
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.321
diff -u -r1.321 breakpoint.c
--- breakpoint.c	4 May 2008 19:38:59 -0000	1.321
+++ breakpoint.c	14 May 2008 17:32:06 -0000
@@ -596,11 +596,13 @@
 	      }
 	  }
 	if (b->cond_string != NULL)
-	  xfree (b->cond_string);
+	  {
+	    xfree (b->cond_string);
+	    b->cond_string = NULL;	/* Keep in sync */
+	  }
 
 	if (*p == 0)
 	  {
-	    b->cond_string = NULL;
 	    if (from_tty)
 	      printf_filtered (_("Breakpoint %d now unconditional.\n"), bnum);
 	  }
@@ -609,7 +611,6 @@
 	    arg = p;
 	    /* I don't know if it matters whether this is the string the user
 	       typed in or the decompiled expression.  */
-	    b->cond_string = savestring (arg, strlen (arg));
 	    b->condition_not_parsed = 0;
 	    for (loc = b->loc; loc; loc = loc->next)
 	      {
@@ -619,6 +620,9 @@
 		if (*arg)
 		  error (_("Junk at end of expression"));
 	      }
+	    /* If we get here, the condition was parsed successfully and
+           no exception was thrown. See bug 2457. */
+	    b->cond_string = savestring (p, strlen (p));
 	  }
 	breakpoints_changed ();
 	breakpoint_modify_event (b->number);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]