I personally wasn't able to use gdb to that stage that i could dump a core dump from a secondary thread, I was only able to use breakpoints but the loading of all these libraries took ages so I just used stdout to know what is going on.
I'm not sure why would you want to bind a button click to gdb, serial exists for communication.
This is what you asked for right? right?