When the last sw breakpoint was removed, the ICE breakpoint/watchpoint
unit was not restored.


Comments?

-- 
Øyvind Harboe
Embedded software and hardware consulting services
http://www.zylin.com
### Eclipse Workspace Patch 1.0
#P openocd
Index: src/target/arm7_9_common.c
===================================================================
--- src/target/arm7_9_common.c  (revision 2645)
+++ src/target/arm7_9_common.c  (working copy)
@@ -61,6 +61,7 @@
        LOG_DEBUG("-");
        
embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], 
0x0);
        
embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], 
0x0);
+       arm7_9->sw_breakpoint_count = 0;
        arm7_9->sw_breakpoints_added = 0;
        arm7_9->wp0_used = 0;
        arm7_9->wp1_used = arm7_9->wp1_used_default;
@@ -274,9 +275,6 @@
        }
        else if (breakpoint->type == BKPT_SOFT)
        {
-               if ((retval = arm7_9_set_software_breakpoints(arm7_9)) != 
ERROR_OK)
-                       return retval;
-
                /* did we already set this breakpoint? */
                if (breakpoint->set)
                        return ERROR_OK;
@@ -329,6 +327,12 @@
                                return ERROR_OK;
                        }
                }
+
+               if ((retval = arm7_9_set_software_breakpoints(arm7_9)) != 
ERROR_OK)
+                       return retval;
+
+               arm7_9->sw_breakpoint_count++;
+
                breakpoint->set = 1;
        }
 
@@ -415,6 +419,20 @@
                                        return retval;
                                }
                }
+
+               if (--arm7_9->sw_breakpoint_count==0)
+               {
+                       /* We have removed the last sw breakpoint, clear the hw 
breakpoint we used to implement it */
+                       if (arm7_9->sw_breakpoints_added == 1)
+                       {
+                               
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], 0);
+                       }
+                       else if (arm7_9->sw_breakpoints_added == 2)
+                       {
+                               
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], 0);
+                       }
+               }
+
                breakpoint->set = 0;
        }
 
Index: src/target/arm7_9_common.h
===================================================================
--- src/target/arm7_9_common.h  (revision 2643)
+++ src/target/arm7_9_common.h  (working copy)
@@ -47,6 +47,7 @@
        uint32_t arm_bkpt; /**< ARM breakpoint instruction */
        uint16_t thumb_bkpt; /**< Thumb breakpoint instruction */
        int sw_breakpoints_added; /**< Specifies which watchpoint software 
breakpoints are setup on */
+       int sw_breakpoint_count; /**< keep track of number of software 
breakpoints we have set */
        int breakpoint_count; /**< Current number of set breakpoints */
        int wp_available; /**< Current number of available watchpoint units */
        int wp_available_max; /**< Maximum number of available watchpoint units 
*/
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to