public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gcore and nptl threads on linux
@ 2003-03-04 23:40 J. Johnston
  2003-03-05  0:52 ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: J. Johnston @ 2003-03-04 23:40 UTC (permalink / raw)
  To: gdb

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.



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-04-15 21:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-04 23:40 gcore and nptl threads on linux J. Johnston
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

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 read-only IMAP folder(s) and NNTP newsgroup(s).