Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: Paul_Koning@Dell.com
Cc: gdb@sourceware.org
Subject: Re: Threads support -- right way to extend ptrace() calls?
Date: Thu, 25 Mar 2010 10:57:00 -0000	[thread overview]
Message-ID: <201003251056.o2PAumOq018611@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <D8CEBB6AE9D43848BD2220619A43F326538E6E@M31.equallogic.com> 	(Paul_Koning@Dell.com)

> Date: Fri, 19 Mar 2010 12:36:34 -0400
> From: "Paul Koning" <Paul_Koning@Dell.com>
> 
> Gentlepeople,
> 
> I'm working on NetBSD support for threads. 
> 
> A lot of what is needed already exists in GDB, or exists with just small
> modifications needed.  That brings me to the question:
> 
> NetBSD uses ptrace, so inf-ptrace.c does a lot of the work.  Some pieces
> are target architecture specific but common across BSD flavors, for
> example i386bsd-nat.c does ptrace() getregs and setregs calls.
> 
> In NetBSD, a thread is an LWP which exists underneath a process, so a
> thread ID is a pair of PID and LWPID.  The ptid datatype handles this
> nicely.
> 
> In a number of ptrace calls, for example the PT_GETREGS and PT_SETREGS
> calls, the LWPID is now passed as the fourth argument, which was
> reserved and in existing code is passed as zero.  The simple answer is
> to replace that 0 by TIDGET(ptid), and that works.
> 
> But what is the right way to fit this into the bigger GDB?  Copy those
> get/set register target functions, with that change, into NetBSD
> specific source files?  Just change it in i386bsd-nat.c?  In the latter
> case that means other *BSD targets would get the change too, which would
> be safe so long as they build ptid values with zero in the TID field or
> if ptrace still ignores the fourth argument there.  I could verify the
> former fairly easily, but is that the right GDB way to proceed?

I've not tracked the developments in FreeBSD on this front.  But
OpenBSD still ignores the fourth argument for the PT_GETREGS and
PT_SETREGS requests.  Assuming FreeBSD does this as well, I think I'm
ok with modifying the BSD-specific -nat.c files in the way you
suggest.  I'm not so keen on having similar changes in the
inf-ptrace.c code though.  And if you need modifications there, you
can't really use the code from i386-bsd.c.  At that point you're
probably better off having a nbsd-nat.c and putting the i386-specific
bits in i386-nbsd.c

Cheers,

Mark


  reply	other threads:[~2010-03-25 10:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 16:36 Paul Koning
2010-03-25 10:57 ` Mark Kettenis [this message]
2010-03-26 21:26   ` Paul Koning

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=201003251056.o2PAumOq018611@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=Paul_Koning@Dell.com \
    --cc=gdb@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