Re: [PATCH v2] gdb/remote: Remove negative tid/pid handling in wite_ptid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/6/19 1:27 PM, Evgeniy Didin wrote:
> Actually thread and process ID's are positive values. Accorting to
> http://man7.org/linux/man-pages/man7/pthreads.7.html
> threads are creating using "clone" syscall, so the ID generation mechanism
> is similar for threads and processes. According to Linux source code
> there is a function call tree, which allocates  PID[TID]:
> clone
>  |->_do_fork
>     |->copy_process
>       |->alloc_pid
>         |->idr_alloc_cyclic
>           |->idr_alloc_u32(idr, ptr, &id, max, gfp);
> And in idr_alloc_u32() "id" is u32 value, which means positiveness.
> Also according to:
> https://elixir.bootlin.com/linux/latest/source/kernel/pid.c#L177
> PID cannot be less than 1.

Sure for Linux.  But negative numbers have meaning in the remote protocol:

 https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#thread_002did-syntax

Thanks,
Pedro Alves


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-snps-arc



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux