Home > Software design >  Using source with gdb command
Using source with gdb command

Time:05-26

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`

CodePudding user response:

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