Fixed a formating issue... Attached patch is for Bug 13217 - "thread apply all detach throws a SEGFAULT". Issue: Segmentation fault was coming from invalid access to tp->* i.e "tp->ptid". Fix: Check if the thread is valid before we apply a command Check for the thread count after executing a command on every thread Testing: * Tested on powerpc-linux as well as i686-pc-linux * Also checked with valgrind Test case: Added a test case to test "thread apply all detach" command Regards, -Ali