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: [linux] fix stepping over fork in follow-child mode.


On Wed, Mar 19, 2008 at 10:57:27AM +0300, Vladimir Prus wrote:
> 1. Your patch seem to remove thread_db_resume, including this
> bit of code in it:
> 
>           if (GET_PID (ptid) == -1)
>             inferior_ptid = lwp_from_thread (inferior_ptid);
>           else if (is_thread (ptid))
>             ptid = lwp_from_thread (ptid);
> 
> What was the code, and in particular the last line, trying to do,
> and why we don't actually have to do this?

This converts "ptid known by thread_db and the rest of gdb" to "ptid
known by linux-nat".  A ptid is (PID, LWP, TID).  linux-thread-db.c's
ptids used to look like (PID, 0, TID) and the above call converted it
to (PID, LWP, 0).  A few years ago, I changed linux-thread-db to use
(PID, LWP, TID) - in other words to assume that each TID was
permanently assigned to a single LWP.  That simplified things a lot.

This is not true on some platforms.  On Solaris, for instance, you may
end up with M light-weight processes, and N threads, with N > M.  Each
process grabs a thread to execute as its previous thread goes to
sleep.  So the LWP can change.

> 2. It seems that some other modules use tid. In particular,
> aix-thread.c makes use of the ptid_get_tid call. What to do about that?

We're fixing a Linux-specific problem, caused by not knowing the tid
right away - so there isn't a single TID for the entire life of the
application.  If other platforms have the same problem, they can fix
it locally.  I think having a thread at all times is something that
we're going to have to do in platform-specific code :-(

-- 
Daniel Jacobowitz
CodeSourcery


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