[Bug corefiles/21395] thread.c:1010 internal-error: int is_executing(ptid_t): Assertion `tp' failed.

raajeshdasari at gmail dot com sourceware-bugzilla@sourceware.org
Thu Apr 27 05:29:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=21395

--- Comment #3 from raajeshdasari at gmail dot com <raajeshdasari at gmail dot com> ---
I added a sleep after this ptrace call ptrace (PTRACE_SET_WATCH_REGS, tid,
&watch_mirror, NULL); and then retried the same call again , Issue is resolved
for me .


diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 9d22773..68641f8 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -634,9 +634,20 @@ mips_linux_new_thread (struct lwp_info *lp)
                                        &watch_readback_valid, 0))
     return;

+  long r;
+  r= ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL);
   tid = ptid_get_lwp (lp->ptid);
-  if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
-    perror_with_name (_("Couldn't write debug register"));
+  if ( r == -1L && errno == ESRCH )
+  {
+     /* sleep for a while to eliminate race condition on  update to kernel
+      * task structure with the process state (STOP state of thread).
+      */
+     usleep(10000);
+     if ( ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1 )
+     {
+        perror_with_name (_("Couldn't write debug register"));
+     }
+   }
 }

 /* Target to_insert_watchpoint implementation.  Try to insert a new
-- 
2.4.11



could someone please review this and let me know if any comments.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list