aboutsummaryrefslogtreecommitdiff
path: root/src/helper
AgeCommit message (Collapse)Author
2010-05-18jim: fix bug in tcl "puts"Øyvind Harboe
tcl "puts" didn't work because the logging code sensored strings that did not include a '\n'. The correct thing is to sensor empty strings, which are used to keep gdb connection alive. The tcl "puts" code broke apart strings which do contain '\n' in order to implement the -nonewline argument, which is how it got hurt by the bug in log.c Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05command context: fix errors when running certain commands on startupØyvind Harboe
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>
2010-04-10HELPER/LOG: review unused symbolsAntonio Borneo
Remove unused functions: - log_catch - log_rethrow - log_try Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10BINARYBUFFER: review scope of data and functionsAntonio Borneo
Add "static" qualifier to private data and functions. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10TIME_SUPPORT: review unused symbolsAntonio Borneo
Remove unused functions: - timeval_add Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-02-15gpl: fix GPL startup messageØyvind Harboe
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-02-04CMD: duplicate cmd error msgSpencer Oliver
When registering cmds we report duplicate attempts to register a cmd as a LOG_ERROR. Some situations need this, such as when registering dual flash banks. http://www.mail-archive.com/openocd-development@lists.berlios.de/msg11152.html Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-01-29Clang buildfixesAlex Austin
Building with clang took a few very small changes. The change to helper/log.h is because clang doesn't like an expression where the result is unused. In helper/system.h, I just defined true and false since clang doesn't have them builtin. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-28ARM semihosting: win32 and cygwin fixesSpencer Oliver
Cygwin would fail to reopen a previously written file if the mode is not given. Simplified converting the open flags and made sure the win32 O_BINARY bit is set. Added define for systems that do not support O_BINARY. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-01-28ARM semihosting: fix writing to stdoutSpencer Oliver
SYS_FLEN would be called before a write on a descriptor to check its size. Currently lseek would fail with -1 when given the stdout/stderr descriptor. Changing to use fstat seems to be the standard way of handling this. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-01-21ecos: add missing PRId8 definitionØyvind Harboe
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-19update win32 script search pathAndreas Fritiofson
The default script search path on Windows is out of date with the current layout (from installation and documentation), which makes the standard script library not be found after a normal ./configure && make && make install under msys/MinGW. The same should hold true for cygwin native builds (not verified). Update search path to ../share/openocd/scripts not ../lib/openocd, relative to the openocd executable. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-13debug: make logging of commands terserØyvind Harboe
one line / command instead of one line per argument. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-11commands: make error messages a bit more terseØyvind Harboe
we don't need to know the build path of command.c when reading normal user level error messages. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-10FreeBSD build fixesDavid Brownell
Based on notes from Tomek Cedro <tomek.cedro@gmail.com> and Steve Franks <bahamasfranks@gmail.com>. In the User's Guide, sort the list of operating systems reported through Tcl with $ocd_HOSTOS ... and include FreeBSD. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-09src/helper: usage/help updatesDavid Brownell
Make "usage" messages use the same EBNF as the User's Guide; no angle brackets. Improve and correct various helptexts. Don't use "&function"; a function's name is its address. Fix some whitespace glitches, shrink a few overlong lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-09buildfix on MacOSMasaki Muranaka
Recent Apple gcc versions use __APPLE__ instead of __DARWIN__; accept that too. Also use #warning, not #warn; neither is standard, but most CPP versions require it to be spelled out. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-05don't require 'openocd.cfg' to startDavid Brownell
Starting the daemon with with just a bare "openocd" I saw: Can't find openocd.cfg That's not an error; don't treat it as if it were. There may be an error later -- like, "no interface set up" -- but let messages only report real errors, not fake ones.
2010-01-02streamline and document helptext mode displaysDavid Brownell
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: David Brownell <dbrownell@users.sourceforge.net>
2010-01-02Fix usage/help search for subcommands.Dean Glazeski
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: David Brownell <dbrownell@users.sourceforge.net>
2010-01-02Add the current command to the command informationDean Glazeski
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: David Brownell <dbrownell@users.sourceforge.net>
2009-12-26cygwin 1.7 build fixesDavid Brownell
It's less accepting of signed char ... insisting that e.g. tolower() not receive one as a parameter. It's probably good to phase out such usage, given the number of bugs that lurk in the vicinity (assumptions that char is unsigned), so fix these even though such usage is actually legal. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-21help: list all commands that match stringOyvind Harboe
Restore behavior where help lists all commands that match string passed to help. Signed-off-by: Oyvind Harboe <oyvind.harboe@zylin.com>
2009-12-16ecos: crisper implementation of timeval_ms()Øyvind Harboe
A crisper/faster implementation under eCos that makes profiling a tad easier. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-15command: retire obsolete macroØyvind Harboe
COMMAND_REGISTER() was only used transiently during code conversion. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-08build: add build/src to include pathØyvind Harboe
This allows including generated include files. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-05misc code review updatesDavid Brownell
More updates from the code review by Steve Grubb <sgrubb@redhat.com>. The Jim float-comparision bug just gets a comment not a fix, though. Cc: Steve Grubb <sgrubb@redhat.com>. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-04switch 'rm' command away from using JimZachary T Welch
Commands that do not need to use Jim should be registered as high-level command handlers.
2009-12-03doxygen: remove some warningsDavid Brownell
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-03remove tertiary include pathsZachary T Welch
With all #include directives converted, we only need to have the top-level src/ directory in the search path.
2009-12-03change #include "server.h" to <server/server.h>Zachary T Welch
Changes from the flat namespace to heirarchical one. Instead of writing: #include "server.h" the following form should be used. #include <server/server.h> The exception is from .c files in the same directory.
2009-12-03change #include "target.h" to <target/target.h>Zachary T Welch
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.
2009-12-03change #include "types.h" to <helper/types.h>Zachary T Welch
Changes from the flat namespace to heirarchical one. Instead of writing: #include "types.h" the following form should be used. #include <helper/types.h> The exception is from .c files in the same directory.
2009-12-03change #include "jim.h" to <helper/jim.h>Zachary T Welch
Changes from the flat namespace to heirarchical one. Instead of writing: #include "jim.h" the following form should be used. #include <helper/jim.h> The exception is from .c files in the same directory.
2009-12-03change #include "command.h" to <helper/command.h>Zachary T Welch
Changes from the flat namespace to heirarchical one. Instead of writing: #include "command.h" the following form should be used. #include <helper/command.h> The exception is from .c files in the same directory.
2009-12-03allow #include directives to use module nameZachary T Welch
Includes the src directory in the search path, so header files may be migrated from: #include "foo.h" to #include <module/foo.h> which is more conducive for installation.
2009-12-02stubs: buildfixDavid Brownell
The new stubs for httpd and ioutil gave errors like: ioutil_stubs.c: In function ‘ioutil_init’: ioutil_stubs.c:27: error: implicit declaration of function ‘LOG_DEBUG’ ioutil_stubs.c:28: error: ‘ERROR_OK’ undeclared (first use in this function) ioutil_stubs.c:28: error: (Each undeclared identifier is reported only once ioutil_stubs.c:28: error: for each function it appears in.) Fix. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-02remove BUILD_IOUTIL symbolZachary T Welch
Add ioutil_stubs.c to provide an empty ioutil_init() routine. Add ioutil.h to prevent applications from needing to declare it. Allows unconditionally calling that function during startup, and the resulting libocdhelper library API is now more stable. Prints a DEBUG message when the stub implementation is included.
2009-12-01command: the Jim interpreter can now be provided rather than createdØyvind Harboe
In embedded hosts, the Jim interpreter can come from the existing context rather than be created by OpenOCD. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-30improve command prohibition error reportZachary T Welch
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'".
2009-11-30remove interp global variable!Zachary T Welch
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!
2009-11-30command output capture: do not use interp globalZachary T Welch
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.
2009-11-30do not extern 'interp' from command.cZachary T Welch
Adds 'interp' field to command_context, chasing the few remaining references to the global variable outside of the command module.
2009-11-30make syntax errors respond with 'usage'Zachary T Welch
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.
2009-11-30move improperly located documentationZachary T Welch
Somehow, the comment block for command handlers ended up associated with the output_handler. Move it to the command_handler_t declaration.
2009-11-30improve command_done() API and docsZachary T Welch
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.
2009-11-30only display usable commands in helpZachary T Welch
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.
2009-11-28remove redundant 'rm' command handlerZachary T Welch
Two 'rm' commands were implemented and registered. This removes the version that would have never been called prior to refactoring the command registration.
2009-11-28add error checking in command_newZachary T Welch
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.
2009-11-28include mode information in help text.Zachary T Welch
Extends the help output to list the valid modes for each commands. Fixes a memory leak of the returned command_name() string.