https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182116 exec() causes fatal: Cannot find user-level thread for LWP 4256: generic error Patch below does not enable the new process tracing but it will not crash. MAY_FOLLOW_EXEC enable for GNU/Linux was discouraged by Daniel Jacobowitz. <20060721184421.GA22820@nevyn.them.org> Index: linux-thread-db.c =================================================================== RCS file: /cvs/src/src/gdb/linux-thread-db.c,v retrieving revision 1.17 diff -u -p -r1.17 linux-thread-db.c --- linux-thread-db.c 18 Jul 2006 22:53:20 -0000 1.17 +++ linux-thread-db.c 22 Jul 2006 12:17:50 -0000 @@ -875,6 +875,14 @@ thread_db_wait (ptid_t ptid, struct targ if (ourstatus->kind == TARGET_WAITKIND_EXITED) return pid_to_ptid (-1); + if (ourstatus->kind == TARGET_WAITKIND_EXECD) + { + unpush_target (&thread_db_ops); + using_thread_db = 0; + + return pid_to_ptid (GET_PID (ptid)); + } + if (ourstatus->kind == TARGET_WAITKIND_STOPPED && ourstatus->value.sig == TARGET_SIGNAL_TRAP) /* Check for a thread event. */