what is the "-ex" command option?

Mike Frysinger vapier@gentoo.org
Sat Aug 11 15:59:00 GMT 2012


On Saturday 11 August 2012 03:33:26 Smith John wrote:
>     when debugging using gdb , what  is  the   use  of   "-ex"  command
> option?

$ gdb --help | grep -e--eval-command -A 3
  --eval-command=COMMAND, -ex
                     Execute a single GDB command.
                     May be used multiple times and in conjunction
                     with --command.

$ echo 'main(){}' | gcc -x c - -g -o a.out

$ gdb -ex 'break main' -ex run ./a.out
Reading symbols from /home/vapier/a.out...done.
Breakpoint 1 at 0x4004c8: file <stdin>, line 1.
Starting program: /home/vapier/a.out 

Breakpoint 1, main () at <stdin>:1
1       <stdin>: No such file or directory.
(gdb) 
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/gdb/attachments/20120811/6c928cf7/attachment.sig>


More information about the Gdb mailing list