diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2023-08-06 12:38:54 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2024-01-13 14:44:32 +0000 |
commit | e680841fd276439844ecf340f4005860d6e22582 (patch) | |
tree | d2c4679d8098b63d0b90bb12d041d8c251c30699 /doc | |
parent | f857db98bd2a3d97ada208a8137c48c47e9d3a78 (diff) | |
download | riscv-openocd-e680841fd276439844ecf340f4005860d6e22582.zip riscv-openocd-e680841fd276439844ecf340f4005860d6e22582.tar.gz riscv-openocd-e680841fd276439844ecf340f4005860d6e22582.tar.bz2 |
helper/command: pass command arguments also as Jim_Obj
Some OpenOCD command gets fragment of TCL scripts as command-line
argument, fragments that will be kept and executed later on.
E.g. the command 'configure' gets the body of an OpenOCD event:
$TARGET configure -event halted {TCL code}
These commands store the argument as a Jim_Obj and pass it to the
jimtcl interpreter when the TCL fragment has to be executed.
Using Jim_Obj as storage is relevant to let the jimtcl interpreter
to recover extra info of the TCL fragment, like the file-name and
the line-number that contain the fragment, that will be printed
out in case of run-time errors.
While converting the commands to COMMAND_HANDLER, we should avoid
storing the argument as C strings otherwise we will loose precious
info in case of run-time errors making challenging the debugging
of such TCL fragments.
Extend the struct command_invocation to contain the array that
points to the Jim_Obj of the command arguments.
This will be used while converting commands to COMMAND_HANDLER.
Change-Id: If37c5f20e9a71349f77ba1571baf1e6778e28aa5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8057
Tested-by: jenkins
Diffstat (limited to 'doc')
-rw-r--r-- | doc/manual/helper.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/manual/helper.txt b/doc/manual/helper.txt index d5710dd..b59fd66 100644 --- a/doc/manual/helper.txt +++ b/doc/manual/helper.txt @@ -79,6 +79,8 @@ command handlers and helpers: - @c CMD_NAME - invoked command name - @c CMD_ARGC - the number of command arguments - @c CMD_ARGV - array of command argument strings +- @c CMD_JIMTCL_ARGV - array containing the Jim_Obj equivalent of command + argument in @c CMD_ARGV. @section helpercmdregister Command Registration |