CS23021 CS I – Programming and Problem Solving
Project #1
Due by 11:59pm on Tuesday, January 29, 2008
Objective
This project should be done ind ividually . In this project you will create a project directory under
subversion control , use gdb (a debugger) for tracing program execution and script (a unix co mmand)
that allows you to save your interactive work to a file. You will use gdb and script to trace the execution of
a program called echoinput. The program echoinput asks the user to input a number and then prin ts this
number to the terminal , i t then asks the user to enter a character and print out the entered character to the
terminal. The project is worth a total of 20 points .
Project step-by-step
• Set up yo ur account an d learn versioni ng software: attend the lab session, learn to login to your
account and use subversion.
• Obtain a copy of the so urce code an d comp ile it: the file echoinput.cpp is available from the
course website at:
http://www.cs.kent .edu/~vo lkert/cs23021/S08/
You mus t comp ile the program so that the debugging information is included in the executable – use
the –g op tion when compil ing to do this. You can read more about th is op tion by executing the man
command (i.e. man g++) to read the g++ on-line manual. Note: man can be used to get information
about most un ix commands (e.g. man script or man gdb).
• Trace the program: as proof that you successfully traced the program you will submit the transcript of
the tracing session . The u tili ty that makes transcripts is called script. S tart the scripting u tili ty:
prompt% script
Output:
Script started, file is typescript
Indicates that the utility has started successfully. Now , everything that appears on the screen will be
copied to a file named typescript in your current directory.
Launch the debugger (gdb), set a breakpoint at the beginning of the program and trace line-by-line the
execution of the program. While tracing through each line of your program issue gdb commands to
print the value of the variable “number” before and a fter it was assigned the value you entered as
user input, do the same for the variable named “c haracter”. Quit the debugger after the program
terminates.
Exit from script by typ ing:
prompt% exit
Output:
Script done, file is typescript
Indicates that script has finished successfully and your tracing session is saved in the file.
• To s ubmit your project: create directory Project1 in your local repository . S tore your files
typescript and echoinput.cpp there. Issue an svn co mmit to transfer a copy of your project from your
local repository working directory in to the master repository.
• Verify your project submission: verify your submission on the web at:
http://classes.cs.kent.edu /courses/cs23021/svn/yoursection/yourloginid/cs23021_stu dent/Project1