140 likes | 321 Views
CS 202 Computer Science II Lab. Fall 2009 September 24. Today Topics. Debugger Sending email with pine enscript Flowchart. Debugger. What is “debug” & “debugger” ? What the debugger does? Prepare the program for debugging. Basic gdb command. What is “debug” & “debugger”?.
E N D
CS 202Computer Science II Lab Fall 2009 September 24
Today Topics • Debugger • Sending email with pine • enscript • Flowchart
Debugger • What is “debug” & “debugger” ? • What the debugger does? • Prepare the program for debugging. • Basic gdb command
What is “debug” & “debugger”? • Debug - Try to find out errors from your programs • Compile-Time Error • Runtime Error • Debugger – Such as Gnu DeBugger (GDB) • Run another program under the debugger environment. • Allow users to see • The value or address of particular variables • The result of expression • Where the program Crash • Etc…
What the debugger does? • Start the program, and Specify anything that might affect the program behavior • Pause the program at a specific condition • Observe the variable value or address during the program is running • Analyze errors when the program is crashed • Find out which statement causes the program crashed
Prepare Program for Debugging: • Compile program • $ g++ -g -o cs202 cs202.cpp • Run gdb • $ gdb cs202
Basic gdb command: • run [command] [argument] • break [place] • delete [N] • step • next • finish • continue • print [var] • help [command] • quit
Sending emails with pine • C –to compose a message • Attachment: Ctrl + J or ctrl + T • Send: ctrl + X • Cancel: ctrl + c, c to confirm • Q –to quit • I –to • M to go to main menu
enscript • In Linux, the enscript command changes a text file to PostScript format and then sends it to the printer • enscript [options] testFileName • ‘-2’: Print two columns per page • ‘-r’: Rotate the output 90 degrees • ‘-2r’ • ‘Ecpp’: special formatting for C++ • man enscript
Flowchart • An algorithm is a detailed sequence of steps required to solve a problem. • Algorithms can be represented in a graphical format called a flowchart. Flowcharts can be large, but they are often useful. Used to represent calculations and data manipulation. Used to represent a comparison with either a Yes/True result or a No/False result. Used to represent the input or output of data. Used to indicate the beginning or ending of a task. These connector lines are used to join the other symbols within the flowchart. The second and third ones are used in conjunction with a Decision Box.