The -gtool runtime option can help you with debugging, when attaching to several processes at once. Instead of attaching to each process individually, you can specify all the processes in a single command line. For example:
$ mpirun -n 16 -gtool "gdb:3,5,7-9=attach" ./myprog
The command line above attaches the GNU* Debugger (GDB*) to processes 3, 5, 7, 8 and 9.
Intel® MPI Library Developer Reference, topic gtool Options.