Age | Commit message (Collapse) | Author | Files | Lines |
|
Often the command in a stack trace will be a long script.
This makes it hard to read the stacktrace, so in this case
truncate at the first newline and add ...
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
A typical error message now looks like this:
t4.tcl:2: Error: syntax error in expression: "blah"
Traceback (most recent call last):
File "t4.tcl", line 14
c 1 2 3
File "t4.tcl", line 10, in c
b a c
File "t4.tcl", line 6, in b
a A14
File "t4.tcl", line 2, in a
expr blah
This is produced by stackdump (that can be replaced), called by errorInfo.
Note that now stacktraces (stacktrace, info stacktrace, $opts(-errorinfo)) include
the running command at each level in addition to proc, file, line. In order for
scripts to detect this new format, a new entry tcl_platform entry has been added:
tcl_platform(stackFormat) = 4 (to signify 4 elements per frame)
In addition, instead of building the error stack frame as the stack
is unwound in response to an error, instead the entire current stack trace
is captured by stacktrace. This means that the trace extends beyond the try/catch
right back to the initial interpreter command.
The 'stacktrace' command is now implemented in C based on the same
code that generates the error stacktrace.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Now callers to JimInvokeCommand() are expected to push and eval frame.
Then we no longer need to carry currentScriptObj, argc, argv in the interp
since these are in the current eval frame.
Note that this change simply renames some unused fields in Jim_Interp for ABI
compatibility, but these will be removed in due course.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
always include 'proc' even if introspection disabled
correctly set 'proc' at the eval frame level that is currently running
in the given proc. This makes it easier to produce an accurate level stacktrace
even across uplevel, etc.
Update stacktrace to use the new info frame.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Some stack frames may have no cmd (e.g. with eval).
Ensure that [stacktrace] still handles such frames by setting an
empty proc name in that case.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Returns a dictionary with file, line, cmd, (possibly) proc and level.
And support 'info frame 0' for the current command.
Note that now all evaluation frames are captured, not just call frames.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Allows commands to run when a proc or interpreter exits.
If the $jim::defer variables exists at proc or interp exit,
it is treated as a list of scripts to evaluate (in reverse order).
The [defer] command is a helper to add scripts to $jim::defer
See tests/defer.test
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
It's convenient to support a non-gc lambda, even if references
are disabled.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
The script implementation of dict values was not correctly handling the case
where a dictionary had duplicate values.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Rather than "Runtime Error: <file>:<line>: ...", use
use "<file>:<line>: Error: ..."
This latter format is both shorter and more consistent with other tools (e.g. gcc).
This also allows errors to be reported with the default errorfmt of vim's quickfix feature.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
If argv0 is a relative path, [info nameofexecutable] returned
the wrong result after changing directory.
So calculate and stash the result during init.
Also move internal $jim_argv0 into namespace jim as $jim::argv0
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Sweep through and clean up all (most) of the comments in the code.
While there, adjust some variable and function names to be more consistent,
and make a few small code changes - again, mostly for consistency.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Rather than just the error backtrace ([info stacktrace]),
include the live stacktrace. This means it is possible to do:
if {[catch $script msg]}
puts [errorInfo $msg]
}
to output the stack trace from the top level, not just from the point of capture.
It is still possible to pass a stacktrace to errorInfo to override this behaviour.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
dict for, values, incr, append, lappend, update, replace and info
Also implement array stat (the same as dict info)
Note that [dict info] and [array stat] are for useful for checking
the behaviour of the hash randomiser
Add Jim_EvalEnsemble()
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
For efficiency since it can be heavily used
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Also some general documentation cleanups and trailing
white space removal.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
And allow commands to set a temporary name for the purpose
of generating error messages
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Implement 'dict with' and 'dict merge' as scripts since this is simpler.
Use 'dict size' to implement 'array size'
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Instead, set TCL_LIBRARY based on where jim is installed.
This defaults to /usr/local (thus /usr/local/lib/jim), or
can be modified with either configure or make. e.g.
./configure --prefix=/usr
or
make prefix=/usr install
Now auto_path is initialised only to TCL_LIBRARY, and doesn't
include "." which could be undesirable.
At the same time, simplify jimsh initialisation using a script
instead of C code. Add the path to the executable to auto_path.
Also, no longer use JIM_TCL_COMPAT. Always use the tcl-compatible
names, $auto_path and $tcl_interactive.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This makes for cleaner output from a console session
and is compatible with earlier versions of Jim.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Remove Jim_PrintErrorMessage() and create Jim_MakeErrorMessage() instead.
Move errorInfo to stdlib since it is now required.
Also move lassign from tclcompat to stdlib as a core command.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
info frame allows access to source file/line for earler call frames
Implement 'stacktrace' to give a live stacktrace
And 'stackdump' to convert a stack trace to readable form
Update 'errorInfo' to use 'stackdump'
Also fix tailcall to retain source info
And implement alias, lambda and curry with tailcall
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Also implement 'local' to declare/delete local procs
* Add tests/alias.test for testing alias, current, local
* proc now returns the name of the proc created
* Add helper 'function' to stdlib
Reimplement glob and case to use local procs
* This keeps these internal procs out of the global namespace
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|