<p dir="ltr">> Yes, it's safe to send PTRACE request to a thread when it in stopped state.</p>
<p dir="ltr">But is it *only* the stopped state? It shouldn't be possible to set a watchpoint in any other state right?</p>
<p dir="ltr">> How do you reproduce this situation with setting watchpoint on a running thread?</p>
<p dir="ltr">TestSetWatchlocation and TestTargetWatchAddress both occasionally fail due to this. It manifests as failing to set watchpoint. The threads should have been stopped, but they're still eStateRunning when the process tried to set watchpoints.</p>
<div class="gmail_quote">On Mar 5, 2015 18:28, "Oleksiy Vyalov" <<a href="mailto:ovyalov@google.com">ovyalov@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In <a href="http://reviews.llvm.org/D7914#135266" target="_blank">http://reviews.llvm.org/D7914#135266</a>, @chaoren wrote:<br>
<br>
> It seems like the only state in which it's possible to set a hardware watchpoint is eStateStopped. All other states either can't be examined by ptrace or has already crashed. Am I understanding this correctly? Right now I'm running into a problem where watchpoint is being set while the state is eStateRunning. That's a probably caused by an unrelated problem of threads failing to be stopped.<br>
<br>
<br>
Yes, it's safe to send PTRACE request to a thread when it in stopped state. How do you reproduce this situation with setting watchpoint on a running thread?<br>
<br>
<br>
<a href="http://reviews.llvm.org/D7914" target="_blank">http://reviews.llvm.org/D7914</a><br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>
<br>
</blockquote></div>