This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] MERGEPID macro wrong ?
- To: Pierre Muller <muller at cerbere dot u-strasbg dot fr>, gdb-patches at sources dot redhat dot com
- Subject: Re: [RFC] MERGEPID macro wrong ?
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Tue, 29 May 2001 11:49:59 -0700
- References: <4.2.0.58.20010528132554.00b59660@ics.u-strasbg.fr>
On May 28, 1:31pm, Pierre Muller wrote:
> The definition of MERGEPID macro currently on CVS seems
> wrong to me:
>
> the macro is the following,
>
> #define MERGEPID(PID,TID) ptid_build(PID,TID, 0)
I think the comment in defs.h sort of explains this...
/* Provide default definitions of PIDGET, TIDGET, and MERGEPID.
The name ``TIDGET'' is a historical accident. Many uses of TIDGET
in the code actually refer to a lightweight process id, i.e,
something that can be considered a process id in its own right for
certain purposes. */
I.e, for MERGEPID, the TID parameter is actually a lightweight process
id in most cases.
> but ptid_build is defined as
>
> ptid_t
> ptid_build (int pid, long lwp, long tid)
>
> So I think that the right macro should be
>
> #define MERGEPID(PID,TID) ptid_build(PID, 0, TID)
If this is done, then the TIDGET macro would also have to change. Some
of the low level thread code might also have to change. For the short
term, I think it would be better to change the MERGEPID define to read
as follows:
#define MERGEPID(PID,LWP) ptid_build(PID, LWP, 0)
Now that we have ptid_t with separate pid, tid, and lwp components we
should able to clean up a lot of code which used to overload PIDs, LWPs
and TIDs onto an int.
Kevin