This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: deal thread id as unsigned
On Mon, Apr 16, 2007 at 04:10:27PM +0200, Mark Kettenis wrote:
> > Date: Mon, 16 Apr 2007 11:39:55 +0900
> > From: Yoriko Komatsuzaki <yoriko@sm.sony.co.jp>
> >
> > Hello.
> >
> > I would like to ask you to consider this tiny patch about thread id type.
> > Thread id is unsigned type in Linux.
>
> I believe it used to be a signed type in Linux. Anyway, you can't
> really change it, since on other OS'es the type defenitely is signed.
Well, it used to be an int, but it would never be negative (always
small and positive).
> You'll only really notice this when the msb is set anyway. I think
> this happens on the Linux threads implementation of today the thread
> id isn't an integer at all, but a pointer instead. This suggests that
> it should really be printed as an (unsigned) hexadecimal number.
> Doing so doesn't need any changes to defs.h and therefore wouldn't
> affect any other platforms at all.
Right. I think printing it as hex is fine even for LinuxThreads,
where 0x4000 is not substantially less clear than "16384" (which was
always the thread ID of the first thread, no relation to PIDs).
--
Daniel Jacobowitz
CodeSourcery