Added ps command and thread state debugging helpers