Subject: ptrace(2) + nathanw_sa LWPs
To: None <tech-kern@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 12/07/2001 18:54:32
So, I've been poking around at our debugging support lately, and I
had remembered Nathan complaining about ptrace(2), specifically that
it pretty much sucks when it comes to multiple LWPs.
It seems to me that we could simply add a ptrace(2) request to "set
which LWP this request is for".
To clarify:
* Those ptrace(2) requests that would cause a single-threaded
program to stop, all LWPs should be stopped in the multi-LWP
case.
* Those ptrace(2) requests that would cause a single-threaded
program to continue running should cause all LWPs to continue
running in the multi-LWP case.
* {READ,WRITE}{I,D} operate on the address space, and are thus
global to the process anyway.
* PT_{GET,SET}*REGS are per-LWP, so we need to identify which
LWP we want.
So, we would add:
PT_GET_LWP <- report back which LWP is being operated on
PT_SET_LWP <- set which LWP to operate on
GDB could easily handle issuing the PT_{GET,SET}_LWP commands before
fetching/storing registers in the traced process.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>