It is possible to edit, compile, run, and debug C programs from solix. The main advantage of this is for people with computers and modems who do not want to purchase Microsoft Visual C++.
Welcome to the good old days. If you decide to follow this path, then you will need to learn a lot of other stuff than just C++. You will need to know some UNIX related stuff, so check out my UNIX information page. The basic cycle for this process is
gcc -g -o file.out file.c
Submitting Homework Online from mongoose or solix I have created a script that you can call from school computers to upload files to my directory. Execute the following from the directory where your C source file is saved on solix:
~downeyt/cs/public/webftp/webftp.pl
and follow the instructions. Use the -h option to learn how to customize the program.
There is also a debugger on solix. Actually, there are several. I will describe the gdb debugger, which is a Gnu program.
A debugger allows you to step through a program one line at a time. Here are some of the basic commands for the gdb debugger.
Command | Description | Abbreviation |
---|---|---|
gdb file.out |
This is the command that will start the debugger. file.out is the name of the output file that you created when you compiled your program. | |
break function |
Replace function with the name of any function in your program, including main. When the debugger reaches this function, it will stop and wait for more instructions. | b |
run |
This command starts the debugger. If no break points have been set, then the program will be run to completion. This command can be abbreviated to | r. |
bt |
This is the back trace command. It displays the run time stack. | |
continue |
This command continues program execution. Basically, it is like the run command, except that it starts form the point where the program has been halted. | c. |
next |
Execute the current instruction. If it is a call to a subroutine, then the entire subroutine is executed. The debugger will halt at the next line in the current function. | n. |
step |
Execute the current instruction. If the current instruction is not a call to a subroutine, then step is the same as next. If it is a call to a subroutine, then only call to the subroutine is executed. The debugger will halt at the first line in the subroutine. | s |
help |
On-line help. This command can be abbreviated to | h |
quit |
Exit the debugger. | q |
list |
List the current 10 lines of the program | l |
For more information, issue this command from the UNIX prompt
info -f /depot/gdb-4.15.1/src/gdb/gdb.info
In a typical debug session, you would use the following
There is a problem on solix: you don't have a lot of storage space. You will probably only be able to have 1 or 2 executables around at a time. So, if you get a Disk Quota Exceeded message, then you will have to delete some files. Here is how you could delete a file with the name bigfile.ext
rm bigfile.ext
The executables are the largest files, so if you have a problem, delete them first. If you want to keep a copy of them, download them to the A:\ drive before deleting them.