diff options
author | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-09-14 13:54:49 +0000 |
---|---|---|
committer | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-09-14 13:54:49 +0000 |
commit | 14dc22612b2997ab536b7f984a3174bb8847b4e8 (patch) | |
tree | 4276b58127d8237f19a43c7a2a25dde39c8ae9a2 | |
parent | 5a6980869b0083ba02953fb062409fd34705c888 (diff) | |
download | openocd_libswd-14dc22612b2997ab536b7f984a3174bb8847b4e8.tar.gz openocd_libswd-14dc22612b2997ab536b7f984a3174bb8847b4e8.tar.bz2 openocd_libswd-14dc22612b2997ab536b7f984a3174bb8847b4e8.tar.xz openocd_libswd-14dc22612b2997ab536b7f984a3174bb8847b4e8.zip |
error message upon recursive invocation of reset from reset event handlers
git-svn-id: svn://svn.berlios.de/openocd/trunk@2707 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/helper/startup.tcl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/helper/startup.tcl b/src/helper/startup.tcl index ba044be2..3eb7419f 100644 --- a/src/helper/startup.tcl +++ b/src/helper/startup.tcl @@ -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 |