Add new debugging code to _thread.scm