Bug 12756 - GDB's -ex option not documented
Summary: GDB's -ex option not documented
Alias: None
Product: gdb
Classification: Unclassified
Component: tui (show other bugs)
Version: 7.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2011-05-13 01:32 UTC by W. Michael Petullo
Modified: 2015-07-02 12:53 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description W. Michael Petullo 2011-05-13 01:32:57 UTC
GDB's --ex option is a useful feature. However, it is not documented well. For example, the output of gdb --help does not mention --ex. The GDB manpage also does not document --ex. Even the info page contains no mention of --ex. The --ex option man be used to specify an input that will be provided to GDB when it executes. For example:

$ gdb -ex help
GNU gdb (GDB) Fedora (
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
Comment 1 Andreas Schwab 2011-05-13 08:18:00 UTC
  --eval-command=COMMAND, -ex
                     Execute a single GDB command.
                     May be used multiple times and in conjunction
                     with --command.

`-eval-command COMMAND'
     Execute a single GDB command.

     This option may be used multiple times to call multiple commands.
     It may also be interleaved with `-command' as required.

          gdb -ex 'target sim' -ex 'load' \
             -x setbreakpoints -ex 'run' a.out
Comment 2 Andreas Schwab 2011-05-13 08:23:25 UTC
The manpage should probably be replaced by help2man output.
Comment 3 Pedro Alves 2015-07-02 12:53:56 UTC
The manpage is nowadays generated from the same texinfo as the manual.

Seems to be fixed.  Closing.