[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Adjusting my debugger to work with NPTL



On Fri, May 02, 2003 at 09:13:39AM -0700, Norman Black wrote:
> Thanks for taking the time to respond to my query.
> 
> > > My specific needs/questions are how to.
> > > 1) stop and continue an individual thread. previously I used SIGSTOP
> and
> > > SIGCONT with kill.
> >
> > SIGSTOP will stop all threads in the task.  SIGCONT will resume all
> threads
> > in the task.  (This is true whether kill or tkill is used.)  You can
> resume
> > individual (traced) threads with PTRACE_CONT.  There isn't a way to
> stop a
> > single thread other than to stop all threads and then PTRACE_CONT a
> subset.
> 
> SIGSTOP and SIGCONT pass to kill I understand in the new signaling
> context.
> How can PTRACE_CONT continue a single thread since ptrace wants a pid
> and all threads now have the same pid.

No, PTRACE_CONT wants what is essentially an LWP ID.  Each thread has its
own and I believe thread_db will tell you what they are.

> What is tkill. Do I need it? I found no tkill API in the header files.
> It appears to only be a system call. No docs.

It is like kill but takes an LWP ID.

> > There isn't a way to stop a
> > single thread other than to stop all threads and then PTRACE_CONT a
> subset.
> 
> This is bogus and a step backwards. Is this a temporary omission?

Roland, can't you just tkill using SIGSTOP?

> > > 2) How are thread debug events received since wait returns "process"
> > > signals. previously waitpid (possibly using __WCLONE) resulting in a
> > > SIGTRAP was the catchall.
> >
> > You PTRACE_ATTACH to each individual thread PID, and then wait reports
> > signal stops for each different thread as it stops.
> 
> thread PID?. I thought all threads had the same pid in NPTL? ptrace
> wants pids and not tids, right?
> 
> How can wait return for a thread since all threads have the same PID?
> Has wait been extended to return TIDs. I have been using waitpid, so do
> I need to switch to using wait.

Wait does not return LWP ids.  It will at some point.  Just need to get
around to changing that and fixing GDB.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]