36

I run GDB on object file (e.g exeFile) and I want to examine it according to several commands . How can I execute these commands according to lines in a file (instead input these each GDN running) ?

For example - I want to set break in -

break *0x8048e19
break *0x8048e32
break *0x8048e6f
break *0x8048e90

so I want to save them in a file and then tell the GDB execute them from this file.

spoulson
  • 21,335
  • 15
  • 77
  • 102
URL87
  • 10,667
  • 35
  • 107
  • 174

1 Answers1

72

write the commands in a file and execute gdb with -x switch

gdb -x command_file_name

or run the gdb source command while gdb is running if you dont want to specify a command file from command line

>source [-s] [-v] command_file_name
Kanwar Saad
  • 2,138
  • 2
  • 21
  • 27