gdb -p 12345 set debug-file-directory p set pagination off set logging file pg_debuglog.txt set debug-file-directory p handle SIGUSR1 noprint nostop handle SIGUSR2 noprint nostop bt cont printf "%s\n",(char*)debug_query_string