This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [non-stop] 01/10 Add "executing" property


A Wednesday 25 June 2008 18:48:27, Vladimir Prus escreveu:
> Pedro Alves wrote:
> > +
> > +/* Reports if thread PTID is executing. Â*/
> > +extern int is_executing (ptid_t ptid);
>
> I know if follows is_running, introduced by me, but I think this is not
> the best interface. Say, somewhere later in this patch series we have
> this function:
>

Right.  I actually think I introduced is_running in one of those early
non-stop patches  :-)  It goes hand in hand with set_running.  By
your reasoning, we should make it set_running_ptid too.

>         static int
>         proceed_thread_callback (struct thread_info *thread, void *arg)
>         {
>           if (!is_stopped (thread->ptid))
>           ....
>
> Here, we already have thread_info, and using ptid to search for thread
> again, and get its state seems not nice. How about:
>
>         extern int is_executing (struct thread_info *thread);
>         extern int is_executing_ptid (ptid_t ptid);
>

There are actually very few places that need to check for
is_executing, (frame.c, stack.c), and I don't expect much more.
None of these places have a thread_info pointer around.  I can change
the interface, no problem with me, but in this case, we only need the
ptid form currently.

>         static int
>         proceed_thread_callback (struct thread_info *thread, void *arg)
>         {
>           if (!is_stopped (thread->ptid))
>           ....
> and a similar change for is_running?

The is_stopped method is only introduced in patch 10 actually.

We could also do is_stopped_thread (struct thread_info *) instead,
as I expect the ptid versions to be used more often.

I'll wait for review on it (as it is the patch that will probably need
more adjustement) before making interface changes, OK?

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]