This patch adjusts the procfs target, so that it registers the main thread in GDB's thread table. The biggest change here is, that on a single-threaded inferior, we would set inferior_ptid as: /* The 'process ID' we return to GDB is composed of the actual process ID plus the lwp ID. */ ... but, we'd not store the lwp id of the main lwp/process' in its procinfo (a target private structure holding info about lwps). If we always add the main thread to GDB's thread table, we should also keep the lwpid of the main thread around. The current code assumes that a procfind with tid == 0 represents the main process. To be able to still store a valid tid for the main process, I added a new main_proc flag to struct procinfo, and use that instead of relying on tid == 0. Always adding the main thread actually uncovered a bug in the sol-thread.c. The sol_thread_active flag wasn't being reset, which means that a second time we started an inferior, and we added its main thread to GDB's tables, and this new inferior hasn't loaded pthread support, sol_thread_create_inferior and sol_thread_attach would still try to get info on this thread, and fail. The second run should just behave the same as the first. Tested on i386-pc-solaris2.11 (OpenSolaris 10), with all the stty trouble I've had, but still, adding the manual testing I've done, I think I managed to get good coverage. This patch depends only on patch 1. OK? -- Pedro Alves