fix a filename bug, and keep consistence of output in signal handlers.

- bt_handler() and bt_handler_gdb() uses same filename
add support for thread cancellation