4 CGDB configuration commands
There may be several features that you find useful in CGDB. CGDB is capable
of automating any of these commands through the use of the config file called
cgdbrc. It looks in $HOME/.cgdb/ for that file. If it
exists, CGDB executes each line in the file in order. It is as if the user
typed in all the commands into the status bar after the tui was initialized.
The following variables change the behavior of some aspect of CGDB. Many
of these commands may be abbreviated in some way, and all boolean commands
my be negated by appending ‘no’ to the front. For example:
:set ignorecase turns on case-insensitive searching; while
:set noignorecase turns on case-sensitive searching.
- :set as=style
- :set arrowstyle=style
- Set the arrow style to style. Possible values for style
are ‘short’, ‘long’, and ‘highlight’. Changes the style of
the arrow that is used to indicate the currently executing line in the source
viewer. The default value is short. A longer arrow is available, for easier
readability. Finally, the ‘highlight’ option draws no arrow at all,
instead drawing the entire line in inverse video.
- :set asr
- :set autosourcereload
- If this is on, CGDB will automatically reload a source file if it has
changed since CGDB has opened it. If it is off, the file will never be
reloaded, until you start CGDB again. The default is on.
This feature is useful when you are debugging a program, then you modify
a source file, recompile, and type r in GDB's CLI window. The file in
this case will be updated to show the new version. Note, CGDB only looks at
the timestamp of the source file to determine if it has changed. So if
you modify the source file, and didn't recompile yet, CGDB will still
pick up on the changes.
- :set cgdbmodekey=key
- This option is used to determine what key puts CGDB into CGDB Mode.
By default, the ESC key is used. key can be any normal key
on the keyboard. It can also be any keycode, as long as the keycode notation
is used. This option is especially useful when the user wants to use
readline in vi mode. If the user types
set cgdbmodekey=<PageUp>
then the Page Up key will put CGDB into CGDB mode and the ESC
key will flow through to readline.
- :set ic
- :set ignorecase
- Sets searching case insensitive. The default is off.
- :set stc
- :set showtgdbcommands
- If this is on, CGDB will show all of the commands that it sends to GDB.
If it is off, CGDB will not show the commands that it gives to GDB.
The default is off.
- :set syn=style
- :set syntax=style
- Sets the current highlighting mode of the current file to have the syntax
style. Possible values for syntax are ‘c’, ‘ada’, and
‘off’. Normally, the user will never have to do this, since CGDB
automatically detects what syntax a file should be based on its file
extension. However, this feature can currently be useful for debugging
purposes.
- :set to
- :set timeout
- This option is used along with the ttimeout option to determine the
behavior CGDB should have when it receives part of a mapped key sequence or
a keyboard code sequence. If this option is on, CGDB will time out on both
user defined mappings and on key codes from the keyboard. If this option
is off, user defined mappings will not be timed out on. In this case, CGDB
will determine if it should time out on key codes from the keyboard by
examining the ttimeout option. To determine how CGDB will time out
on mappings and key codes, and what time out lengths CGDB will use, please
refer to the chart in Key User Interface. The default value for this
option is on.
- :set tm=delay
- :set timeoutlen=delay
- This option is used along with the ttimeoutlen option. It
represents the number of milliseconds that CGDB should wait for a key code
from the keyboard or for a mapped key sequence to complete. If delay is
0, CGDB immediately accepts each character it receives. This will prevent any
mappings or key codes to complete. delay may be any value between
0 and 10000, inclusive. The default setting for the delay variable is
1000 (one second).
- :set ttimeout
- This option is used along with the timeout option to determine the
behavior CGDB should have when it receives part of keyboard code sequence.
If this option is on, CGDB will time out on key codes from the keyboard. If
this option is off, CGDB will determine if it should time out on key codes
from the keyboard by examining the timeout option. To determine how
CGDB will time out on key codes, what what time length it will use, please
refer to the chart in Key User Interface. The default value for this
option is on.
- :set ttm=delay
- :set ttimeoutlen=delay
- This option is used along with the ttimeoutlen option. It
represents the number of milliseconds that CGDB should wait for a key code
from the keyboard. If delay is 0, CGDB immediately accepts each character
it receives. This will prevent any key codes to complete. delay may
be any value between 0 and 10000, inclusive. The default setting for the
delay variable is 100 (one tenth of a second).
- :set ts=number
- :set tabstop=number
- Sets the number of spaces that should be rendered on the screen for <TAB>
characters. The default value for number is 8.
- :set wmh=number
- :set winminheight=number
- The minimal height of a window. Windows will never become smaller than
this value. The default value for number is 0.
- :set winsplit=style
- Set the split point between source and GDB window. This is especially useful
as an init setting in your cgdbrc file. See Configuring CGDB. The
possible values for style are ‘top_full’, ‘top_big’,
‘even’, ‘bottom_big’, and ‘bottom_full’.
- :set ws
- :set wrapscan
- Searches wrap around the end of file. The default is on.
- :c
- :continue
- Send a continue command to GDB.
- :down
- Send a down command to GDB.
- :e
- :edit
- reloads the file in the source window. this can be useful if the file has
changed since it was opened by cgdb.
- :f
- :finish
- Send a finish command to GDB.
- :help
- This will display the current manual in text format, in the
source window.
- :hi group cterm=attributes ctermfg=color ctermbg=color term=attributes
- :highlight group cterm=attributes ctermfg=color ctermbg=color term=attributes
- Set the color and attributes for a highlighting group. The syntax
mimics vim's “highlight” command. Possible values for group,
attributes and color are available in Highlighting Groups.
You can give as many or as few of the name=value pairs as you wish, in any
order. ‘ctermfg’ and ‘ctermbg’ set the foreground and background
colors. These can be specified by color number or by using the same color
names that vim uses. When CGDB is linked with ncurses, the number you use to
represent the color can be between -1 and COLORS. When CGDB is linked against
curses, it must be between 0 and COLORS.
‘cterm’ sets the video attributes for color terminals. ‘term’ sets
the video attributes for monochrome terminals. Some examples are,
:highlight Logo cterm=bold,underline ctermfg=Red ctermbg=Black
:highlight Normal cterm=reverse ctermfg=White ctermbg=Black
:hi Normal term=bold
- :insert
- Move focus to the GDB window.
- :n
- :next
- Send a next command to GDB.
- :q
- :quit
- Quit CGDB.
- :r
- :run
- Send a run command to GDB.
- :start
- Send a start command to GDB.
- :k
- :kill
- Send a kill command to GDB.
- :s
- :step
- Send a step command to GDB.
- :syntax
- Turn the syntax on or off.
- :up
- Send an up command to GDB.
- :map lhs rhs
- Create a new mapping or overwrite an existing mapping in CGDB mode.
After the command is run, if lhs is typed, CGDB will get rhs
instead. For more details on how to use the map command look in
Using Maps.
- :unm lhs
- :unmap lhs
- Delete an existing mapping from CGDB mode. lhs is what was typed
in the left hand side when the user created the mapping. For example, if
the user typed
:map a<Space>b foo
then the user could delete the
existing mapping with :unmap a<Space>b
.
- :im lhs rhs
- :imap lhs rhs
- Create a new mapping or overwrite an existing mapping in GDB mode.
After the command is run, if lhs is typed, CGDB will get rhs
instead. For more details on how to use the map command look in
Using Maps.
- :iu lhs
- :iunmap lhs
- Delete an existing mapping from GDB mode. lhs is what was typed
in the left hand side when the user created the mapping. For example, if
the user typed
:imap a<Space>b foo
then the user could delete the
existing mapping with :iunmap a<Space>b
.