- trying to remove a breakpoint with target running should not exit(-1) from OpenOCD
authormlu <mlu@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 9 Aug 2007 09:35:10 +0000 (09:35 +0000)
committermlu <mlu@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 9 Aug 2007 09:35:10 +0000 (09:35 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@189 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/target/breakpoints.c

index ac8d7dfd6e773d21b8f3d057ac00db4744d8ed78..cc38d029b9f13cbb0deed9686379a7bb8855a2db 100644 (file)
@@ -224,8 +224,17 @@ int watchpoint_remove(target_t *target, u32 address)
        {
                if ((retval = target->type->remove_watchpoint(target, watchpoint)) != ERROR_OK)
                {
-                       ERROR("BUG: can't remove watchpoint");
-                       exit(-1);
+                       switch (retval)
+                       {
+                               case ERROR_TARGET_NOT_HALTED:
+                                       INFO("can't remove watchpoint while target is running");
+                                       return retval;
+                                       break;
+                               default:
+                                       ERROR("unknown error");
+                                       exit(-1);
+                                       break;
+                       }
                }
                (*watchpoint_p) = watchpoint->next;
                free(watchpoint);