Well, thanks to GDB flexibility I found the solution. The process of putting a breakpoint in main() and executing the command can be automated using Breakpoint Command Lists http://sourceware.org/gdb/current/onlinedocs/gdb.html#SEC40 (http://sourceware.org/gdb/current/onlinedocs/gdb.html#SEC40).
So the text to be added into Debugger Initialization Commands list is:
break main
commands
silent
set scheduler-locking on
cont
end
And this will do the trick!