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
__archive__
oharboe 2009-09-14 13:54:49 +00:00
parent 5a6980869b
commit 14dc22612b
1 changed files with 22 additions and 0 deletions

View File

@ -134,7 +134,29 @@ proc ocd_gdb_restart {target_id} {
reset halt reset halt
} }
global in_process_reset
set in_process_reset 0
# Catch reset recursion
proc ocd_process_reset { MODE } { 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... # If this target must be halted...
set halt -1 set halt -1