Kokomelom
Kokomelom

Reputation: 353

Using source with gdb command

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`

Upvotes: 1

Views: 181

Answers (1)

Employed Russian
Employed Russian

Reputation: 213879

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`

Upvotes: 1

Related Questions