diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dd6282404c..ba4fc8f2ee 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2016-05-24 Pedro Alves + + PR gdb/19828 + * linux-nat.c (linux_resume_one_lwp_throw): Clear the LWP's core + field. + (linux_nat_update_thread_list): Don't fetch the core if already + known. + 2016-05-24 Pedro Alves PR gdb/19828 diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 19fe12f80a..dbadf2900e 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1432,6 +1432,7 @@ linux_resume_one_lwp_throw (struct lwp_info *lp, int step, status. Note that we must not throw after this is cleared, otherwise handle_zombie_lwp_error would get confused. */ lp->stopped = 0; + lp->core = -1; lp->stop_reason = TARGET_STOPPED_BY_NO_REASON; registers_changed_ptid (lp->ptid); } @@ -3785,7 +3786,13 @@ linux_nat_update_thread_list (struct target_ops *ops) /* Update the processor core that each lwp/thread was last seen running on. */ ALL_LWPS (lwp) - lwp->core = linux_common_core_of_thread (lwp->ptid); + { + /* Avoid accessing /proc if the thread hasn't run since we last + time we fetched the thread's core. Accessing /proc becomes + noticeably expensive when we have thousands of LWPs. */ + if (lwp->core == -1) + lwp->core = linux_common_core_of_thread (lwp->ptid); + } } static char *