Majid ff
Majid ff

Reputation: 249

Linux, How to wait some seconds before run the c code in GDB

I am using the following command to load the c file program and run it in GDB from terminal in one click:

gdb --eval-command='file c.out' --eval-command='c'

I want to sleep some seconds after loading the program but before starting the program in GDB, some thing like:

gdb --eval-command='file c.out' --eval-command='<sleep 5>' --eval-command='c'

Upvotes: 3

Views: 5328

Answers (1)

Mark Plotnick
Mark Plotnick

Reputation: 10261

One way to give gdb a command-line option that will make it pause for 5 seconds is to tell it to run the "sleep 5" command in a shell:

--eval-command="shell sleep 5"

Upvotes: 2

Related Questions