ECN No Name Newsletter: December, 1990

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

Saber-C:A Debugger You'll Like

Steve Weinrich

Saber-C is an interactive C language development environment. It sports a powerful source-level debugger and interpreter. Saber encompasses many of the features that other debuggers use but which are not found in any other single environment. Another nice feature is that Saber-C can run on an ASCII terminal, under X- windows or under Suntools. Since it supports all of these, you can use a consistent environment, wherever you are programming.

To start Saber-C, you need type in the command:

              "/usr/ecn/saber" (on ASCII terminal)
                 "/usr/ecn/xsaber" (X11 version)
             "/usr/ecn/sabertool" (Suntools version)

This will invoke the Saber environment. As a quick overview of the operation of Saber-C, I will run through a sample session:

First, Saber-C runs within its own confines. You can think of it as a protective shell around your program's memory which will not allow anything to touch it, unless you explicitly allow it. When Saber starts up, it is empty. It has no source code loaded, and only has one library linked in: libc.a

To allow Saber to work on your source code, use the 'load' command. This tells Saber to read in the source code, line by line, check for syntax errors and look for obvious logic bugs. While reading in your program, if Saber sees a problem, and it is not fatal, it will list it as a 'warning'. These warnings will be kept in a 'folder' for later viewing. If it comes across a fatal error, it will note it in the folder along with the warnings, tag it as an error and stop reading the file. At this point you have a few options. You can look at the warnings and errors, or you can edit the file and read it back in, ignoring all previous attempts. Editing can be accomplished in one of two ways if you are running xsaber or sabertool. Either you can edit the file within your standard shell, or you can click on the `edit icon', that looks like a page with a corner bent over, and Saber will create a window with your favorite editor in it, and position the cursor on the EXACT location of the error or warning that it found. Either way, once the error has been corrected, you will need to re-load the source file. This can be done by selecting 'Save & Re-load' from the editor's pull down menu, or by typing in the 'load' command with your source file one the command line again.

Once you have loaded your first source file, the rest are easy. If there are to be multiple source files, you may either load each one individually, or you can simply type all of their names on the same line. You may also include any standard 'cc' style command line options:

load file1.c file2.c perfect.o my_lib.a -L../include -DDEBUG

The files are now loaded, and you are ready to try to run your program. Let's try it. Type: "run"

Saber-C will begin the quick process of linking in your source code with the libraries that have been included and checking for compile time errors. Once finished, it will begin execution of your code. If all goes well, it will complete and printout any output (in a separate window if you are running either sabertool or xsaber) and print out the return code of your program. If there are run-time errors or warnings, Saber will stop running your code and create a break-level. You will see the line or statement that generated the error highlighted in the editor portion of the Saber environment. This error or warning may be taken care of just as you did when you were loading the files in the beginning. To exit Saber-C, type: "quit".

This tells Saber that you are ready to end the session. 99% of the time you will actually want to type in: "quit force". This informs Saber that you do not wish to save the current session, nor save the current project information. If you have saved all of your editor files, Saber will exit and you will return to your command line prompt.

There are hundreds of other interesting features that cannot possibly be described in one newsletter article. The only real way to get to know most of the options in Saber-C is to try running it. Once you have loaded a troublesome program into Saber-C, you will instantly see where the problem is. Unfortunately, it might not be able to tell you how to fix it, but then again, what fun would programming be without any debugging?

Documentation for Saber-C is available from Potter Library reference desk or it can be purchased at the Armory for $15.45. Please ask for ECN #746 Saber-C. If you have any further questions about how to run Saber-C, please contact your site specialist. If they are unable to answer your question, you may wish to send mail to Steve Weinrich (weinrich@ecn.purdue.edu)


webmaster@ecn.purdue.edu
Last modified: Thursday, 23-Oct-97 20:23:32 EST

[HTML Check] HTML