Due to my mother language is not English. So, excuse me for this bad introduction of my question. I would explain what I need through figure shown below.

.gdbinit files inside the target folder As you can see, we have a folder which contains n .gdbinit files ( n=2000 or more).

strictly speaking, I attempt to run all of these .gdbinit files by using a loop statement in GDB. Is it possible in gdb alone, or I should modify my gdb to support another language like python, and then write loop statement in gdb by using python syntax?


  • If you want to keep it simple, write a small shell script to prepare your ~/.gdbinit file, eg find . -name '*.gdbinit'|sort|sed 's/^/source /' >~/.gdbinit – meuh Sep 27 '16 at 17:39
  • I need more than 12000 tests. so, the .gdbinit file will contain 12000 line of code. – husin alhaj ahmade Sep 27 '16 at 18:23

Yes, I found the answer to my question.

Here is

we simply write an application in any language like java for example and in that application, we generate a .gdbinit file (say trigger.gdbinit) which contains the following lines:

source file0.gdbinit

source file1.gdbinit

source file2.gdbinit

source file3.gdbinit

source file4.gdbinit

and so on.

Now, in gdb we just type this command,

(gdb) source trigger.gdbinit

and it is enough to execute all file0,1,2,....n.gdbinit just by single line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.