Bug 12756

Summary: GDB's -ex option not documented
Product: gdb Reporter: W. Michael Petullo <mike>
Component: tuiAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: pedro
Priority: P2    
Version: 7.2   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

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 (7.2.90.20110429-36.fc15)
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:
<http://www.gnu.org/software/gdb/bugs/>.
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.
(gdb)
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'
`-ex 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.