1 Topics for this Lecture Build systems Static analysis.

Slides:



Advertisements
Similar presentations
Configuration management
Advertisements

Configuration management
CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
Computer Science 2212a/b - UWO1 Structural Testing Motivation The gcov Tool An example using gcov How does gcov do it gcov subtleties Further structural.
Compiling. Your C, C++ or Fortran program won’t work unless you compile it The compiler will build your program as an executable file (typically in the.
1 Psych 5500/6500 Measures of Central Tendency Fall, 2008.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION TESTING II Autumn 2011.
LECTURE 7 SEP 27, 2010 Building computational pipelines.
David Notkin Autumn 2009 CSE303 Lecture 20 static make.
Understanding Makefiles COMP 2400, Fall 2008 Prof. Chris GauthierDickey.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
20-Jun-15 Analysis of Algorithms II. 2 Basics Before we attempt to analyze an algorithm, we need to define two things: How we measure the size of the.
Russell Taylor Lecturer in Computing & Business Studies.
SM3121 Software Technology Mark Green School of Creative Media.
The Basic Tools Presented by: Robert E., & Jonathan Chase.
The Makefile Utility ABC – Chapter 11, Motivation Small programs single file “Not so small” programs : –Many lines of code –Multiple components.
Compiling and Linking. Compiling is quite the same as creating an executable file! Instead, creating an executable is a multistage process divided into.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Make: the good, the bad, and the ugly Dan Berger Titus Winters
Software Engineering 2003 Jyrki Nummenmaa 1 CASE Tools CASE = Computer-Aided Software Engineering A set of tools to (optimally) assist in each.
C Programming - Lecture 6 This lecture we will learn: –Error checking in C –What is a ‘wrappered function’? –What is a clean interface? –How to earn your.
1 Lecture 19 Configuration Management Software Engineering.
Makefiles CISC/QCSE 810. BeamApp and Tests in C++ 5 source code files After any modification, changed source needs to be recompiled all object files need.
Configuration Management (CM)
IT253: Computer Organization Lecture 3: Memory and Bit Operations Tonga Institute of Higher Education.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Debugging Strategies from Software Carpentry. Agan's Rules Many people make debugging harder than it needs to be by: Using inadequate tools Not going.
Unit Testing Maintaining Quality. How do you test? Testing to date…
Views Lesson 7.
Hank Childs, University of Oregon May 19 th & 21st, 2015 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ /
University of Utah SoCCS Lecture 121 Dynamic Models in Design CS6961 – Lecture 12 Nathan Dykman.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
CS5103 Software Engineering Lecture 02 More on Software Process Models.
Variables, Environments and Closures. Overview Touch on the notions of variable extent and scope Introduce the notions of lexical scope and dynamic.
Sep 13, 2006 Scientific Computing 1 Managing Scientific Computing Projects Erik Deumens QTP and HPC Center.
1 Running Experiments for Your Term Projects Dana S. Nau CMSC 722, AI Planning University of Maryland Lecture slides for Automated Planning: Theory and.
11 Computers, C#, XNA, and You Session 1.1. Session Overview  Find out what computers are all about ...and what makes a great programmer  Discover.
Version Control and SVN ECE 297. Why Do We Need Version Control?
21-Feb-16 Analysis of Algorithms II. 2 Basics Before we attempt to analyze an algorithm, we need to define two things: How we measure the size of the.
Build Tools 1. Building a program for a large project is usually managed by a build tool that controls the various steps involved. These steps may include:
Announcements Assignment 1 will be regraded for all who’s score (not percentage) is less than 6 (out of 65). If your score is 6 or higher, but you feel.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Announcements You will receive your scores back for Assignment 2 this week. You will have an opportunity to correct your code and resubmit it for partial.
Week 5 - Monday.  What did we talk about last time?  Processes  Lab 4.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
GNU Make Computer Organization II 1 © McQuain What is make ? make is a system utility for managing the build process (compilation/linking/etc).
CSE 351 Caches. Before we start… A lot of people confused lea and mov on the midterm Totally understandable, but it’s important to make the distinction.
Makefiles Manolis Koubarakis Data Structures and Programming Techniques 1.
Building programs LinuxChix-KE. What happens in your CPU? ● It executes a small set of instructions called "machine code" ● Each instruction is just a.
The make utility (original presentation courtesy of Alark Joshi)
Testing Tools & Standards
CSE 303 Lecture 17 Makefiles reading: Programming in C Ch. 15
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
C – Multi-file development and make
Topics Introduction to Repetition Structures
CSE 374 Programming Concepts & Tools
Makefile Tutorial CIS5027 Prof: Dr. Shu-Ching Chen
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
CSE 303 Concepts and Tools for Software Development
Analysis of Algorithms II
Build Tools (make) CSE 333 Autumn 2018
Tonga Institute of Higher Education IT 141: Information Systems
Appendix F C Programming Environment on UNIX Systems
CSc 352: Elementary “make”
Tonga Institute of Higher Education IT 141: Information Systems
LCC 6310 Computation as an Expressive Medium
The make utility (original presentation courtesy of Alark Joshi)
Presentation transcript:

1 Topics for this Lecture Build systems Static analysis

2 Topic 1: Build Systems In a simple world, compiling and running a computer program is simple: > gcc –o myexe myprogram.c >./myexe The world is not that simple most of the time, as you may notice if you’ve tried compiling any open source programs

3 How to Compile a Program Most larger programs require many complex commands with many arguments: > gcc –g –c lib1.c –DARCH_X86 –DLINUX –DDEBUG –D –ftest- coverage –fprofile-arcs –O0 > gcc –g –c lib2.c –DARCH_X86 –DLINUX –DDEBUG –D –ftest- coverage –fprofile-arcs > gcc –o mainexec m.c lib1.o lib2.o –DARCH_X86 –DLINUX – DDEBUG –D -ftest-coverage –fprofile-arcs – lm –DNO_X –O3 Compiling all the components of a modern software system may take a long time Building the software for Curiosity at JPL was a half hour process or more, from scratch, with hundreds of commands run

4 Not Just a Shell Script Simply bundling all the compilation into a script doesn’t solve the problem If you only change one file, which other files have to be recompiled? Do you start over? A script is a series of commands; if you want to take advantage of multiple machines, you have to design the parallelism yourself

5 Build Systems Again, automation comes to our rescue Build systems: Given a description including at least: Components of a system (files) How they depend on each other How to produce the ones that are not provided by humans A build system: Uses information on which files have been modified and which files don’t exist yet to produce the final products – for example, executables – for a system “Let the robot do the boring stuff!”

6 Build Systems Lots of different build systems Some are very simple, don’t do much beyond what I just described Others are very complex, attempt to determine dependencies for you, automatically parallelize compilation, etc. Sometimes integrated with figuring out local configuration (hardware, operating system, available tools) Sometimes integrated with source control or testing In this class, we’ll use a very simple system, make

7 Simple Structure of a Makefile See dominion/Makefile in the class repository Structure is like this: : : …

8 Simple Structure of a Makefile Textual representation of a graph: myprogram: libmytools.so myprogram.o … libmytools.so: mytools2.o mytools1.o … mytools1.o: mytools1.c … mytools2.o: mytools2.c … myprogram.o: myprogram.c … Clean: rm –rf *.o *.so myprogram

9 Simple Structure of a Makefile Typing > make Tries to create In particular, it first checks all the things depends on If any don’t exist, they are created If any are older than things they depend on, they are re-generated

10 Topic 2: Static Analysis Before we get to testing (our first big main topic) want to discuss another method for finding bugs Analyze the source code for bad “patterns” Happens to some extent every time you build a program Your compiler has to analyze the code to compile and optimize it gcc –Wall will warn you about some problems that might show up in testing

11 What is Static Analysis? Called “static” analysis because it analyzes your program without running it Analysis that runs the program is called “dynamic” analysis (testing is the most common dynamic analysis) Differs in a few key ways: Static analysis can catch bugs without a test case – just by structure of code Static analysis can give “false positives” – warn you about a problem that can’t actually show up when the program runs

12 Static Analysis: Not Just Compilers While the compiler does some limited “bug hunting” during compilation, that’s not its main job There are dedicated tools for analyzing source code for bugs A few such tools include: Uno (open source, available on the web) Coverity (paid software, quite pricey but very powerful, used by NASA and others) Klocwork CodeSonar Won’t say much about these in this class, because they are typically fairly easy to use, just run them on your code

13 Static Analysis: Not Just Compilers Testing, on the other hand, requires more work from the programmer/test engineer So why not prefer static analysis in general? Static analysis is generally limited to simple properties – don’t reference null pointers, don’t go outside array bounds Also good for some security properties But very hard/impossible to check things like “this sort routine really sorts things”