Introduction to SABER C
CodeCenter (formerly named Saber) is a C interpreter/debugger that
takes much of the work out of finding errors in programs. It has an
on-line help system that is fairly complete, and also has an on-line
tutorial available.
To run on a DECstation (version 3.1.1):
add saber; xcodecenter (for the X version)
add saber; codecenter (command-line version)
To run on a Sun (version 4.0.2):
add codecenter; xcodecenter (X version)
add codecenter; codecenter (command-line version)
You will be given some version information and finally be presented
with a prompt:
1 ->
You can just type:
load name-of-your-source-file.c
at this prompt, and the file will be loaded. Codecenter can also read
and understand object (".o") files, but it will not be able to give
you as much debugging information as if you use the source (".c")
files. If you are fairly certain that one of your object files is
bug-free, however, you may choose to load it instead of the source
file, as it will run faster than the interpreted C code.
If you need to load more than one source file or object file, you can
specify them all on the same line, if you wish. If you link your
program against any libraries, they should also be specified with "-l"
as you would do when compiling with "cc". For example:
load file1.c file2.c file3.o file4.o -lm
would load the source files "file1.c" and "file2.c" and the object
files "file3.o" and "file4.o", and link them against the math library
("-lm").
If there are no errors in your source code, the prompt will return
immediately. If there are errors, they will appear in this form:
1 -> load flites.c
Loading: flites.c
----------------
"flites.c":29, main(), Used before set (Warning #290)
28: {
* 29: bos_passengers = bos_left + how_many_passengers( bos_dep[
i], 'B', number_of_data);
30: nyc_passengers = nyc_left + how_many_passengers( bos_dep[
i], 'N', number_of_data);
Automatic variable 'number_of_data' may be used before set.
General options: break/continue/quit/edit/reload
Suppress options: Everywhere/File/Line/Procedure/Name [b] ?
The "*" appears next to the line where Codecenter thinks the error is,
and you now have options on what to do. Normally, you will want to
fix the error (by changing the file in emacs and saving the file (with
Ctrl-x Ctrl-s)), and type `r' in the window where you're running
saber, to re-load the file (and hopefully get past the previous
error).
For instance, in this case, the variable `number_of_data' has been
used as a function argument before it has been given a value.
When the prompt is returned to you with no errors, you can just type:
run
at the prompt. If your program takes arguments from the command line,
include them on the line with "run". If you want to use an input
file, you can specify that as well:
run < name-of-input-file
Using "run" allows you to catch run-time errors.
Note that Codecenter is fairly picky, and will generate a lot of
warnings that "cc" might not, since it assumes that strange
constructions in your program might be an error on your part rather
than assume that you know exactly what you're doing and that you
intend to put strange things in your program.
To get a list of topics Codecenter has help on, type "help" inside the
program. To get help on a particular command, type "help" followed by
the command name. For more in-depth information, Codecenter has
internal man pages. Type "man" inside the program to get a list of
internal man pages that it has, or "man" followed by the name of
the command for its man page.
Additional informantion is also available by typing:
man saber
man xcodecenter
man codecenter
at your athena% prompt after adding "saber" or "codecenter" as
appropriate for your platform.
|