Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Alexander Smundak <asmundak@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC][PATCH] Allow JIT unwinder provide symbol information
Date: Tue, 11 Feb 2014 22:26:00 -0000	[thread overview]
Message-ID: <CADPb22Qithfi41fs1Ax5tz_g-zf8pzPRWKbnBrJZCiSqrO=KuA@mail.gmail.com> (raw)
In-Reply-To: <CAHQ51u6Hd3+B78RUK5rTh49nqvFgt_o1x6f=sePPZVDEo1ueTA@mail.gmail.com>

On Tue, Jan 14, 2014 at 4:39 PM, Alexander Smundak <asmundak@google.com> wrote:
> I fixed the patch based on your comments, except for the one
> about using LWP for thread identification.
> Waiting for the opinions about the approach used in this RFC patch.
>
>>  > +/* Returns LWP ID of the current thread or 0.  */
>>  > +
>>  > +typedef long (gdb_get_lwp) (void);
>>
>> The term "lwp" might be an insufficiently portable concept that we either
>> need to pick a different name or use a different value here.
>> It may be sufficient to stick with "lwp" but add further comments
>> specifying how it's used so that one can translate it to whatever else
>> is used on a non-lwp-using host.
>> Alas I don't have a good answer.  Hopefully someone else here does.
> ...
>>  > +long
>>  > +jit_get_current_lwp (void)
>>  > +{
>>  > +  long lwp = ptid_get_lwp (inferior_ptid);
>>  > +
>>  > +  // ptid_get_lwp returns 0 in the remote debugging case. Try getting
>>  > +  // thread id then.
>>  > +  // TODO(asmundak): perhaps use thread id always?
>>  > +  return lwp ? lwp : ptid_get_tid (inferior_ptid);
>>  > +}
>>
>> In what situation does ptid_get_lwp return 0 for remote debugging?
> If inferior is run by the gdbserver, I see that inferior.ptid.lwp
> is 0, while inferior_ptid.tid is LWP. If inferior runs locally, it's
> the opposite:inferior_ptid.lwp is LWP while inferior_ptid.tid is 0.

Ah, righto.  Blech.

>> Also, getting back to whether "lwp" is sufficient portable,
>> how does the external code use the value?
> JVM maintains its own list of threads, using LWP as thread's unique
> identifier.Java frame unwinder code checks that the frame belongs to
> the thread it knows about.

This feels like a case where a level of indirection is sufficient, the
only hard part is picking a good name.
IOW, if we replaced "lwp" with "jti" [Jit Thread Id] then I think
that'd be sufficient (or even "jtid").
Java folks can even pretend the J is for Java and not Jit. :-)
As for whether jti{,d} is a reasonable name ... dunno.

If other's don't chime in within a week I'm going to make a Command
Decision :-) and say let's go with that.
And I'm happy to pick a different name.  I just feel uncomfortable
with using "lwp" since in the remote case while it is the lwp it comes
from ptid.tid, and other systems may not use the term "lwp".
I'm willing to be persuaded that using "lwp" here is just fine though.


  reply	other threads:[~2014-02-11 22:26 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-26 18:36 Sasha Smundak
2014-01-13 18:25 ` Alexander Smundak
2014-02-07 21:54   ` Alexander Smundak
2014-01-13 18:46 ` Doug Evans
2014-01-15  0:39   ` Alexander Smundak
2014-02-11 22:26     ` Doug Evans [this message]
2014-02-12  7:50       ` Doug Evans
2014-02-19  3:30         ` Alexander Smundak
2014-02-19  3:50           ` Eli Zaretskii
2014-02-19  5:23             ` Alexander Smundak
2014-04-11 18:47           ` Doug Evans
2014-04-11 18:58           ` Doug Evans
2014-04-21  1:35             ` Alexander Smundak
2014-04-21  7:14               ` Eli Zaretskii
2014-04-21 16:43                 ` Alexander Smundak
2014-02-25  1:19         ` Doug Evans
2014-02-25  3:00           ` Alexander Smundak
2014-03-11  1:46           ` Alexander Smundak
2014-02-08  7:08 ` Yao Qi
2014-02-10  2:16   ` Alexander Smundak
2014-02-11 22:00     ` Doug Evans
2014-04-24 13:22 ` Pedro Alves
2014-04-25 23:40   ` Alexander Smundak
2014-04-29 15:22     ` Pedro Alves
2014-05-02 16:58       ` Alexander Smundak
2014-05-19 21:30         ` Alexander Smundak
2014-05-29  1:07       ` Alexander Smundak
2014-06-02  1:15       ` Alexander Smundak

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='CADPb22Qithfi41fs1Ax5tz_g-zf8pzPRWKbnBrJZCiSqrO=KuA@mail.gmail.com' \
    --to=dje@google.com \
    --cc=asmundak@google.com \
    --cc=gdb-patches@sourceware.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