Fix gdb.base/watch-vfork.exp: Watchpoint triggers after vfork (sw) (timeout) with Linux 2.6.32 and older version

Message ID 53B583B2.1040407@mentor.com
State New, archived
Headers

Commit Message

Hui Zhu July 3, 2014, 4:24 p.m. UTC
  >
>>
>> OK with that change.
>>
>
> Thanks for your help.  Committed as
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c077881afaedb9b74063bee992b3e472b4b6e9ca
>
>
> Best,
> Hui

Hi Pedro,

After this patch, I still got fail with this test in Linux 2.6.32.
The cause this:
	      signo = WSTOPSIG (status);
#In linux 2.6.32, signo will be SIGSTOP.
	      if (signo != 0
		  && !signal_pass_state (gdb_signal_from_host (signo)))
		signo = 0;
#SIGSTOP will send to child and make it stop.
	      ptrace (PTRACE_DETACH, child_pid, 0, signo);

So I make a patch to fix it.

Thanks,
Hui

2014-07-04  Hui Zhu  <hui@codesourcery.com>

	* linux-nat.c(linux_child_follow_fork): Add check if signo
	is SIGSTOP.
  

Patch

--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -472,8 +472,9 @@  holding the child stopped.  Try \"set de
  	      int signo;

  	      signo = WSTOPSIG (status);
-	      if (signo != 0
-		  && !signal_pass_state (gdb_signal_from_host (signo)))
+	      if (signo == SIGSTOP
+		  || (signo != 0
+		      && !signal_pass_state (gdb_signal_from_host (signo))))
  		signo = 0;
  	      ptrace (PTRACE_DETACH, child_pid, 0, signo);
  	    }