Lecture 1: Introduction UNIX programming environment –Editors –Remote shell setup –C compilers –Debugger –make.

Slides:



Advertisements
Similar presentations
C++ Development on Linux Agenda Introduction Editors Debuggers GUI IDEs Make Automake Exploring further.
Advertisements

Utilizing the GDB debugger to analyze programs Background and application.
Today ’ s Topic Breakdown of GCC script Breakdown of GCC script Description of how different system programs work together to build (and run) a C program.
Separate compilation Large programs are generally separated into multiple files, e.g. tuples.h, ray.h, ray.c, tuples.c main.c With several files, we can.
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 The CS-220 Development Environment.
1 The Makefile Utility ABC – Chapter 11,
Environment & tools Assistant Anssi Jääskeläinen Visiting hours: Tuesdays Room: 6606
The Makefile Utility ABC – Chapter 11, Motivation Small programs single file “Not so small” programs : –Many lines of code –Multiple components.
CS Lecture 11 Outline Compiling C programs using gcc Archiving modules Using Makefiles Debugging using gdb Assignment 3 discussion Lecture 111CS.
1 ENERGY 211 / CME 211 Lecture 2 September 24, 2008.
DDD tutorial A GDB Graphical User Interface. DDD Introduction If you find GDB difficult to use, try DDD DDD s GDB but with a Graphical User Interface.
Lecture 2: Miscellaneous UNIX/C concepts –Key based authentication and remote shell –Portable C programs and C standards –Debugger –Make –Some commonly.
Guide To UNIX Using Linux Third Edition
The Makefile Utility ABC – Chapter 11, Motivation Small programs single file “Not so small” programs : –Many lines of code –Multiple components.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Lecture 8  make. Overview: Development process  Creation of source files (.c,.h,.cpp)  Compilation (e.g. *.c  *.o) and linking  Running and testing.
1 CS 161 Introduction to Programming and Problem Solving Chapter 10 g++ Compiler Usage Herbert G. Mayer, PSU Status 10/21/2014.
Unix Makefiles COP 3330 Lecture Notes Dr. David A. Gaitros.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
리눅스 : Lecture 5 UNIX 유틸리티 : text editor, compilation (make), …
August 7, 2003Serguei A. Mokhov, 1 gcc Tutorial COMP 444/5201 Revision 1.1 Date: January 25, 2004.
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.
LINUX Tuesday, 5 July :00 pm. Remote Login l Use Secure Shell (ssh) l Machine name/IP address E.g. ssh hydra.sma.nus.edu.sg Or ssh
Old Chapter 10: Programming Tools A Developer’s Candy Store.
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.
CS240 Computer Science II Introduction the Unix File System and File Related Utilities Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
Chapter Ten g++ and make1 System Programming Software Development: g++ and make.
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
C Tutorial - Program Organization CS Introduction to Operating Systems.
A Tutorial on Introduction to gdb By Sasanka Madiraju Graduate Assistant Center for Computation and Technology.
Executing a C Program Creating the Program Compilation Linking Execution.
1 SEEM3460 Tutorial Compiling and Debugging C programs.
Data Display Debugger (DDD)
Unix Machine In Computer Science for Teaching Cliff Zou Spring 2015.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
Unix Servers Used in This Class  Two Unix servers set up in CS department will be used for some programming projects  Machine name: eustis.eecs.ucf.edu.
Lecture 8  make. Using make for compilation  With medium to large software projects containing many files, it’s difficult to: Type commands to compile.
COP 3530 Spring 12 Discussion Session 1. Agenda 1.Introduction 2.Remote programming 3.Separate code 4.Compile -- g++,makefile 5.Debug -- gdb 6.Questions?
Department of Electronic & Electrical Engineering Introduction to C - The Development cycle. Why C? The development cycle. Using Visual Studio ? A simple.
Emacs, Compilation, and Makefile C151 Multi-User Operating Systems.
Advanced UNIX progamming Fall 2002 Instructor: Ashok Srinivasan Lecture 2 Class web site:
CSc 352 An Introduction to make Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
Makefile Script file to automate program compilation and linking (making) 1. Write the "makefile" 2. Write your programs 3. Run "make" or "make -f makefile"
UNIX Development: g++ and make CS 2204 Class meeting 8 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
系統程式 System Programming 羅習五 國立中正大學資訊工程學系 Class: EA-001 (05) ext.
COMP 2710 Software Construction Prepare Your Development Environment Dr. Xiao Qin Auburn University
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
Makefiles CSSE 332 Operating Systems
How to Program.
How to Start Programming in Linux Environment
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
Editor, Compiler, Linker, Debugger, Makefiles
Operating System Discussion Section.
Makefile Tutorial CIS5027 Prof: Dr. Shu-Ching Chen
What is make? make is a system utility for managing the build process (compilation/linking/etc). There are various versions of make; these notes discuss.
Prof: Dr. Shu-Ching Chen TA: Yimin Yang
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Makefiles and the make utility
Unix Programming Environment
Creating your first C program
CMPSC 60: Week 4 Discussion
Appendix F C Programming Environment on UNIX Systems
Introduction to Emacs J. Caldwell, N. McCaw, D. Powell
Video Notes.
CSc 352 An Introduction to make
Makefiles and the make utility
Makefiles, GDB, Valgrind
Presentation transcript:

Lecture 1: Introduction UNIX programming environment –Editors –Remote shell setup –C compilers –Debugger –make

Editors: –Ed, vi, pico, and emacs –What is good about emacs? Emacs is more than just an editor. Multiple windows Running shell commands within emacs If you know lisp, you can expand its functionality. Some useful commands to get started: –C-h t get tutorial –C-g cancel commands (do it when you get stuck) –C-x C-c get out of emacs and save file –C-h help

Remote shell: –To run a command on a remote machine without typing in the password. –Remote ssh from machine A to machine B Step 1: at machine A: ssh-keygen –t rsa (do not enter any pass phrase, just keep typing “enter”) Step 2: append A:.ssh/id_rsa.pub to B:.ssh/authorized_keys –After these steps, you should be able to run remote command.

C compilers: –gcc, cc –Using ANSI C, the code must pass –Wall –ansi –pedantic with no warning messages –See the example code (example1.c), how to fix the errors/warnings?example1.c –Some examples: gcc –g –c –Wall –ansi –pedentic example.c gcc –Wall –ansi –pedantic example1.c example2.c gcc –g example.o gcc –g example.o -lm

Debugger: –The code must be compiled with –g option. –ddd, xxgdb, gdb –The power of a debugger: Finding the line that causes coredump. See example: –Break point/show value/change value/step/next/continue/print Very efficient in debugging sequential code Not very effective in debugging concurrent code (multiple threads, multiple processes)

Make make [-f makefile][option] target A tool to update files that are derived from other files. Great for software development. The default files for make are./makefile,./Makefile,./s.makefile, ……in order The default files can be overwrite with the –f option –make –f myprog.mk The makefile has three components: –Macros: define constants –Target rules: tell how to make targets –Inference rules: also tell how to make targets, make will first check if a target rule can apply before it checks the inference rules.

Macros: –String1 = string2 –E.g. CC=gcc – CFLAG=-Wall –ansi –pedantic Target rules: –Target [target…] : [prerequisite…] – command –… –Example: –a.out : myprog1.c myprog2.c myprog3.c – $(CC) myprog1.c myprog2.c myprog3.c

Inference rules: –Target: – command –… Target must be of the form.s1 or.s1.s2 where.s1 and.s2 must be prerequisites of the.SUFFIXES special target. –.s1.s2  make *.s2 from *.s1 –.s1  make * from *.s1 Example:. c: $(CC) –o $<.c.o $(CC) –c $<

See the example makefiles –How to modify the makefile if I want only recompile one file instead of the whole system? A file with inference rules.