CSC209 - Software Tools and System Programming

Size: px
Start display at page:

Download "CSC209 - Software Tools and System Programming"

Transcription

1 CSC209 - Software Tools and System Programming Fall, 2016 Lab 6 Stathis Maneas smaneas@cs.toronto.edu October 28, 2016

2 Miscellaneous Room: BA 3175 Fridays: 10:00-11:00 am Lecture Duration: ~20 Questions: 40 Download this lecture from: Ask me as many questions as possible! Send me s with your questions!

3 Course Resources Course website: Course forum: PCRS: MarkUs:

4 Valgrind An instrumentation framework for building dynamic analysis tools. Automatic detection of memory management bugs. Threading bugs are detected as well, but for now, we will focus on memory management only. Use the -g compilation flag in order to enable debug symbols.

5 Valgrind - Memcheck A memory error detector tool (enabled by default). Specify the --tool=memcheck flag on the Valgrind command line. It can be used to detect the following problems (among others): Usage of uninitialized variables. Reading/Writing memory that has already been freed. Reading/Writing after the end of a malloc d block. Incorrect freeing of heap memory. Memory leaks.

6 Valgrind - Uninitialized Variables (1/7) The C compiler does not initialize any declared variable. A very common source of errors: Dereferencing uninitialized pointers. Uninitialized accumulators and counters, etc.

7 Valgrind - Uninitialized Variables (2/7) #include <stdio.h> int main() { int x; printf ("x = %d\n", x); return 0; } What s the problem in this code snippet?

8 Valgrind - Uninitialized Variables (3/7) #include <stdio.h> int main() { int x; printf ("x = %d\n", x); return 0; } wolf:~/lab6$ gcc -Wall -g -std=c99 -o lab6 lab6.c lab6.c: In function 'main': lab6.c:4:9: warning: 'x' is used uninitialized in this function [-Wuninitialized] printf ("x = %d\n", x);

9 Valgrind - Uninitialized Variables (4/7) wolf:~/lab6$ valgrind --tool=memcheck lab6 ==33083== Memcheck, a memory error detector ==33083== Use of uninitialised value of size 8 ==33083== at 0x4E8099B: _itoa_word (_itoa.c:179) ==33083== by 0x4E84636: vfprintf (vfprintf.c:1660) ==33083== by 0x4E8B3D8: printf (printf.c:33) ==33083== by 0x400548: main (lab6.c:4)

10 Valgrind - Uninitialized Variables (5/7) #include <stdio.h> int main() { char *s; char ch = *s; printf ("The first character of the string is: %c\n", ch); return 0; } What s the problem in this code snippet?

11 Valgrind - Uninitialized Variables (6/7) #include <stdio.h> int main() { char *s; char ch = *s; printf ("The first character of the string is: %c\n", ch); return 0; } wolf:~/lab6$ gcc -Wall -g -std=c99 -o lab6 lab6.c lab6.c: In function 'main': lab6.c:4:7: warning: 's' is used uninitialized in this function [-Wuninitialized] char ch = *s;

12 Valgrind - Uninitialized Variables (7/7) wolf:~/lab6$ valgrind --tool=memcheck lab6 ==42849== Memcheck, a memory error detector ==42849== Use of uninitialised value of size 8 ==42849== at 0x400539: main (lab6.c:4) ==42849== ==42849== Invalid read of size 1 ==42849== at 0x400539: main (lab6.c:4) ==42849== Address 0x0 is not stack'd, malloc'd or (recently) free'd

13 Valgrind - Reading/Writing memory that has already been freed (1/3) #include <stdio.h> #include <stdlib.h> int main() { char *ptr = malloc(sizeof(char)); *ptr = A ; free(ptr); printf ("The pointer points to: %c\n", *ptr); return 0; } What s the problem in this code snippet?

14 Valgrind - Reading/Writing memory that has already been freed (2/3) #include <stdio.h> #include <stdlib.h> int main() { char *ptr = malloc(sizeof(char)); *ptr = A ; free(ptr); } printf ("The pointer points to: %c\n", *ptr); return 0; The code compiles without any errors or warnings!

15 Valgrind - Reading/Writing memory that has already been freed (3/3) wolf:~/lab6$ valgrind --tool=memcheck lab6 ==44888== Memcheck, a memory error detector ==44888== Invalid read of size 1 ==44888== at 0x4005EA: main (lab6.c:7) ==44888== Address 0x51fc040 is 0 bytes inside a block of size 1 free'd ==44888== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==44888== by 0x4005E5: main (lab6.c:6)

16 Valgrind - Reading/Writing memory after the end of a malloc d block (1/3) #include <stdio.h> #include <stdlib.h> int main() { } char *ptr = malloc(sizeof(char)); *ptr = A ; char ch = *(ptr + 1); printf ("The character equals to: %c\n", ch); free(ptr); return 0; What s the problem in this code snippet?

17 Valgrind - Reading/Writing memory after the end of a malloc d block (2/3) #include <stdio.h> #include <stdlib.h> int main() { } char *ptr = malloc(sizeof(char)); *ptr = A ; char ch = *(ptr+1); printf ("The character equals to: %c\n", ch); free(ptr); return 0; The code compiles without any errors or warnings!

18 Valgrind - Reading/Writing memory after the end of a malloc d block (3/3) wolf:~/lab6$ valgrind --tool=memcheck lab6 ==45461== Memcheck, a memory error detector ==45461== Invalid read of size 1 ==45461== at 0x4005DE: main (lab6.c:6) ==45461== Address 0x51fc041 is 0 bytes after a block of size 1 alloc'd ==45461== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==45461== by 0x4005CE: main (lab6.c:4)

19 Valgrind - Incorrect freeing of heap memory (1/3) #include <stdio.h> #include <stdlib.h> int main() { } char *ptr = malloc(sizeof(char)); *ptr = A ; printf ("The pointer points to: %c\n", *ptr); free(ptr); free(ptr); return 0; What s the problem in this code snippet?

20 Valgrind - Incorrect freeing of heap memory (2/3) #include <stdio.h> #include <stdlib.h> int main() { } char *ptr = malloc(sizeof(char)); *ptr = A ; printf ("The pointer points to: %c\n", *ptr); free(ptr); free(ptr); return 0; The code compiles without any errors or warnings!

21 Valgrind - Incorrect freeing of heap memory (3/3) wolf:~/lab6$ valgrind --tool=memcheck lab6 ==45699== Memcheck, a memory error detector ==45699== Invalid free() / delete / delete[] / realloc() ==45699== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==45699== by 0x40060C: main (lab6.c:8) ==45699== Address 0x51fc040 is 0 bytes inside a block of size 1 free'd ==45699== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==45699== by 0x400600: main (lab6.c:7)

22 Valgrind - Memory Leaks (1/4) It keeps track of all heap blocks allocated by a program. Specify the --leak-check=full flag on the Valgrind command line. For each block, there are four possible leaks: "Still reachable": The block pointer exist, but it was never freed. "Definitely lost": No pointers to the block can be found. "Indirectly lost": The block is lost, because all the blocks that point to it are lost. "Possibly lost".

23 Valgrind - Memory Leaks (2/4) #include <stdio.h> #include <stdlib.h> int main() { } char *ptr = malloc(sizeof(char)); *ptr = A ; printf ("The pointer points to: %c\n", *ptr); return 0; What s the problem in this code snippet?

24 Valgrind - Memory Leaks (3/4) #include <stdio.h> #include <stdlib.h> int main() { } char *ptr = malloc(sizeof(char)); *ptr = A ; printf ("The pointer points to: %c\n", *ptr); /* free(ptr); */ return 0; The code compiles without any errors or warnings!

25 Valgrind - Memory Leaks (4/4) wolf:~/lab6$ valgrind --tool=memcheck --leak-check=full lab6 == == Memcheck, a memory error detector ==46503== in use at exit: 1 bytes in 1 blocks ==46503== total heap usage: 1 allocs, 0 frees, 1 bytes allocated ==46503== 1 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==46503== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==46503== by 0x40058E: main (lab6.c:4)

Building Embedded Systems

Building Embedded Systems All Rights Reserved. The contents of this document cannot be reproduced without prior permission of the authors. Building Embedded Systems Chapter 5: Maintenance and Debugging Andreas Knirsch andreas.knirsch@h-da.de

More information

Software Development Tools for Embedded Systems. Hesen Zhang

Software Development Tools for Embedded Systems. Hesen Zhang Software Development Tools for Embedded Systems Hesen Zhang What Are Tools? a handy tool makes a handy man What Are Software Development Tools? Outline Debug tools GDB practice Debug Agent Design Debugging

More information

Get the Better of Memory Leaks with Valgrind Whitepaper

Get the Better of Memory Leaks with Valgrind Whitepaper WHITE PAPER Get the Better of Memory Leaks with Valgrind Whitepaper Memory leaks can cause problems and bugs in software which can be hard to detect. In this article we will discuss techniques and tools

More information

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists Lecture 11 Doubly Linked Lists & Array of Linked Lists In this lecture Doubly linked lists Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for a Sparse

More information

Leak Check Version 2.1 for Linux TM

Leak Check Version 2.1 for Linux TM Leak Check Version 2.1 for Linux TM User s Guide Including Leak Analyzer For x86 Servers Document Number DLC20-L-021-1 Copyright 2003-2009 Dynamic Memory Solutions LLC www.dynamic-memory.com Notices Information

More information

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example Announcements Memory management Assignment 2 posted, due Friday Do two of the three problems Assignment 1 graded see grades on CMS Lecture 7 CS 113 Spring 2008 2 Safe user input If you use scanf(), include

More information

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Dr. Martin O. Steinhauser University of Basel Graduate Lecture Spring Semester 2014 Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Friday, 7 th March

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Purify User s Guide. Version 4.1 support@rational.com http://www.rational.com

Purify User s Guide. Version 4.1 support@rational.com http://www.rational.com Purify User s Guide Version 4.1 support@rational.com http://www.rational.com IMPORTANT NOTICE DISCLAIMER OF WARRANTY Rational Software Corporation makes no representations or warranties, either express

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

Pitfalls in Embedded Software

Pitfalls in Embedded Software Pitfalls in Embedded Software..and how to avoid them Sagar Behere 31 March 2014 Pitfalls in Embedded Software 1 / 19 What is wrong with this code? unsigned int count = BigValue; for (int i = 0; i < count;

More information

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint) TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions

More information

Testing for Security

Testing for Security Testing for Security Kenneth Ingham September 29, 2009 1 Course overview The threat that security breaches present to your products and ultimately your customer base can be significant. This course is

More information

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes Content Introduction and History File I/O The File System Shell Programming Standard Unix Files and Configuration Processes Programs are instruction sets stored on a permanent medium (e.g. harddisc). Processes

More information

Static Code Analysis Procedures in the Development Cycle

Static Code Analysis Procedures in the Development Cycle Static Code Analysis Procedures in the Development Cycle Tools, Technology, and Process in Engineering at Microsoft Mooly Beeri Microsoft Haifa R&D Center Agenda Static code analysis tools PREfix and PREfast

More information

Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11

Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11 Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11 In this lab, you will first learn how to use pointers to print memory addresses of variables. After that, you will learn

More information

Jonathan Worthington Scarborough Linux User Group

Jonathan Worthington Scarborough Linux User Group Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.

More information

TOOL EVALUATION REPORT: FORTIFY

TOOL EVALUATION REPORT: FORTIFY TOOL EVALUATION REPORT: FORTIFY Derek D Souza, Yoon Phil Kim, Tim Kral, Tejas Ranade, Somesh Sasalatti ABOUT THE TOOL Background The tool that we have evaluated is the Fortify Source Code Analyzer (Fortify

More information

An Implementation of a Tool to Detect Vulnerabilities in Coding C and C++

An Implementation of a Tool to Detect Vulnerabilities in Coding C and C++ An Implementation of a Tool to Detect Vulnerabilities in Coding C and C++ GRADUATE PROJECT REPORT Submitted to the Faculty of The School of Engineering & Computing Sciences Texas A&M University-Corpus

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

Example 1/24. Example

Example 1/24. Example Example CandC++. Misc. Library Features Gotchas Hints n Tips int **ppi int *pi int i char *pc char c Stephen Clark 5 University of Cambridge (heavily based on last year s notes (Andrew Moore) with thanks

More information

Valgrind Documentation

Valgrind Documentation Valgrind Documentation Release 3.10.0 10 September 2014 Copyright 2000-2014 AUTHORS Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,

More information

RTI Monitoring Library Getting Started Guide

RTI Monitoring Library Getting Started Guide RTI Monitoring Library Getting Started Guide Version 5.1.0 2011-2013 Real-Time Innovations, Inc. All rights reserved. Printed in U.S.A. First printing. December 2013. Trademarks Real-Time Innovations,

More information

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security Software security Buffer overflow attacks SQL injections Lecture 11 EIT060 Computer Security Buffer overflow attacks Buffer overrun is another common term Definition A condition at an interface under which

More information

Eliminate Memory Errors and Improve Program Stability

Eliminate Memory Errors and Improve Program Stability Eliminate Memory Errors and Improve Program Stability with Intel Parallel Studio XE Can running one simple tool make a difference? Yes, in many cases. You can find errors that cause complex, intermittent

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

CSC230 Getting Starting in C. Tyler Bletsch

CSC230 Getting Starting in C. Tyler Bletsch CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly

More information

Illustration 1: Diagram of program function and data flow

Illustration 1: Diagram of program function and data flow The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline

More information

CP Lab 2: Writing programs for simple arithmetic problems

CP Lab 2: Writing programs for simple arithmetic problems Computer Programming (CP) Lab 2, 2015/16 1 CP Lab 2: Writing programs for simple arithmetic problems Instructions The purpose of this Lab is to guide you through a series of simple programming problems,

More information

8.5. <summary>...26 9. Cppcheck addons...27 9.1. Using Cppcheck addons...27 9.1.1. Where to find some Cppcheck addons...27 9.2.

8.5. <summary>...26 9. Cppcheck addons...27 9.1. Using Cppcheck addons...27 9.1.1. Where to find some Cppcheck addons...27 9.2. Cppcheck 1.72 Cppcheck 1.72 Table of Contents 1. Introduction...1 2. Getting started...2 2.1. First test...2 2.2. Checking all files in a folder...2 2.3. Excluding a file or folder from checking...2 2.4.

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

Chapter 13 Storage classes

Chapter 13 Storage classes Chapter 13 Storage classes 1. Storage classes 2. Storage Class auto 3. Storage Class extern 4. Storage Class static 5. Storage Class register 6. Global and Local Variables 7. Nested Blocks with the Same

More information

ECS 165B: Database System Implementa6on Lecture 2

ECS 165B: Database System Implementa6on Lecture 2 ECS 165B: Database System Implementa6on Lecture 2 UC Davis, Spring 2011 Por6ons of slides based on earlier ones by Raghu Ramakrishnan, Johannes Gehrke, Jennifer Widom, Bertram Ludaescher, and Michael Gertz.

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

CTNET Field Protocol Specification November 19, 1997 DRAFT

CTNET Field Protocol Specification November 19, 1997 DRAFT CTNET Field Protocol Specification November 19, 1997 DRAFT Introduction Version 1.0 of CTNET will support the AB3418 protocol for communication to field controllers. AB3418 is a point-topoint protocol

More information

OpenGL Insights. Edited by. Patrick Cozzi and Christophe Riccio

OpenGL Insights. Edited by. Patrick Cozzi and Christophe Riccio OpenGL Insights Edited by Patrick Cozzi and Christophe Riccio ARB debug output: A Helping Hand for Desperate Developers 33 António Ramires Fernandes and Bruno Oliveira 33.1 Introduction Since the inception

More information

Off-by-One exploitation tutorial

Off-by-One exploitation tutorial Off-by-One exploitation tutorial By Saif El-Sherei www.elsherei.com Introduction: I decided to get a bit more into Linux exploitation, so I thought it would be nice if I document this as a good friend

More information

MatrixSSL Porting Guide

MatrixSSL Porting Guide MatrixSSL Porting Guide Electronic versions are uncontrolled unless directly accessed from the QA Document Control system. Printed version are uncontrolled except when stamped with VALID COPY in red. External

More information

For a 64-bit system. I - Presentation Of The Shellcode

For a 64-bit system. I - Presentation Of The Shellcode #How To Create Your Own Shellcode On Arch Linux? #Author : N3td3v!l #Contact-mail : 4nonymouse@usa.com #Website : Nopotm.ir #Spcial tnx to : C0nn3ct0r And All Honest Hackerz and Security Managers I - Presentation

More information

Simple C Programs. Goals for this Lecture. Help you learn about:

Simple C Programs. Goals for this Lecture. Help you learn about: Simple C Programs 1 Goals for this Lecture Help you learn about: Simple C programs Program structure Defining symbolic constants Detecting and reporting failure Functionality of the gcc command Preprocessor,

More information

Java Programming. Binnur Kurt binnur.kurt@ieee.org. Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.

Java Programming. Binnur Kurt binnur.kurt@ieee.org. Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0. Java Programming Binnur Kurt binnur.kurt@ieee.org Istanbul Technical University Computer Engineering Department Java Programming 1 Version 0.0.4 About the Lecturer BSc İTÜ, Computer Engineering Department,

More information

MPI-Checker Static Analysis for MPI

MPI-Checker Static Analysis for MPI MPI-Checker Static Analysis for MPI Alexander Droste, Michael Kuhn, Thomas Ludwig November 15, 2015 Motivation 2 / 39 Why is runtime analysis in HPC challenging? Large amount of resources are used State

More information

C Interview Questions

C Interview Questions http://techpreparation.com C Interview Questions And Answers 2008 V i s i t T e c h P r e p a r a t i o n. c o m f o r m o r e i n t e r v i e w q u e s t i o n s a n d a n s w e r s C Interview Questions

More information

Dynamic Taint Analysis for Automatic Detection, Analysis, and Signature Generation of Exploits on Commodity Software

Dynamic Taint Analysis for Automatic Detection, Analysis, and Signature Generation of Exploits on Commodity Software Dynamic Taint Analysis for Automatic Detection, Analysis, and Signature Generation of Exploits on Commodity Software James Newsome jnewsome@ece.cmu.edu Carnegie Mellon University Abstract Software vulnerabilities

More information

System Calls Related to File Manipulation

System Calls Related to File Manipulation KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 12 System Calls Related to File Manipulation Objective: In this lab we will be

More information

3 - Lift with Monitors

3 - Lift with Monitors 3 - Lift with Monitors TSEA81 - Computer Engineering and Real-time Systems This document is released - 2015-11-24 version 1.4 Author - Ola Dahl, Andreas Ehliar Assignment - 3 - Lift with Monitors Introduction

More information

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation Dynamic Storage Allocation CS 44 Operating Systems Fall 5 Presented By Vibha Prasad Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need

More information

Debugging & Profiling with Open Source SW Tools

Debugging & Profiling with Open Source SW Tools Debugging & Profiling with Open Source SW Tools Ivan Giro*o igiro*o@ictp.it Informa(on & Communica(on Technology Sec(on (ICTS) Interna(onal Centre for Theore(cal Physics (ICTP) What is Debugging?! Iden(fying

More information

Parallel Computing. Shared memory parallel programming with OpenMP

Parallel Computing. Shared memory parallel programming with OpenMP Parallel Computing Shared memory parallel programming with OpenMP Thorsten Grahs, 27.04.2015 Table of contents Introduction Directives Scope of data Synchronization 27.04.2015 Thorsten Grahs Parallel Computing

More information

Improve C++ Code Quality with Static Security Analysis (SSA)

Improve C++ Code Quality with Static Security Analysis (SSA) with Static Security Analysis (SSA) with Intel Parallel Studio XE This document is an introductory tutorial describing how to use static security analysis (SSA) on C++ code to improve software quality,

More information

JetBrains ReSharper 2.0 Overview Introduction ReSharper is undoubtedly the most intelligent add-in to Visual Studio.NET 2003 and 2005. It greatly increases the productivity of C# and ASP.NET developers,

More information

PSM/SAK Event Log Error Codes

PSM/SAK Event Log Error Codes PSM Error Codes PSM/SAK Event Log Error Codes If you experience a problem using Persistent Storage Manager, the following list of event log messages can be used to troubleshoot. Error codes are logged

More information

csce4313 Programming Languages Scanner (pass/fail)

csce4313 Programming Languages Scanner (pass/fail) csce4313 Programming Languages Scanner (pass/fail) John C. Lusth Revision Date: January 18, 2005 This is your first pass/fail assignment. You may develop your code using any procedural language, but you

More information

Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr

Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr Copyright c 2007-2010 Xavier Clerc cadmium@x9c.fr Released under the LGPL version 3 February 6, 2010 Abstract: This

More information

Forensic Analysis of Internet Explorer Activity Files

Forensic Analysis of Internet Explorer Activity Files Forensic Analysis of Internet Explorer Activity Files by Keith J. Jones keith.jones@foundstone.com 3/19/03 Table of Contents 1. Introduction 4 2. The Index.dat File Header 6 3. The HASH Table 10 4. The

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

How to write a CGI for the Apache Web server in C

How to write a CGI for the Apache Web server in C How to write a CGI for the Apache Web server in C The Com/PC Embedded Gateway Linux (EGL/2) operating system comes with a pre-installed Apache Web server. Please see also mht-cpc1l-07.pdf: How to use the

More information

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() CS61: Systems Programming and Machine Organization Harvard University, Fall 2009 Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() Prof. Matt Welsh October 6, 2009 Topics for today Dynamic

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved. 1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

More information

GDB Tutorial. A Walkthrough with Examples. CMSC 212 - Spring 2009. Last modified March 22, 2009. GDB Tutorial

GDB Tutorial. A Walkthrough with Examples. CMSC 212 - Spring 2009. Last modified March 22, 2009. GDB Tutorial A Walkthrough with Examples CMSC 212 - Spring 2009 Last modified March 22, 2009 What is gdb? GNU Debugger A debugger for several languages, including C and C++ It allows you to inspect what the program

More information

Oracle Solaris Studio Code Analyzer

Oracle Solaris Studio Code Analyzer Oracle Solaris Studio Code Analyzer The Oracle Solaris Studio Code Analyzer ensures application reliability and security by detecting application vulnerabilities, including memory leaks and memory access

More information

esrever gnireenigne tfosorcim seiranib

esrever gnireenigne tfosorcim seiranib esrever gnireenigne tfosorcim seiranib Alexander Sotirov asotirov@determina.com CanSecWest / core06 Reverse Engineering Microsoft Binaries Alexander Sotirov asotirov@determina.com CanSecWest / core06 Overview

More information

AN APPROACH TO RESOURCE MANAGEMENT OF C/C++ APPLICATIONS

AN APPROACH TO RESOURCE MANAGEMENT OF C/C++ APPLICATIONS STUDIA UNIV. BABEŞ BOLYAI, INFORMATICA, Volume LIX, Number 2, 2014 AN APPROACH TO RESOURCE MANAGEMENT OF C/C++ APPLICATIONS HANNELORE MĂRGINEAN AND SIMONA MOTOGNA Abstract. In this paper we will present

More information

Chapter 9, More SQL: Assertions, Views, and Programming Techniques

Chapter 9, More SQL: Assertions, Views, and Programming Techniques Chapter 9, More SQL: Assertions, Views, and Programming Techniques 9.2 Embedded SQL SQL statements can be embedded in a general purpose programming language, such as C, C++, COBOL,... 9.2.1 Retrieving

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

Lecture 22: C Programming 4 Embedded Systems

Lecture 22: C Programming 4 Embedded Systems Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human

More information

CS 253: Intro to Systems Programming

CS 253: Intro to Systems Programming CS 253: Intro to Systems Programming Spring 2014 Amit Jain, Shane Panter, Marissa Schmidt Department of Computer Science College of Engineering Boise State University Logistics Instructor: Amit Jain http://cs.boisestate.edu/~amit

More information

Hands-on CUDA exercises

Hands-on CUDA exercises Hands-on CUDA exercises CUDA Exercises We have provided skeletons and solutions for 6 hands-on CUDA exercises In each exercise (except for #5), you have to implement the missing portions of the code Finished

More information

C Dynamic Data Structures. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

C Dynamic Data Structures. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell C Dynamic Data Structures University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell Data Structures A data structure is a particular organization of data in memory. We want to

More information

ROM Monitor. Entering the ROM Monitor APPENDIX

ROM Monitor. Entering the ROM Monitor APPENDIX APPENDIX B This appendix describes the Cisco router ROM monitor (also called the bootstrap program). The ROM monitor firmware runs when the router is powered up or reset. The firmware helps to initialize

More information

System Calls and Standard I/O

System Calls and Standard I/O System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services

More information

Working with Buffers

Working with Buffers University Hamburg Department of Informatics Scientific Computing Research Group Working with Buffers Seminar Paper Seminar Efficient Programming in C Christoph Brauer 0brauer@informatik.uni-hamburg.de

More information

Written by the Red Hat Eclipse Engineering Team Revision 3. October 2003

Written by the Red Hat Eclipse Engineering Team Revision 3. October 2003 ! " $#&%'() Abstract This white paper provides information on Red Hat Developer Suite, a member of the Red Hat Applications product family. It describes the goals of Red Hat Developer Suite, the Eclipse

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

RADIUS Server Load Balancing

RADIUS Server Load Balancing The feature distributes authentication, authorization, and accounting (AAA) authentication and accounting transactions across RADIUS servers in a server group These servers can share the AAA transaction

More information

Using the Intel Inspector XE

Using the Intel Inspector XE Using the Dirk Schmidl schmidl@rz.rwth-aachen.de Rechen- und Kommunikationszentrum (RZ) Race Condition Data Race: the typical OpenMP programming error, when: two or more threads access the same memory

More information

CUDA Tools for Debugging and Profiling. Jiri Kraus (NVIDIA)

CUDA Tools for Debugging and Profiling. Jiri Kraus (NVIDIA) Mitglied der Helmholtz-Gemeinschaft CUDA Tools for Debugging and Profiling Jiri Kraus (NVIDIA) GPU Programming@Jülich Supercomputing Centre Jülich 7-9 April 2014 What you will learn How to use cuda-memcheck

More information

C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu

C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu C / C++ and Unix Programming Materials adapted from Dan Hood and Dianna Xu 1 C and Unix Programming Today s goals ú History of C ú Basic types ú printf ú Arithmetic operations, types and casting ú Intro

More information

Stack Overflows. Mitchell Adair

Stack Overflows. Mitchell Adair Stack Overflows Mitchell Adair Outline Why? What? There once was a VM Virtual Memory Registers Stack stack1, stack2, stack3 Resources Why? Real problem Real money Real recognition Still prevalent Very

More information

Command Param1 Param2 Return1 Return2 Description. 0xE9 0..0x7F (id) speed pos_high pos_low Set servo #id speed & read position

Command Param1 Param2 Return1 Return2 Description. 0xE9 0..0x7F (id) speed pos_high pos_low Set servo #id speed & read position set Description 0..0x7F (id) Set servo #id target position 0xE1 Read EEPROM 0xE2 Write EEPROM 0xE3 Read memory 0xE4 Write memory 0xE5 Read position 0xE6 Set target position 0xE7 version id Read version

More information

C Programming Review & Productivity Tools

C Programming Review & Productivity Tools Review & Productivity Tools Giovanni Agosta Piattaforme Software per la Rete Modulo 2 Outline Preliminaries 1 Preliminaries 2 Function Pointers Variadic Functions 3 Build Automation Code Versioning 4 Preliminaries

More information

As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets!

As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets! Encoding of alphanumeric and special characters As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets! Alphanumeric

More information

Software Engineering Concepts: Testing. Pointers & Dynamic Allocation. CS 311 Data Structures and Algorithms Lecture Slides Monday, September 14, 2009

Software Engineering Concepts: Testing. Pointers & Dynamic Allocation. CS 311 Data Structures and Algorithms Lecture Slides Monday, September 14, 2009 Software Engineering Concepts: Testing Simple Class Example continued Pointers & Dynamic Allocation CS 311 Data Structures and Algorithms Lecture Slides Monday, September 14, 2009 Glenn G. Chappell Department

More information

Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification

Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification Application Note 3/2003 PC Master Software Communication Protocol Specification By Pavel Kania and Michal Hanak S 3 L Applications Engineerings MCSL Roznov pod Radhostem Introduction The purpose of this

More information

風 水. Heap Feng Shui in JavaScript. Alexander Sotirov. asotirov@determina.com

風 水. Heap Feng Shui in JavaScript. Alexander Sotirov. asotirov@determina.com 風 水 Heap Feng Shui in JavaScript Alexander Sotirov asotirov@determina.com Black Hat Europe 2007 Introduction What is Heap Feng Shui? the ancient art of arranging heap blocks in order to redirect the program

More information

Practical Memory Checking with Dr. Memory

Practical Memory Checking with Dr. Memory Practical Memory Checking with Dr. Memory Derek Bruening Google bruening@google.com Qin Zhao Massachusetts Institute of Technology qin zhao@csail.mit.edu Abstract Memory corruption, reading uninitialized

More information

Performance Testing for GDB

Performance Testing for GDB Performance Testing for GDB Yao Qi yao@codesourcery.com CodeSourcery/MentorGraphics 214-9-13 1 Overview Introduction Goals 2 3 Introduction Goals Introduction We need something to test and measure GDB

More information

Performance Monitoring of the Software Frameworks for LHC Experiments

Performance Monitoring of the Software Frameworks for LHC Experiments Proceedings of the First EELA-2 Conference R. mayo et al. (Eds.) CIEMAT 2009 2009 The authors. All rights reserved Performance Monitoring of the Software Frameworks for LHC Experiments William A. Romero

More information

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail Hacking Techniques & Intrusion Detection Ali Al-Shemery arabnix [at] gmail All materials is licensed under a Creative Commons Share Alike license http://creativecommonsorg/licenses/by-sa/30/ # whoami Ali

More information

Lab 5: BitTorrent Client Implementation

Lab 5: BitTorrent Client Implementation Lab 5: BitTorrent Client Implementation Due: Nov. 30th at 11:59 PM Milestone: Nov. 19th during Lab Overview In this lab, you and your lab parterner will develop a basic BitTorrent client that can, at minimal,

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Programming Embedded Systems

Programming Embedded Systems Programming Embedded Systems Lecture 13 Overview of memory management Monday Feb 27, 2012 Philipp Rümmer Uppsala University Philipp.Ruemmer@it.uu.se 1/32 Lecture outline Memory architecture of microcontrollers,

More information

A Dozen Years of Shellphish From DEFCON to the Cyber Grand Challenge

A Dozen Years of Shellphish From DEFCON to the Cyber Grand Challenge A Dozen Years of Shellphish From DEFCON to the Cyber Grand Challenge Antonio Bianchi antoniob@cs.ucsb.edu University of California, Santa Barbara HITCON Enterprise August 27th, 2015 Agenda Shellphish The

More information

Short Notes on Dynamic Memory Allocation, Pointer and Data Structure

Short Notes on Dynamic Memory Allocation, Pointer and Data Structure Short Notes on Dynamic Memory Allocation, Pointer and Data Structure 1 Dynamic Memory Allocation in C/C++ Motivation /* a[100] vs. *b or *c */ Func(int array_size) double k, a[100], *b, *c; b = (double

More information

5. Processes and Memory Management

5. Processes and Memory Management 5. Processes and Memory Management 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy

More information

Comp151. Definitions & Declarations

Comp151. Definitions & Declarations Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const

More information

CISC 181 Project 3 Designing Classes for Bank Accounts

CISC 181 Project 3 Designing Classes for Bank Accounts CISC 181 Project 3 Designing Classes for Bank Accounts Code Due: On or before 12 Midnight, Monday, Dec 8; hardcopy due at beginning of lecture, Tues, Dec 9 What You Need to Know This project is based on

More information