summaryrefslogtreecommitdiff
path: root/src/helper/command.c
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-05-03 17:01:53 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-05-05 15:24:24 +0200
commit91b9f3de0b8e3277ab5c584c6076ddfe491ffc86 (patch)
tree21967095062de948d60d9ffe775217a7a720b7fa /src/helper/command.c
parent7e33f87b3d25331f3ac366c88e0b0ebb196422ec (diff)
downloadopenocd+libswd-91b9f3de0b8e3277ab5c584c6076ddfe491ffc86.tar.gz
openocd+libswd-91b9f3de0b8e3277ab5c584c6076ddfe491ffc86.tar.bz2
openocd+libswd-91b9f3de0b8e3277ab5c584c6076ddfe491ffc86.tar.xz
openocd+libswd-91b9f3de0b8e3277ab5c584c6076ddfe491ffc86.zip
command context: fix errors when running certain commands on startup
Various commands, e.g. "arm mcr xxxx" would fail if invoked upon startup since it there was no command context defined for the jim interpreter in that case. A Jim interpreter is now associated with a command context(telnet, gdb server's) or the default global command context. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/helper/command.c')
-rw-r--r--src/helper/command.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index 3625508f..be262f2e 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -167,14 +167,18 @@ static const char **script_command_args_alloc(
return words;
}
-static struct command_context *current_command_context(Jim_Interp *interp)
+struct command_context *current_command_context(Jim_Interp *interp)
{
/* grab the command context from the associated data */
struct command_context *cmd_ctx = Jim_GetAssocData(interp, "context");
if (NULL == cmd_ctx)
{
/* Tcl can invoke commands directly instead of via command_run_line(). This would
- * happen when the Jim Tcl interpreter is provided by eCos.
+ * happen when the Jim Tcl interpreter is provided by eCos or if we are running
+ * commands in a startup script.
+ *
+ * A telnet or gdb server would provide a non-default command context to
+ * handle piping of error output, have a separate current target, etc.
*/
cmd_ctx = global_cmd_ctx;
}