1. 09 Jan, 2011 1 commit
    • Eric Wetzel's avatar
      nit: more LOG_* \n fixes · 0535531d
      Eric Wetzel authored
      Remove extra \n from LOG_DEBUG, LOG_INFO, and LOG_WARNING messages
      Remove LOG_INFO_N
      LOG_INFO_N was only used once and had a \n at the end
      Change LOG_USER_N calls that end with \n to LOG_USER
  2. 29 Dec, 2010 1 commit
  3. 18 Dec, 2010 1 commit
    • Øyvind Harboe's avatar
      script: support only Tcl comments · c9544e41
      Øyvind Harboe authored
      Only Tcl comments are now supported. For classic style
      commands comments were supported at the end of the line.
      Move in the direction of letting the script language
      decide syntax, rather than have special rules for some
      Before this patch goes in, the scripts should be updated
      to use ;# instead of # for end of line comments.
      > mdw 0 1 2
      mdw ['phys'] address [count]
        zy1000.cpu mdw address [count]
      Command handler execution failed
      in procedure 'mdw'
      > mdw 0 1 #2
      mdw ['phys'] address [count]
        zy1000.cpu mdw address [count]
      Command handler execution failed
      in procedure 'mdw'
      > mdw 0 1 ;#2
      0x00000000: ffffffff
      > mdw 0 1
      0x00000000: ffffffff
      > mdw 0
      0x00000000: ffffffff
      Signed-off-by: default avatarØyvind Harboe <oyvind.harboe@zylin.com>
  4. 09 Nov, 2010 2 commits
  5. 29 Oct, 2010 1 commit
  6. 27 Oct, 2010 1 commit
  7. 20 Sep, 2010 1 commit
  8. 11 Sep, 2010 1 commit
    • Øyvind Harboe's avatar
      command: capture command now handles both types commands · ac86f4cc
      Øyvind Harboe authored
      Commands that output progress output and no return value
      will have the progress output captured.
      Commands that do not output progress output(tcl commands)
      will return the tcl return value instead.
      The advantage here is that it is no longer necessary to
      consider which command one is capturing, it works for
      Example #1: capture progress output:
      set foo [capture help]
      Example #2: capture tcl return value
      set foo [capture {set abc def}]
      Signed-off-by: default avatarØyvind Harboe <oyvind.harboe@zylin.com>
  9. 18 Jun, 2010 1 commit
  10. 05 May, 2010 1 commit
  11. 04 Feb, 2010 1 commit
  12. 13 Jan, 2010 1 commit
  13. 11 Jan, 2010 1 commit
  14. 10 Jan, 2010 1 commit
  15. 09 Jan, 2010 2 commits
  16. 02 Jan, 2010 3 commits
    • David Brownell's avatar
      streamline and document helptext mode displays · b3bf1d12
      David Brownell authored
      Most commands are usable only at runtime; so don't bother saying
      that, it's noise.  Moreover, tokens like EXEC are cryptic.  Be
      more clear: highlight only the commands which may (also) be used
      during the config stage, thus matching the docs more closely.
      There are
       - Configuration commands (per documentation)
       - And also some commands that valid at *any* time.
      Update the docs to note that "help" now shows this mode info.
      This also highlighted a few mistakes in command configuration,
      mostly commands listed as "valid at any time" which shouldn't
      have been.  This just fixes ones I noted when sanity testing.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
    • Dean Glazeski's avatar
      Fix usage/help search for subcommands. · 9d167d62
      Dean Glazeski authored
      This makes it so that the usage/help command properly uses the whole command,
      including subcommand, in the search for help information.  This previously
      caused erroneous output from the usage command handler.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
    • Dean Glazeski's avatar
      Add the current command to the command information · be017861
      Dean Glazeski authored
      I wanted to make it so I can be ignorant of a commands invocation string, so
      I tried to use CMD_CURRENT (aka cmd->current) which is supposed to house a
      pointer to the current command.  It turns out that this wasn't being set.
      This patch adds the current command structure to the command invocation
      structure before sending it along to the command handler.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
  17. 21 Dec, 2009 1 commit
  18. 03 Dec, 2009 1 commit
    • Zachary T Welch's avatar
      change #include "target.h" to <target/target.h> · c6dd6a57
      Zachary T Welch authored
      Changes from the flat namespace to heirarchical one.  Instead of writing:
      	#include "target.h"
      the following form should be used.
      	#include <target/target.h>
      The exception is from .c files in the same directory.
  19. 01 Dec, 2009 8 commits
    • Øyvind Harboe's avatar
      command: the Jim interpreter can now be provided rather than created · 5576a624
      Øyvind Harboe authored
      In embedded hosts, the Jim interpreter can come from the
      existing context rather than be created by OpenOCD.
      Signed-off-by: default avatarØyvind Harboe <oyvind.harboe@zylin.com>
    • Zachary T Welch's avatar
      improve command prohibition error report · 330733ea
      Zachary T Welch authored
      Ensures that the correct information gets displayed, depending on the
      mode of the command being denied.  Fixes misreporting all commands as
      needing to run "before 'init'".
    • Zachary T Welch's avatar
      remove interp global variable! · 8fc5a9a5
      Zachary T Welch authored
      Finish removing references to the 'interp' global variable from the
      command module, encapsulating all reference via command_context.
      Eliminates use of the global entirely, so it can be removed.  Hurrah!
    • Zachary T Welch's avatar
      command output capture: do not use interp global · cbc894ed
      Zachary T Welch authored
      Adds a log_capture_state structure to pass to the log capture
      callback used by the command module.  Ensures that the capture occurs
      in the proper context.
    • Zachary T Welch's avatar
      do not extern 'interp' from command.c · 7b2906de
      Zachary T Welch authored
      Adds 'interp' field to command_context, chasing the few remaining
      references to the global variable outside of the command module.
    • Zachary T Welch's avatar
      make syntax errors respond with 'usage' · 5dd6457d
      Zachary T Welch authored
      The 'help' text will become more verbose, so its entire text will be
      far more than desired when you only borked your syntax.  The usage
      still allows the commands to be looked up for more help.
    • Zachary T Welch's avatar
      improve command_done() API and docs · bc9ae740
      Zachary T Welch authored
      command_done() does not need to return an error, but it needed
      Doxygen comment.  Provide some for copy_command_context as well.
      Note: this audit revealed some potential bugs with the command context
      implementation.  There was a reason that commands were added at the
      end of the list.  Shallow copying of command_context means that
      the list is shared between them.  And commands added at the top-level
      before the pre-existing commands will not be available in the shared
      context as they were before.  Yikes!
      Fortunately, this does not seem to occur in general use, as
      'add_help_text' gets registered in startup.tcl and claims the first slot
      in my own test cases.  Thus, it seems that we have been masking the issue
      for now, but it shows the need for further architectural improvement in
      the core command module.
    • Zachary T Welch's avatar
      only display usable commands in help · c0630d8a
      Zachary T Welch authored
      With the ability to defer 'init', users can access the help system while
      still in CONFIG mode.  This patch omits commands from the help and usage
      list when they cannot be run in the current command mode, making it much
      easier to see what can be done at a given time.
  20. 28 Nov, 2009 8 commits
    • Zachary T Welch's avatar
      add error checking in command_new · 8795b8f9
      Zachary T Welch authored
      Adds checks for memory allocation failures.  Started to use calloc()
      instead of malloc()/memset(), but I got carried away.  This kind of work
      should be done throughout the tree, but it's almost hopeless at present.
    • Zachary T Welch's avatar
      include mode information in help text. · 42e00bb3
      Zachary T Welch authored
      Extends the help output to list the valid modes for each commands.
      Fixes a memory leak of the returned command_name() string.
    • Zachary T Welch's avatar
      refactor command mode detection · fd343bea
      Zachary T Welch authored
      Splits the check for a command's ability to run into a helper.
      This also fixes a bug whereby commands that specified COMMAND_EXEC
      were allowed to run during the configuration stage.  This allowed
      problematic commands to be called before 'init', defeating the intention
      of specifying that command mode.  With this change, the run_command()
      helper denies access to handlers that should run only after 'init'
      during the configuration stage.
    • Zachary T Welch's avatar
      add command private data setter/accessor · 933b4579
      Zachary T Welch authored
      Presently, commands registration taks a static handler data pointer.
      This patch adds support for commands that require a dynamic pointer,
      such as those registered in a dynamic context (e.g. subcommands for a
      user-created 'foo.cpu' command).  The command_set_handler_data will
      update a command (group) to use a new context pointer, while the
      CMD_DATA macro allows command handlers to access the value.
      Jim handlers should find this value in interp->cmdPrivData.
    • Zachary T Welch's avatar
      add 'command mode' introspective handler · 3b5751a4
      Zachary T Welch authored
      Allows scripts to behave different depending on the current mode.
      Also allows introspection of the mode required for commands.
    • Zachary T Welch's avatar
      remove unknown handler · 89fa493a
      Zachary T Welch authored
      Updates command registration to provide top-level handlers for all
      commands, rather than falling back onto the 'unknown' command. Instead,
      that same handler is registered for placeholders, providing the same
      functionality under the root verb command name instead.  This permits
      users to implement their own 'unknown' function, and it resolves some
      mind-bending breakage related to function object lookup while recursing.
      Changes 'ocd_bounce' to call 'ocd_command' and 'ocd_help' from the
      wrapper directly, rather than bouncing through their wrappers. This
      prevents endless recursion caused by the above changes, whereby the
      'command' wrapper's type check would blow the stack to hell and gone.
    • Zachary T Welch's avatar
      improve command handler wrapper script · df22f0f9
      Zachary T Welch authored
      Adds 'ocd_bouncer' in startup.tcl that is called as a helper for
      all command handlers, shrinking the embedded C wrapper to a mere stub.
      Jim handlers are called directly, simple handlers get called with the
      wrapper to capture and discard their output on error, and placeholders
      call help directly (though the unknown handler still does this too).
      It attempts to improve the quality of the error messages as well.
    • Zachary T Welch's avatar
      add 'command type' introspective handler · 37dd5a68
      Zachary T Welch authored
      Adds the 'command' group handler, with the 'type' command producing
      a string that tells whether the given command is 'native' (for Jim-based
      command handlers), 'simple' (for simple built-in commands), 'group'
      for command group placeholders, and 'unknown' if not found in the
      command registration tables (e.g. core built-ins functions).
  21. 27 Nov, 2009 1 commit
    • Zachary T Welch's avatar
      fix regression causing duplicated output · 77aa7ca8
      Zachary T Welch authored
      The command refactoring caused subcommand handlers to produce duplicate
      output when run.  The problem was introduced by failing to ensure all
      such invocations went through a top-level "catcher" script, prefixing
      the command name with the 'ocd_' prefix and consuming its results.
      The fix is to ensure such a top-level "catcher" script gets created
      for each top-level command, regardless of whether it has a handler.
      Indeed, this patch removes all command registrations for sub-commands,
      which would not have worked in the new registration scheme anyway.
      For now, dispatch of subcommands continues to be handled by the new
      'unknown' command handler, which gets fixed here to strip the 'ocd_'
      prefix if searching for the top-level command name fails initially.
      Some Jim commands may be registered with this prefix, and that situation
      seems to require the current fallback approach.  Otherwise, that prefix
      could be stripped unconditionally and the logic made a little simpler.
      The same problem must be handled by the 'help' command handler too,
      so its lookup process works as intended.
      Overall, the command dispatching remains more complicated than desired,
      but this patch fixes the immediate regressions.
  22. 25 Nov, 2009 1 commit
    • Zachary T Welch's avatar
      add script_command_run helper · d89c6310
      Zachary T Welch authored
      Eliminates duplicated code in script_command and handle_unknown_command.
      Fixes bug with duplicated help output generated by placeholder commands.