Using source with gdb command

Viewed 47

I can write gdbscript and load it yo gdb with

source my_script

In my_script I write some breakpoint etc.

How can I load that script in the command line that I run gdb?

gdb -p `pidof my_process`
1 Answers

You can execute arbitrary commands like so:

gdb -ex 'break main' -ex 'source foo' -ex 'set confirm off' -p $pid

If your commands are already in a file, do this:

gdb -x my_script -p $PID`
Related