I do not know if what you are asking is possible.
What you could do is use gdb from the command line (or script) in a manner such as the following:
where <app> is the name of the executable application and <pid> is the current process ID of the application.
When debugging an application, you should do so in the area where the application was built so that gdb can reference the source code files. Alternatively, you can specify the -d option (to specify the directory location of the source files) or, and I may be wrong with this, a list of source file directories within ~/.gdbinit. You may want to read more about the latter option
here.