Environment & tools Assistant Anssi Jääskeläinen Visiting hours: Tuesdays 11-12 Room: 6606

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Makefiles. makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.c files.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Utilizing the GDB debugger to analyze programs Background and application.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
CS 202 Computer Science II Lab Fall 2009 September 24.
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
Systems Dev. Tutorial II: Make, utilities, & scripting Recitation Wednesday, Sept 13 th, 2006.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
ECE 353 WinAVR and C Debugging Tutorial By Adam Bailin ECE 353 Fall ‘06.
CS201 - Information. CS201 - Laboratories All labs will be done using Linux on the PC’s or esus. All labs MUST use Makefiles. First lab is due NEXT WEEK.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
Guide To UNIX Using Linux Third Edition
Memory & Storage Architecture Seoul National University Computer Architecture “ Bomb Lab Hints” 2nd semester, 2014 Modified version : The original.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
1 uClinux course Day 3 of 5 The uclinux toolchain, elf format and ripping a “hello world”
Gdb is the GNU debugger on our CS machines. gdb is most effective when it is debugging a program that has debugging symbols linked in to it. With gcc and.
CS140: Intro to CS An Overview of Programming in C by Erin Chambers.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Programming Tools gcc make utility Open Source code Static and Shared Libraries gdb Memory debugging tools.
COMP 171: Principles of Computer Science I John Barr.
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.
Developing C/C++ applications with the Eclipse CDT David Gallardo.
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.
Scons Writing Solid Code Overview What is scons? scons Basics Other cools scons stuff Resources.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Active-HDL Interfaces Debugging C Code Course 10.
CSE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ Eclipse –Widely available open-source debugging environment Available.
GNU Make Computer Organization II 1 © McQuain What is make ? make is a system utility for managing the build process (compilation/linking/etc).
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
1 SEEM3460 Tutorial Compiling and Debugging C programs.
CSE 351 GDB Introduction. Lab 1 Status? How is Lab 1 going? I’ll be available at the end of class to answer questions There are office hours later today.
Data Display Debugger (DDD)
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
COP 3530 Spring2012 Data Structures & Algorithms Discussion Session Week 2.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
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?
Debug in Visual Studio Windows Development Fundamentals LESSON 2.5A.
Emacs, Compilation, and Makefile C151 Multi-User Operating Systems.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Computer Programming A simple example /* HelloWorld: A simple C program */ #include int main (void) { printf (“Hello world!\n”); return.
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
CSC 1201 LAB RULES Nouf Aljaffan (C) CSC 1201 Course at KSU.
Advanced UNIX progamming Fall 2002 Instructor: Ashok Srinivasan Lecture 2 Class web site:
Lecture 1: Introduction UNIX programming environment –Editors –Remote shell setup –C compilers –Debugger –make.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
HP-SEE Debugging with GDB Vladimir Slavnic Research Assistant SCL, Institute of Physics Belgrade The HP-SEE initiative.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
1 CS 192 Lecture 4 Winter 2003 December 8-9, 2003 Dr. Shafay Shamail.
CSCI 4061 Recitation 2 1.
DEBUG.
Introduction to C Topics Compilation Using the gcc Compiler
CS1010: Intro Workshop.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Editor, Compiler, Linker, Debugger, Makefiles
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C Topics Compilation Using the gcc Compiler
gdb gdb is the GNU debugger on our CS machines.
Computer Architecture “Bomb Lab Hints”
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.
Getting Started: Developing Code with Cloud9
GNU DEBUGGER TOOL. What is the GDB ? GNU Debugger It Works for several languages – including C/C++ [Assembly, Fortran,Go,Objective-C,Pascal]
Homework Applied for cs240? (If not, keep at it!) 8/10 Done with HW1?
Video Notes.
CSCE 206 Lab Structured Programming in C
Introduction to C Topics Compilation Using the gcc Compiler
Debugging.
Makefiles, GDB, Valgrind
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.
Presentation transcript:

Environment & tools Assistant Anssi Jääskeläinen Visiting hours: Tuesdays Room: 6606

Arrangements Six programming assignments One home examination Every task is individual You must attend to minimum of 5 out of 6 practice sessions –Todays session is not count –Try to participate to the same practice group every time One or two persons are selected to present and EXPLAIN their code and demonstrate the application –Conversations –Modifications –Etc.

Requirements for assignments Comment your code –Even a total ignorant to C-code has to understand what is happening and where Use makefile –Make has to be able to compile your program in this class Add your name and student ID to the begin of every source code file Write a readme file that contains: –Instruction how to run program –Parameters –Other issues that may affect the program All assignments must be returned in order to pass the course Your program has to compile & work in this class room

Delay table -1 point minutes -Accepted but 0 points for this assignment More -2 points1 – 8 hours Penalty in pointsDelay time

Emacs Some basic commands –emacs ”filename” starts emacs and opens file –C-x C-s = save file –C-x C-w = save file to alternative name –C-x C-f = open/create file –C-x C-c = close emacs –C-x k = kill current buffer –C-x o = select another window –C-x 1 = get rid of all windows exept the selected one –C-x C-b = list current buffers –C-x b number = go to buffer number –F10 enter menu Arrow keys page up –List of commands Syntax highlighting –F10 – options – Syntax highlighting –Possible to automatically turn this on

Task Open your favourite editor and write a simple helloworld application #include //what is this int main(void) { printf("Hello world!\n"); //remember to comment your code return 0; } Save it

Tar / Gzip tar -cvvf foo.tar hello.c (Tar contents of folder foo to foo.tar) tar –xvvf foo.tar (extract foo.tar) tar –xvvzf foo.tar.gz (extract gzipped foo.tar.gz) gzip archive.tar gunzip arhive.tar.gz TASK –Back you hello files to tar.gz file

GCC Gnu Compiler Collection Options –g level = include debugging information Always use –g option –You may think your program is correct but there is no sense in pushing your luck.. –v = verbose mode –o = specify output file, default is a.out –Wall = All warning messages – TASK –Compile your helloworld with gcc –v –o helloword yourfilename.c –Run with./helloworld –Play with different compilation options (use man pages to find those)

Make Makefile tells make what to do –How to compile and link a program –How to clean up –man make

Makefile target: source file(s) command “gcc …” If only one target is specified in makefile, it will be automatically used just by running make Task –Write a makefile for your helloworld –Compile your program with make –Add makefile and compiled binaries to your tar.gz file

GDB the Gnu project debugger Allows you to see what is going on inside another program Can do four main kinds of things –Start your program, specify parameters –Make the program stop on specified conditions –Examine what has happened –Change things in the program This is not mandatory program to pass this course –But it may help you on your way

Using GDB GDB can be used alone or under Emacs –Start under emacs with F10  tools  debugger (or with mouse) cs/gdb_toc.html#SEC_Contentshttp://sourceware.org/gdb/current/onlinedo cs/gdb_toc.html#SEC_Contents Remember to use –g option when compiling

Continue Commands –Ctrl –c ends running program –List = lists loaded code –break n = sets breakpoint to line n –break try = sets break point to place where function try is called breaks can be conditional –break x if ownvariable>5 –step = runs next line of code –next = runs next line of code but does not enter functions –quit = quits debugging –list x = lists code around point x –where = shows current position in debugging

GDB task Write an error or errors to your helloworld –endless loop –Unaccessible condition –etc. –Anything is fine as long as it passes compiler Compile your code Debug it

Assignment 1 Simple UDP quiz Deadline – –Delay will lead to penalty client-server program, which implements a simple quiz for the users. One user creates a question and correct answer, others try to answer this. –First client that enters will get the question turn –Entered questions are submitted to all clients currently active (late arrivals should receive it also) –Question stays active until correct answer is given –Server gives question turn to other client –More specific instructions can be found from the assignment page

Other things Help desk might be available after this week Assistant can try to answer questions but result might not be that good.. Helpfull sources –Beej's Guide to Network Programming –google –BOOKS TCP/IP illustrated TCP/IP Sockets in C: Practical Guide for Programmers Linux Socket Programming by Example