Building Embedded Systems

Similar documents
Get the Better of Memory Leaks with Valgrind Whitepaper

Software Development Tools for Embedded Systems. Hesen Zhang

Valgrind Documentation

Sequential Performance Analysis with Callgrind and KCachegrind

Introducing the IBM Software Development Kit for PowerLinux

Leak Check Version 2.1 for Linux TM

Sequential Performance Analysis with Callgrind and KCachegrind

Testing for Security

C Programming Review & Productivity Tools

Instrumentation Software Profiling

Purify User s Guide. Version 4.1 support@rational.com

Nios II Software Developer s Handbook

Real-time Debugging using GDB Tracepoints and other Eclipse features

Object Oriented Software Design II

Compilers and Tools for Software Stack Optimisation

Monitoring, Tracing, Debugging (Under Construction)

Parallel and Distributed Computing Programming Assignment 1

Eddy Integrated Development Environment, LemonIDE for Embedded Software System Development

Debugging & Profiling with Open Source SW Tools

Helping you avoid stack overflow crashes!

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

CS 253: Intro to Systems Programming

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

RVDS 3.x with Eclipse IDE

Enhanced Project Management for Embedded C/C++ Programming using Software Components

Pitfalls in Embedded Software

STLinux Software development environment

Building Embedded Systems

Debugging with TotalView

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

ERIKA Enterprise pre-built Virtual Machine

Q N X S O F T W A R E D E V E L O P M E N T P L A T F O R M v Steps to Developing a QNX Program Quickstart Guide

APPROACHES TO SOFTWARE TESTING PROGRAM VERIFICATION AND VALIDATION

Using the Intel Inspector XE

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

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

Red Hat Developer Toolset 1.1

Finding Performance and Power Issues on Android Systems. By Eric W Moore

Eliminate Memory Errors and Improve Program Stability

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

Using System Tracing Tools to Optimize Software Quality and Behavior

Frysk The Systems Monitoring and Debugging Tool. Andrew Cagney

Developing Parallel Applications with the Eclipse Parallel Tools Platform

Java Troubleshooting and Performance

Lecture 32: The Java Virtual Machine. The Java Virtual Machine

Building Embedded Systems

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

Error Detection. Coverage Analysis

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

TEGRA X1 DEVELOPER TOOLS SEBASTIEN DOMINE, SR. DIRECTOR SW ENGINEERING

Lab 2: Swat ATM (Machine (Machine))

Rational Application Developer Performance Tips Introduction

Programming Embedded Systems

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

Online Recruitment System 1. INTRODUCTION

Introduction to Native Android Development with NDK

Module 26. Penetration Testing

CP Lab 2: Writing programs for simple arithmetic problems

QEMU, a Fast and Portable Dynamic Translator

Programming with the Dev C++ IDE

Static Code Analysis Procedures in the Development Cycle

QA Analysis of the WRF Program

University of Dayton Department of Computer Science Undergraduate Programs Assessment Plan DRAFT September 14, 2011

DS-5 ARM. Using the Debugger. Version 5.7. Copyright 2010, 2011 ARM. All rights reserved. ARM DUI 0446G (ID092311)

Mobile Performance Management Tools Prasanna Gawade, Infosys April 2014

Monitoring Java enviroment / applications

Illustration 1: Diagram of program function and data flow

Lecture 1 Introduction to Android

Glossary of Object Oriented Terms

Debugging and Profiling Lab. Carlos Rosales, Kent Milfeld and Yaakoub Y. El Kharma

Chapter 13 Storage classes

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

Monitoring.NET Framework with Verax NMS

3 - Lift with Monitors

Course Development of Programming for General-Purpose Multicore Processors

Assignment 09. Problem statement : Write a Embedded C program to switch-on/switch-off LED.

I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

MPI-Checker Static Analysis for MPI

Apache Jakarta Tomcat

AMD CodeXL 1.7 GA Release Notes

Attacking Obfuscated Code with IDA Pro. Chris Eagle

How To Develop Android On Your Computer Or Tablet Or Phone

Debugging Multi-threaded Applications in Windows

Chapter 5 Names, Bindings, Type Checking, and Scopes

Parallel Programming for Multi-Core, Distributed Systems, and GPUs Exercises

Chapter 3: Operating-System Structures. Common System Components

The Advanced JTAG Bridge. Nathan Yawn 05/12/09

All Your Code Belongs To Us Dismantling Android Secrets With CodeInspect. Steven Arzt Secure Software Engineering Group Steven Arzt 1

How to use IBM HeapAnalyzer to diagnose Java heap issues

Transcription:

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

Building Embedded Systems Chapter 5: Maintenance and Debugging Code Analysis Identify problems before they occur.

Static Code Check Check for compliance with certain coding standards and software metrics (e.g. complexity, nesting depth, comments). Can be performed without user interaction. Provides hints where to take a closer look. Tools: e.g. gcc, eclipse, coverity

Dynamic Code Check Software is checked during runtime. Code needs to be compiled and run. Effort depends on system complexity (and e.g. user input, system interaction) Check affects execution time (potential violation of temporal behavior) Tools: e.g. Valgrind, insure++, mudflap

Valgrind framework for debugging and profiling tools open-source optimized for C/C++ console based graphical UI available: Valkyrie indicates erroneous/suspicious code lines observes usage of (dynamic) memory unable to detect e.g. erroneous control flow

Some Valgrind Tools memcheck (default) e.g. out-of-bounds access, use uninitialized variables, dealloc unallocated memory, mismatched free/delete cachegrind analyze cache hits/misses to allow optimization massif generates regular snapshots of the heap usage helgrind (beta) a thread debugger that finds non-synced memory access To choose a tool, call Valgrind with arguments: shell> valgrind -tool=<tool>...

Valgrind Example example.c #include <stdlib.h> #include <stdio.h> void f(int x) { printf("x=%d\n", x) ; } int main( void ) { int n; int* x = malloc(10*sizeof(int)); x[10] = 0; f(n); return 0; } you already know GNU Make :-) Makefile example: example.c gcc -g Wall o $@ $^ run: example./$^ valgrind: example $@./$^ shell>> make run./example x=1649016926 # compile (if necessary) and run example Our program compiles and runs without error :-)

Valgrind Example (II) #include <stdlib.h> #include <stdio.h> void f(int x) { printf("x=%d\n", x) ; } int main( void ) { int n; int* x = malloc(10*sizeof(int)); x[10] = 0; f(n); return 0; } shell>> make valgrind # run memcheck ERROR SUMMARY: 4 errors a b c Invalid write of size 4. Conditional jump or move depends on uninitialised value(s). Use of uninitialised value of size 8. Conditional jump or move depends on uninitialised value(s). Heap: in use at exit: 40 bytes in 1 blocks Leak: definitely lost 40 bytes in 1 blocks

Code Check Improve software quality. Static checks are cheap and easy. Dynamic checks can be difficult but still worth to do (e.g. check isolated modules might be easier). Should be done on a regular base. Are a good starting point for software reviews.

References [Wietzke, 2012] Wietzke, J.: Embedded Technologies. Springer, 2012.

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