linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Evgeniy Didin <Evgeniy.Didin@synopsys.com>, gdb-patches@sourceware.org
Cc: Cupertino Miranda <Cupertino.Miranda@synopsys.com>,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	Shahab Vahedi <Shahab.Vahedi@synopsys.com>,
	linux-snps-arc@lists.infradead.org,
	Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>
Subject: Re: [PATCH v2] gdb/remote: Remove negative tid/pid handling in wite_ptid
Date: Wed, 6 Nov 2019 14:27:21 +0000	[thread overview]
Message-ID: <73f36a2f-444c-3057-f642-f9f7279574b5@redhat.com> (raw)
In-Reply-To: <20191106132732.11034-1-didin@synopsys.com>

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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

      reply	other threads:[~2019-11-06 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 13:27 [PATCH v2] gdb/remote: Remove negative tid/pid handling in wite_ptid Evgeniy Didin
2019-11-06 14:27 ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73f36a2f-444c-3057-f642-f9f7279574b5@redhat.com \
    --to=palves@redhat.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Claudiu.Zissulescu@synopsys.com \
    --cc=Cupertino.Miranda@synopsys.com \
    --cc=Evgeniy.Didin@synopsys.com \
    --cc=Shahab.Vahedi@synopsys.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=gdb-patches@sourceware.org \
    --cc=linux-snps-arc@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).