bramante@matrix:~/test$ gdb ./test
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/bramante/test/test...done.
(gdb) b test
Breakpoint 1 at 0x40058f: file ./test.c, line 7.
(gdb) commands 1
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>info args
>continue
>end
(gdb) run 5
Starting program: /home/bramante/test/test 5
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
Breakpoint 1, test (arg=0) at ./test.c:7
7 printf("@test(arg:%d)\n",arg);
arg = 0
@test(arg:0)
Breakpoint 1, test (arg=1) at ./test.c:7
7 printf("@test(arg:%d)\n",arg);
arg = 1
@test(arg:1)
Breakpoint 1, test (arg=2) at ./test.c:7
7 printf("@test(arg:%d)\n",arg);
arg = 2
@test(arg:2)
Breakpoint 1, test (arg=3) at ./test.c:7
7 printf("@test(arg:%d)\n",arg);
arg = 3
@test(arg:3)
Breakpoint 1, test (arg=4) at ./test.c:7
7 printf("@test(arg:%d)\n",arg);
arg = 4
@test(arg:4)
[Inferior 1 (process 3035) exited normally]
(gdb)
bramante@matrix:~/test$ gdb --batch --command=gdb.cmds --args ./test 2
Breakpoint 1 at 0x40058f: file ./test.c, line 7.
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
Breakpoint 1, test (arg=0) at ./test.c:7
7 ./test.c: No such file or directory.
#0 test (arg=0) at ./test.c:7
#1 0x00000000004005e6 in main (argc=2, argv=0x7fffffffe5b8) at ./test.c:18
@test(arg:0)
Breakpoint 1, test (arg=1) at ./test.c:7
7 in ./test.c
#0 test (arg=1) at ./test.c:7
#1 0x00000000004005e6 in main (argc=2, argv=0x7fffffffe5b8) at ./test.c:18
@test(arg:1)
[Inferior 1 (process 3091) exited normally]
bramante@matrix:~/test$