]> git.sur5r.net Git - openocd/commitdiff
helper: fix arm11 help text
authorSpencer Oliver <spen@spen-soft.co.uk>
Tue, 20 Dec 2011 16:15:52 +0000 (16:15 +0000)
committerSpencer Oliver <spen@spen-soft.co.uk>
Tue, 3 Jan 2012 09:30:14 +0000 (09:30 +0000)
This fixes a long standing bug: see Trac #4
Increased help text recursion limit and added LOG_DEBUG so we can
catch future errors like this.

Change-Id: I5fac95c4486eaddaf1e88a27ecb1835168f87711
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/291
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
src/helper/command.c

index b00a231268cb7fb77f47a2c7dc6b7261e0707e31..552031df063d1614e53e143bb910ac18f57388a3 100644 (file)
@@ -97,7 +97,7 @@ static struct log_capture_state *command_log_capture_start(Jim_Interp *interp)
  * Therefore we set the tcl return value only if we actually
  * captured output.
  */
-static void command_log_capture_finish(struct log_capture_state *state) 
+static void command_log_capture_finish(struct log_capture_state *state)
 {
        if (NULL == state)
                return;
@@ -927,8 +927,10 @@ static COMMAND_HELPER(command_help_show, struct command *c, unsigned n,
                        return -ENOMEM;
        }
 
-       if (++n >= 2)
-               return ERROR_OK;
+       if (++n > 5) {
+               LOG_ERROR("command recursion exceeded");
+               return ERROR_FAIL;
+       }
 
        return CALL_COMMAND_HANDLER(command_help_show_list,
                        c->children, n, show_help, match);