I try to start a program with gdb from commands line, then immediately add a breakpoint with commands, then run:
gdb -q -ex 'set pagination off' -ex 'break XOpenDisplay' -ex 'commands' -ex 'silent' -ex 'info locals' -ex 'bt full' -ex 'cont' -ex 'end' -ex 'r' ./myprogram
The program gets stuck after the "commands" prompting me to enter commands via keyboard then enter "end".
Did I forget something?
Regards
Update:
I added a .gdbinit with the following content:
gdb -q -ex breakXOpenDisplayRun
define breakXOpenDisplayRun
set pagination off
break XOpenDisplay
commands
silent
info locals
bt full
cont
end
run
end
gdb -q -ex breakXOpenDisplayRun ./myapp
When the program encounters the breakpoint the first time it stops there prompting a user input which should not happen. After the first cont it works as expected.