Introduction to the Omega Server CSE 1105. Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.

Slides:



Advertisements
Similar presentations
Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 7, 2012 CSCE 212Honors Computer Organization.
Advertisements

Utilizing the GDB debugger to analyze programs Background and application.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
1 Introduction to UNIX Ke Liu
Working with Files How to create, view, copy, rename and print files.
©Colin Jamison 2004 Introduction to Linux Colin Jamison.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
CSCI 1411 FUNDAMENTALS OF COMPUTING LAB Lab Introduction 1 Shane Transue MSCS.
1 Introduction to UNIX 2 Ke Liu
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux & Applications Sean GavinWayne State University multi-user environment -- log in: user name and password -- you never turn the computer on or off.
Basic linux shell commands and Makefiles. Log on to engsoft.rutgers.edu Open SSH Secure Shell – Quick Connect Hostname: engsoft.rutgers.edu Username/password:
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
CS1020: Intro Workshop. Topics CS1020Intro Workshop Login to UNIX operating system 2. …………………………………… 3. …………………………………… 4. …………………………………… 5. ……………………………………
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Learning basic Unix command IT 325 operating system.
Debugging Cluster Programs using symbolic debuggers.
Notes Assignment #1 is due next Friday by 11:59 pm via Test #1 will be held Thursday February 18 at the start of class (one period long) Format:
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 1. PC vs. Multi-user System  Personal Computer – each user gets his/her own processor (or multicore processor).  Multi-user system – The processor,
Unix Basics Chapter 4.
Cmsc 312 Operating Systems. UNIX? DOS – PC? VAX/VMS - mainframe Unix – PC, workstation, mainframe 1970 bell Lab For computer scientist? Why popular? Free.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
1 N305 C Programming. 2 Objectives for the Lab ä Learn problem solving strategies ä Achieve intermediate knowledge of C Programming Language ä Gain experience.
Compiling & Debugging Quick tutorial. What is gcc? Gcc is the GNU Project C compiler A command-line program Gcc takes C source files as input Outputs.
TAMU CSCE 313 (the basics). Basic Unix/Linux programming Accessing CS systems  PuTTY (putty.exe) – a Telnet and SSH client  Common hosts: unix.cs.tamu.edu.
Natawut NupairojAssembly Language1 Unix Survival Guide.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
November 5, 2015CIS 118 Intro to UNIX What’s a Unix? Unix is an Operating System Designed for high-traffic usage Many variants –Linux, BSD: free versions.
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Introduction to C Programming Lecture 2. C Tutor Schedule / 3rd Floor Lab b The lab and tutor schedule is available at the following URL:
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
CGS 3460 Why we choose UNIX n Powerful lMulti-user operating system lGood programming tools Most heavy-duty database management systems started out on.
Tera Term Brian Smith Chris Vasse Zaheemat Adetoro William Newton Tom Presgraves.
Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Introduction to Programming Using C An Introduction to Operating Systems.
Debugging 1/6/2016. Debugging 1/6/2016 Debugging  Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a program.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
CSE 1320 Basics Dr. Sajib Datta
Dr. Sajib Datta Jan 16,  The website is up.  Course lectures will be uploaded there ◦ Check regularly for assignments and update.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
HP-SEE Debugging with GDB Vladimir Slavnic Research Assistant SCL, Institute of Physics Belgrade The HP-SEE initiative.
Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 4, 2010 CSCE 212Honors Computer Organization.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Tutorial Six Linux Basics CompSci Semester Two 2016.
DEBUG.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
CS1010: Intro Workshop.
Andy Wang Object Oriented Programming in C++ COP 3330
CSCE 212Honors Computer Organization
Software Tools Recitation 1
Welcome to CSCI 230! Problem Solving using C
Tutorial of Unix Command & shell scriptS 5027
Welcome to CSCI 230! Problem Solving using C
Andy Wang Object Oriented Programming in C++ COP 3330
Tutorial Unix Command & Makefile CIS 5027
Module 6 Working with Files and Directories
Video Notes.
CSCE 212Honors Computer Organization
Debugging.
Presentation transcript:

Introduction to the Omega Server CSE 1105

Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger

Omega Server Unix-based Server Provides C, C++, Lisp, Prolog, Cobol, and Fortran Language Compilers Pine Mail Server Users connect via telnet, ssh, hummingbird or other remote log ins

How to connect to Omega 1. Using the telnet command > telnet omega.uta.edu 2. Enter username at the prompt

Connect 2. SSH Secure Shell installed on all school computers

Connect 3. Hummingbird

Writing programs Edit a file using an existing Unix editor vi editor pico editor Edit a text file and upload it to omega telnet ftp content or attachment

Basic Unix Commands Managing Files ls : displays the files in a specified directory %ls rm : delete a file %rm file_name cp : copy files %cp source_file destination_file mv : renames files and/or moves files %mv old_filename new_filename %mv old_filename directory/new_name

pwd: print the current (working) directory %pwd cd: change directory %cd subdirectory_name %cd.. mkdir: make a new directory %mkdir subdirectory_name rmdir: remove a directory %rmdir subdirectory_name Basic Unix Commands Managing Directories

Basic Unix Commands Printing Files cat: concatenate the file to the screen (list the file) %cat file_name : or pipe the file to a selected output location %cat file_name | output_loc lpr: send to the printer %lpr file_name

Basic Unix Commands Invoking C and C++ compilers gcc: compile a C program to output file a.out %gcc program_file.c : with the math library option to a file my.out %gcc program_file.c -lm -o my.out g++: compile a C++ program to file a.out % g++ program_file.cpp

GNU Debugger (GDB) Use GDB to debug programs in C, C++, Modular-2, and Pascal, Fortran GDB is part of the GNU Project that was launched in 1984 to develop a complete UNIX style operating system.GNU Project Free software: the GNU system is free ( pronounced “guh-noo”) at software GDB is protected by the GNU General Public License (GPL)

Capabilities with GDB Start your program, specifying anything that might affect its behavior. Make your program stop on specified conditions. Examine what has happened, when your program has stopped. Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.

Starting GDB gcc filename with option –g gcc filename –g gdb in shell prompt with executable file gdb a.out gdb prompt – executing by gdb command (gdb) commands

GDB Commands list(l) – show the source list each 10line list [[file:]n|func] help – show the information of gdb command help [name] break – setup the breakpoint break [[file:]n|function]

GDB Commands - cont. clear – remove the breakpoint clear [[file:]n|function] run – begin program run [arglist] print expr – show the value of expr print expr

GDB Commands - cont. c (or continue) – continue the program c [n] next – execute n lines and display the line if the next line is the function, it executes the whole function. next [n]

GDB Commands - cont. step - execute n lines and display the line if the next line is the function, it executes n line inside the function. step [n] bt (or backtrace) – display the program stack’s order which functions are called in program

GDB Commands - cont. ret (or return) – exit the current function as return retrunvalue ret retval finish – execute the current function until the function returns the retval kill – quit the current debugging process quit – quit the gdb

Example – bugsome.c The program is to calculate factorial and power Not working for power function Setup the breakpoint as power function Program bugsome.c has been compiled with gcc to file a.out /home/dsk22/ xxx1234 /1320> gcc bugsome.c

#include /* returns n * (n-1) *... * 1 */ int factorial(int n) { if(n == 1) return 1; return n * factorial(n - 1); } /* returns b^e, e>=0 */ int power(int b, int e) { return b * power(b, e-1); } void f3() { printf("This is f3().\n"); } void f2() { f3(); printf("11^7 = %d\n", power(11, 7)); } void f1() { printf("11! = %d\n", factorial(11)); f2(); } int main() { f1(); printf("0! = %d\n", factorial(0)); return 0; } List – bugsome.c

Result – a.out /home/dsk22/ xxx1234 /1320> a.out 11! = This is f3(). Stack overflow: pid 315, proc a.out, addr 0x11fdfffe0, pc 0x bc /home: warning, disk quota exceeded for user id Segmentation fault (core dumped) /home/dsk22/xxx1234/1320>

Debugging example /home/dsk22/ xxx1234 /1320> gcc bugsome.c -g /home/dsk22/ xxx1234 /1320> gdb a.out GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.16 (alpha-dec-osf4.0), Copyright 1996 Free Software Foundation, Inc... (gdb) break power Breakpoint 1 at 0x d8: file bugsome.c, line 16.

Example continued (gdb) run Starting program: /home/dsk22/xxx1234/1320/a.out 11! = This is f3(). Breakpoint 1, power (b=11, e=7) at bugsome.c:16 16 return b * power(b, e-1); (gdb) c Continuing. Breakpoint 1, power (b=11, e=6) at bugsome.c:16 16 return b * power(b, e-1);

(gdb) c 3 Will ignore next 2 crossings of breakpoint 1. Continuing. Breakpoint 1, power (b=11, e=3) at bugsome.c:16 16 return b * power(b, e-1); (gdb) c Continuing. Breakpoint 1, power (b=11, e=2) at bugsome.c:16 16 return b * power(b, e-1); (gdb) c Continuing. Breakpoint 1, power (b=11, e=1) at bugsome.c:16 16 return b * power(b, e-1); (gdb) c Continuing. Breakpoint 1, power (b=11, e=0) at bugsome.c:16 16 return b * power(b, e-1);

(gdb) ret 1 Make power return now? (y or n) y #0 0x f8 in power (b=11, e=1) at bugsome.c:16 return b * power(b, e-1); (gdb) l 11 } /* returns b^e, e>=0 */ 14 int power(int b, int e) 15 { 16 return b * power(b, e-1); 17 } void f3() 20 {

(gdb) l 21 printf("This is f3().\n"); 22 } void f2() 25 { 26 f3(); 27 printf("11^7 = %d\n", power(11, 7)); 28 } void f1() (gdb) break 28 Breakpoint 2 at 0x c4: file bugsome.c, line 28. (gdb) c Continuing. 11^7 = Breakpoint 2, f2 () at bugsome.c:28 28 }

(gdb) n f1 () at bugsome.c:34 34 } (gdb) n main () at bugsome.c:41 41 printf("0! = %d\n", factorial(0)); (gdb) s factorial (n=0) at bugsome.c:7 7 if(n == 1) (gdb) l 2 #include 3 4 /* returns n * (n-1) *... * 1 */ 5 int factorial(int n) 6 { 7 if(n == 1) 8 return 1; 9 10 return n * factorial(n - 1); 11 }

(gdb) ret 1 Make factorial return now? (y or n) y #0 0x in main () at bugsome.c:41 41 printf("0! = %d\n", factorial(0)); (gdb) c Continuing. 0! = 1 Program exited normally. (gdb) quit