Debugging Linux Applications
Tuxology team May 15th, 2008
Overview
Debugging Linux application is an advanced course which targets already competent Linux programmers who wish to learn more on common failure modes of Linux applications and how to debug them with various tools and programming methods.
Skills
The course will enable delegates to understand common Linux application failure modes and efficiently debug them using advanced methods.
Audience
Competent Linux programmers who wish to achieve a higher degree of
understanding on common Linux application failure modes and advanced
debugging techniques to handle them.
Prerequisites
Participants must have completed Linux Programming course or have equivalent
knowledge (e.g. student must be able to write a multi threaded application under
Linux that use a mutex to protect a shared variable before taking this course.)
Content
Introduction
Memory overruns
- Stack and heap overflow
- Techniques to identify and guard against them
Build time debugging assistance
- Pre-processing info
- Symbols, name mangling and map files, problems regarding symbols
- Include paths, Lib paths
- Dynamic loading
Stack structure
- What can go wrong?
- Stacks and multi-threading
- Stacks and Signals
Dynamic allocations and memory leaks
- Allocating memory without de-allocation
- De-allocating non allocated memory
- De-allocating already de-allocated memory
- Tools for detecting memory bugs
- Valgrind
- Dmalloc
Compiler and linker generated debug assistance
- What is debug information?
- Characteristics
- Preparing your code for further debugging
Multi-threaded applications
- Synchronization mechanisms
- Shared resources and keeping data integrity
Programmed debug assistance
- Preparing your code for efficient debug and trace
- Proper exception trapping and handling
Post-mortem activities
- Debugging application at customer’s site
- Core dumps, crash data
Using the GDB debugger efficiently
- Remote debugging
- Automation
- Using Eclipse front end
Resources
Course Slides
Usage Rights
The course materials were created by the following authors:
- Original slides and material by Gilad Ben-Yossef, © Codefidence ltd.
- Additional slides and material by Yariv Shivek, © Codefidence ltd.
- Portions based on the following Wikipedia articles: Call_stack, Debugging, Buffer_overflow, Dynamic memory allocations, © Wikipedia authors
- Tux Image Copyright: © 1996 Larry Ewing
- Linux is a registered trademark of Linus Torvalds.
- All other trademarks are property of their respective owners.
Used and distributed under the terms of GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts.