Table of Contents
*****************
CGDB
Summary of CGDB
1 Getting In and Out of CGDB
2 Understanding the core concepts of CGDB
2.1 Understanding the source window.
2.2 Understanding the GDB window.
2.3 Understanding the file dialog window.
2.4 Understanding the TTY window.
2.5 Understanding the status bar.
2.6 Switch between windows
3 CGDB commands
3.1 Commands available during CGDB mode
3.2 Commands available during GDB mode
3.3 Commands available during the file dialog mode
3.4 Commands available during TTY mode
4 CGDB configuration commands
5 CGDB highlighting groups
5.1 The different highlighting groups
5.2 The different attributes
5.3 The different colors
6 CGDB key user interface
6.1 The KUI's time out options
6.2 Using maps
6.3 Understanding keycodes
7 Sending I/O to the program being debugged
8 Allowing terminal control flow in CGDB
9 Building CGDB from source
Appendix A Copying This Manual
A.1 GNU Free Documentation License
A.1.1 ADDENDUM: How to use this License for your documents
Index
CGDB
****
This manual is for GNU CGDB (version 0.6.5, 5 October 2009), the GNU
ncurses based front end to GDB.
Copyright (C) 2006 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.1 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover Texts
being "A GNU Manual," and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section entitled
"GNU Free Documentation License."
(a) The FSF's Back-Cover Text is: "You have freedom to copy and
modify this GNU Manual, like GNU software. Copies published by
the Free Software Foundation raise funds for GNU development."
Summary of CGDB
***************
CGDB is a curses-based interface to the GNU Debugger (GDB). The goal
of CGDB is to be lightweight and responsive; not encumbered with
unnecessary features.
The interface is designed to deliver the familiar GDB text
interface, with a split screen showing the source as it executes. The
UI is modeled on the classic Unix text editor, vi. Those familiar with
vi should feel right at home using CGDB.
The library responsible for communicating with GDB is called Trivial
GDB (tgdb, or more accurately, libtgdb). This abstraction allows the
UI code to be independent of the debugger, as well as greatly
simplifying its implementation.
Those wanting to develop other interfaces to GDB are welcome to use
libtgdb as the basis for their program. Many of the headaches of
parsing GDB's output and annotations can be avoided by using it.
Some features offered by CGDB are:
* Syntax-highlighted source window
* Visual breakpoint setting
* Keyboard shortcuts for common functions
* Searching source window (using regexp)
1 Getting In and Out of CGDB
****************************
This chapter discusses how to start CGDB, and how to get out of it.
The essentials are:
* type `cgdb' to start CGDB.
* type `quit' or `C-d' in the GDB window to exit.
* type `:quit' in the source window to exit. This even works if GDB
is currently hanging, or operating a long command.
2 Understanding the core concepts of CGDB
*****************************************
The CGDB user interface currently consists of two windows and a status
bar. The source window is currently on the top and the GDB window is
on the bottom. The "status bar" currently separates the two windows.
The interface has several modes depending on which window is focused.
"CGDB mode" is when the source window is focused, "GDB mode" is when
the GDB window is focused and "TTY mode" is when the TTY window is
focused.
Beginning with CGDB version 1.0, the windows are movable, and the
user will be able to create as many or as few that is desired.
Currently however, all of my time is spent developing the interface
between CGDB and GDB. Once this is complete, the UI of CGDB will become
much more polished. If you are a ncurses developer, and have spare
time to work on this task, please contact me.
2.1 Understanding the source window.
====================================
The "source window" is the window that provides you a view of the source
code that the debugged program is made up of. It will display to the
user a single source file at a time. While the user is debugging, via
`next' and `step', CGDB will update the source file and line number to
keep you informed as to where GDB is debugging.
CGDB has several features that make debugging easier than using
plain old GDB. One feature you will notice right away while debugging
a C, C++ or ADA program, is that the source files are syntax
highlighted. This allows the user to easily navigate through the
source file to look for certain places in the source code. If you
would like to see another source language highlighted, contact us. To
understanding how to navigate through the source window look at the
commands in *note CGDB Mode::.
In addition to showing the source code, CGDB also displays to the
user the currently executing line. The line number will be highlighted
green, to represent that the particular line, is the current line being
debugged by GDB. Also, CGDB will display an arrow extending from the
line number, to the source line. You can configure what type of arrow
CGDB uses with the `:set arrowstyle' configuration option. By default,
the `short' arrow is used. However, my personal favorite is the `long'
arrow.
As you navigate through the source window, the current line the
cursor is on will be highlighted white. This simply helps you keep
track of where you are in the file.
Also, you can set or delete breakpoints in CGDB from the source
window. Simply navigate to the line that you are interested in setting
a breakpoint, and hit the space bar. This will set a breakpoint on the
line if one did not already exist. The line number should turn red to
indicate that a breakpoint has been set. Hitting the space bar again
will delete the breakpoint. If you disable the breakpoint, the line
number will turn yellow, to represent the disabled breakpoint.
CGDB also supports regular expression searching within the source
window. If you type `/' or `?' you can search in the source window for
a string of interest. The C library regular expression functions are
used to perform this search, which honors things like `*' or `+'.
The full list of commands that are available in the source window is
in *note CGDB Mode::.
2.2 Understanding the GDB window.
=================================
The "GDB window" is how CGDB allows the user to interface with the GNU
debugger. If you wish to pass a command to GDB, simply type it into
this window and GDB will receive the command. This interface is
intended to be 100% identical to using GDB on a terminal.
There is a limited set of keys that can be typed into this window
that CGDB interprets and handles, instead of sending to GDB. They are
all available in *note GDB Mode::.
CGDB attempts to buffer commands the same way they would be if you
typed them at the terminal. So, if you type several commands before a
single one finishes, they will each be run in order. There will be no
way to stop these commands from being run besides from typing `Ctrl-C',
like you would at any normal terminal when working with GDB.
2.3 Understanding the file dialog window.
=========================================
The "file dialog window" is available to help the user view and select
which file they would like to view. It provides the user with a list
of all the files that make up the program being debugged. If there are
no files available, because there is no program being debugged or
because there is no debug symbols, then the file dialog will not open
and a message will be displayed at the