Execute GDB commands before attaching to a running program

Theo alpha0x89 at yahoo.de
Sun Jun 3 00:26:39 BST 2018

How do I execute GDB commands before the debugger gets attached to a
running program? Attaching with "Run/Attach to Process/Attach to Process
with GDB" seems to be equivalent to "gdb -p procID". I need an
equivalent of the GDB "-command=file" option where I include the attach
command into "file".
Alternatively, this would be possible if I could start GDB without being
attached to a program and use the command line interface "GDB cmd" of
KDevelop to execute my commands, although this would become tedious for
a long list of commands, so it would be more useful if there was a way
to feed a batch of commands at once into GDB.

More information about the KDevelop mailing list