Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "J. Johnston" <jjohnstn@redhat.com>
To: gdb@sources.redhat.com
Subject: gcore and nptl threads on linux
Date: Tue, 04 Mar 2003 23:40:00 -0000	[thread overview]
Message-ID: <3E653983.8010005@redhat.com> (raw)

There is a problem with implementing gcore on linux with nptl thread
support.  Under the linux nptl model, each thread is mapped to an
lwpid which is distinct from the pid of the process that created the
thread.

The current linux gcore code is merging the pid with the tid into an unsigned
long value.  This works ok in the old model because the tid and pids are only
16-bits in length.  This no longer can work because tids in the nptl model are actually
addresses and are not restricted to 16-bits.

The kernel has no knowledge of thread ids and generates the corefile prstatus notes
using the lwpids.  It would be cleaner if the gcore output emulated this
kernel output.  Now, the gcore code has access to the thread list, but at the
thread layer, there is no lwp info in the list (just pid and tid info).

At present, the only exposed interface for fetching the lwp from a thread ptid_t
is the to_pid_to_str() target function.  This converts the ptid to string form
and will contain the LWP in string form.  To fish this out requires parsing
the output and converting string to integer.  I have a working example
of this, but this is considered a bit of an ugly hack.

I would like to propose exposing the lwp_from_thread() functionality currently
present in the existing threading code.  Notably, thread-db.c has lwp_from_thread(),
sol-thread.c has thread_to_lwp(), and uw-thread.c has thr_to_lwp() which are all
static functions.  The default version of this target function would simply return the
ptid_t input to it.

This change would allow linux-proc.c to get the lwp where possible in a cleaner
fashion.

If nobody has any major objections to this proposal, I can post a patch shortly.

-- Jeff J.




             reply	other threads:[~2003-03-04 23:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-04 23:40 J. Johnston [this message]
2003-03-05  0:52 ` Daniel Jacobowitz
2003-03-05 17:05   ` J. Johnston
2003-03-05 17:25     ` Daniel Jacobowitz
2003-03-06  0:56       ` Andrew Cagney
2003-03-06  1:04         ` Daniel Jacobowitz
2003-03-06  1:44           ` Andrew Cagney
2003-03-06  1:49             ` Daniel Jacobowitz
2003-03-06  1:27         ` J. Johnston
2003-03-06 20:17           ` Andrew Cagney
2003-03-06 20:21             ` Daniel Jacobowitz
2003-03-11  0:00               ` J. Johnston
2003-03-11 14:30                 ` Andrew Cagney
2003-04-15 21:43                   ` Andrew Cagney

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=3E653983.8010005@redhat.com \
    --to=jjohnstn@redhat.com \
    --cc=gdb@sources.redhat.com \
    /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