Re: [PATCH 1/1] gdb, python: update threads in Inferior.threads ()

Jan Kratochvil
2012-07-18T13:54:37Z

On Fri, 06 Jul 2012 11:49:31 +0200, markus.t.metzger@intel.com wrote:
> Update the thread list in infpy_threads () before creating the Python objects.

It would be good to have a testcase for this issue.

> Not sure this is the right place. We should probably update the thread list as
> soon as we learn that the target stopped.

So far update_thread_list is called only before (in) the commands which really
need the thread list. The problem is that infpy_threads can be called from
a script repeatedly which may be pretty inefficient to call update_thread_list
each time.

The right would be to:
(1) Support update_thread_list per-inferior, not just for all inferiors at
once. For example infpy_threads is interested only in specific inferior.
(2) Cache the current thread list in struct inferior, clearing it from
begin of target_resume according to PTID (which depends for example on
'set schedule-multiple', see user_visible_resume_ptid), therefore either
the specific inferior only or all inferiors.

Still it is trying to push at you optimization out of the scope of this patch.

With a preferred testcase I find your patch OK. (Pedro knows better all this
infrun stuff.)

Thanks,
Jan