]> git.sur5r.net Git - openocd/commitdiff
error message upon recursive invocation of reset from reset event handlers
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 14 Sep 2009 13:54:49 +0000 (13:54 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 14 Sep 2009 13:54:49 +0000 (13:54 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2707 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/helper/startup.tcl

index ba044be28d4f49c8533a7af3dc28ccaad14b7762..3eb7419ffc6eb676da884aac9c2f27613db25d92 100644 (file)
@@ -134,7 +134,29 @@ proc ocd_gdb_restart {target_id} {
        reset halt
 }
 
+global in_process_reset
+set in_process_reset 0
+
+# Catch reset recursion
 proc ocd_process_reset { MODE } {
+       global in_process_reset
+       if {$in_process_reset} {
+               set in_process_reset 0
+               return -code error "'reset' can not be invoked recursively"
+       }
+       
+       set in_process_reset 1
+       set success [expr [catch {ocd_process_reset_inner $MODE} result]==0] 
+       set in_process_reset 0
+       
+       if {$success} {
+               return $result
+       } else {
+               return -code error $result
+       }
+}
+
+proc ocd_process_reset_inner { MODE } {
 
        # If this target must be halted...
        set halt -1