Debugging with gdb - Table of Contents

Open-source document that explains how to use GDB to debug programs.

Ninth Edition, for GDB version 6.3.50.20050815-cvs

Richard Stallman, Roland Pesch, Stan Shebs, et al.

Summary of GDB

Free software

Free Software Needs Free Documentation

Contributors to GDB

A Sample GDB Session

Getting In and Out of GDB

Invoking GDB

Choosing files

Choosing modes

What GDB does during startup

Quitting GDB

Shell commands

Logging output

GDB Commands

Command syntax

Command completion

Getting help

Running Programs Under GDB

Compiling for debugging

Starting your program

Your program's arguments

Your program's environment

Your program's working directory

Your program's input and output

Debugging an already-running process

Killing the child process

Debugging programs with multiple threads

Debugging programs with multiple processes

Stopping and Continuing

Breakpoints, watchpoints, and catchpoints

Setting breakpoints

Setting watchpoints

Setting catchpoints

Deleting breakpoints

Disabling breakpoints

Break conditions

Breakpoint command lists

Breakpoint menus

"Cannot insert breakpoints"

"Breakpoint address adjusted..."

Continuing and stepping

Signals

Stopping and starting multi-thread programs

Examining the Stack

Stack frames

Backtraces

Selecting a frame

Information about a frame

Examining Source Files

Printing source lines

Editing source files

Choosing your editor

Searching source files

Specifying source directories

Source and machine code

Examining Data

Expressions

Program variables

Artificial arrays

Output formats

Examining memory

Automatic display

Print settings

Value history

Convenience variables

Registers

Floating point hardware

Vector Unit

Operating system auxiliary information

Memory region attributes

Attributes

Memory Access Mode

Memory Access Size

Data Cache

Copy between memory and a file

How to Produce a Core File from Your Program

Character Sets

Caching Data of Remote Targets

C Preprocessor Macros

Tracepoints

Commands to Set Tracepoints

Create and Delete Tracepoints

Enable and Disable Tracepoints

Tracepoint Passcounts

Tracepoint Action Lists

Listing Tracepoints

Starting and Stopping Trace Experiment

Using the collected data

tfind n

tdump

save-tracepoints filename

Convenience Variables for Tracepoints

Debugging Programs That Use Overlays

How Overlays Work

Overlay Commands

Automatic Overlay Debugging

Overlay Sample Program

Using GDB with Different Languages

Switching between source languages

List of filename extensions and languages

Setting the working language

Having GDB infer the source language

Displaying the language

Type and range checking

An overview of type checking

An overview of range checking

Supported languages

C and C ++

C and C ++ operators

C and C ++ constants

C ++ expressions

C and C ++ defaults

C and C ++ type and range checks

GDB and C

GDB features for C ++

Objective-C/C ++

Method Names in Commands

The Print Command With Objective-C

Command Descriptions

Fortran

Pascal

Modula-2

Operators

Built-in functions and procedures

Constants

Modula-2 defaults

Deviations from standard Modula-2

Modula-2 type and range checks

The scope operators :: and .

GDB and Modula-2

Ada

Introduction

Omissions from Ada

Additions to Ada

Stopping at the Very Beginning

Known Peculiarities of Ada Mode

Unsupported languages

Examining the Symbol Table

Altering Execution

Assignment to variables

Continuing at a different address

Giving your program a signal

Returning from a function

Calling program functions

Patching programs

GDB Files

Commands to specify files

Debugging Information in Separate Files

Errors reading symbol files

Specifying a Debugging Target

Active targets

Commands for managing targets

Choosing target byte order

Remote debugging

Kernel Object Display

Debugging remote programs

Connecting to a remote target

Using the gdbserver program

Using the gdbserve.nlm program

Remote configuration

Implementing a remote stub

What the stub can do for you

What you must do for the stub

Putting it all together

Configuration-Specific Information

Native

HP-UX

BSD libkvm Interface

SVR4 process information

Features for Debugging DJGPP Programs

Features for Debugging MS Windows PE executables

Support for DLLs without debugging symbols

DLL name prefixes

Working with minimal symbols

Commands specific to GNU Hurd systems

QNX Neutrino

Embedded Operating Systems

Using GDB with VxWorks

Connecting to VxWorks

VxWorks download

Running tasks

Embedded Processors

ARM

Renesas H8/300

Connecting to Renesas boards

Using the E7000 in-circuit emulator

Special GDB commands for Renesas micros

H8/500

Renesas M32R/D and M32R/SDI

M68k

MIPS Embedded

OpenRISC 1000

PowerPC

HP PA Embedded

Renesas SH

Tsqware Sparclet

Setting file to debug

Connecting to Sparclet

Sparclet download

Running and debugging

Fujitsu Sparclite

Tandem ST2000

Zilog Z8000

Atmel AVR

CRIS

Renesas Super-H

Windows CE

Architectures

x86 Architecture-specific issues.

A29K

Alpha

MIPS

HPPA

Controlling GDB

Prompt

Command editing

Command history

Screen size

Numbers

Configuring the current ABI

Optional warnings and messages

Optional messages about internal happenings

Canned Sequences of Commands

User-defined commands

User-defined command hooks

Command files

Commands for controlled output

Command Interpreters

GDB Text User Interface

TUI overview

TUI Key Bindings

TUI Single Key Mode

TUI specific commands

TUI configuration variables

Using GDB under GNU Emacs

The GDB/MI Interface

Function and Purpose

Notation and Terminology

GDB/MI Command Syntax

GDB/MI Input Syntax

GDB/MI Output Syntax

Simple Examples of GDB/MI Interaction

GDB/MI Compatibility with CLI

GDB/MI Output Records

GDB/MI Result Records

GDB/MI Stream Records

GDB/MI Out-of-band Records

GDB/MI Command Description Format

GDB/MI Breakpoint table commands

GDB/MI Data Manipulation

GDB/MI Program control

Miscellaneous GDB commands in GDB/MI

GDB/MI Stack Manipulation Commands

GDB/MI Symbol Query Commands

GDB/MI Target Manipulation Commands

GDB/MI Thread Commands

GDB/MI Tracepoint Commands

GDB/MI Variable Objects

GDB Annotations

What is an Annotation?

Annotation for GDB Input

Errors

Invalidation Notices

Running the Program

Displaying Source

Reporting Bugs in GDB

Have you found a bug?

How to report bugs

Command Line Editing

Introduction to Line Editing

Readline Interaction

Readline Bare Essentials

Readline Movement Commands

Readline Killing Commands

Readline Arguments

Searching for Commands in the History

Readline Init File

Readline Init File Syntax

Conditional Init Constructs

Sample Init File

Bindable Readline Commands

Commands For Moving

Commands For Manipulating The History

Commands For Changing Text

Killing And Yanking

Specifying Numeric Arguments

Letting Readline Type For You

Keyboard Macros

Some Miscellaneous Commands

Readline vi Mode

Using History Interactively

History Expansion

Event Designators

Word Designators

Modifiers

Formatting Documentation

Installing GDB

Compiling GDB in another directory

Specifying names for hosts and targets

configure options

Maintenance Commands

GDB Remote Serial Protocol

Overview

Packets

Stop Reply Packets

General Query Packets

Register Packet Format

Examples

File-I/O remote protocol extension

File-I/O Overview

Protocol basics

The F request packet

The F reply packet

Memory transfer

The Ctrl-C message

Console I/O

The `isatty' function call

The `system' function call

List of supported calls

open

close

read

write

lseek

rename

unlink

stat/fstat

gettimeofday

isatty

system

Protocol specific representation of datatypes

Integral datatypes

Pointer values

struct stat

struct timeval

Constants

Open flags

mode_t values

Errno values

Lseek flags

Limits

File-I/O Examples

The GDB Agent Expression Mechanism

General Bytecode Design

Bytecode Descriptions

Using Agent Expressions

Varying Target Capabilities

Tracing on Symmetrix

Rationale

GNU GENERAL PUBLIC LICENSE

Preamble

TERMS AND CONDITIONS FOR COPYING,

DISTRIBUTION AND MODIFICATION

How to Apply These Terms to Your New Programs

GNU Free Documentation License

ADDENDUM: How to use this License for your documents

Index

This document was generated on 18 May 2008 using the
texi2html
translator version 1.51.