Roland,
I am running into some problems with pfmon when attaching to a thread
inside a multi-threaded program. I pass the tid (not pid) to the
ptrace(), wait*() calls.
During the attachment, I do the following sequence:
ptrace(PTRACE_ATTACH, tid, NULL, NULL);
ret = waitpid(pid, &status, WUNTRACED);
The wait fails with errno=10 (ENOCHILD). If I remove it, I can go past
this point.
The thread runs under ptrace during monitoring. At the end, I need
to stop the thread to read the perfmon data, then I detach.
To stop the thread, I send SIGSTOP to the thread (tid) which cannot be caught.
I was then expecting that pfmon would get a notification from ptrace for
pending signal. This is out it works for a single-threaded program.
However, I see that the entire process is stopped and that pfmon does not
get any notification. The WCHAN on the thread indicates it is blocked in
ptrace_stop(). This function contains the notify_parent() but pfmon
(the ptracing parent) does not seem to be getting anything.
I do understand that SIGSTOP probably applies to the entire process and
not just that one thread. Yet it seems strange that the notification is
not propagated.
Do you have any explanations for this?
Should I send the SIGSTOP to the pid rather than the tid?
Thanks.
--
-Stephane
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/