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

Hui Zhu hui_zhu@mentor.com
Sun Jun 8 11:16:00 GMT 2014



On 06/05/14 16:43, Pedro Alves wrote:
> On 06/05/2014 08:47 AM, Hui Zhu wrote:
>
>>
>> 2014-06-05  Hui Zhu  <hui@codesourcery.com>
>>
>> 	* common/linux-ptrace.c (linux_disable_event_reporting): New.
>> 	* common/linux-ptrace.h (linux_disable_event_reporting): New extern.
>
> You're not adding an extern to an existing function, but adding new declaration
> that happens to declare a function with extern linkage.
>
>> 	* linux-nat.c (linux_child_follow_fork): do a single step before
>> 	detach
>
> Capitalization, and full stop both missing.  Write instead:
>
> 	* common/linux-ptrace.c (linux_disable_event_reporting): New function.
> 	* common/linux-ptrace.h (linux_disable_event_reporting): New declaration.
> 	* linux-nat.c (linux_child_follow_fork): Do a single step before
> 	detach.

Updated.

>
>> +	      if (ptrace (PTRACE_SINGLESTEP, child_pid, 0, 0) < 0)
>> +		perror_with_name (_("Couldn't do single step"));
>> +	      if (my_waitpid (child_pid, &status, 0) < 0)
>> +		perror_with_name (_("Couldn't wait vfork process"));
>> +	    }
>> +
>> +	  ptrace (PTRACE_DETACH, child_pid, 0, WSTOPSIG (status));
>
> The child could have exited with that single-step.  So:
>
> 	  if (WIFSTOPPED (status))
> 	    ptrace (PTRACE_DETACH, child_pid, 0, WSTOPSIG (status));

Updated.

>
> OK with that change.
>

Thanks for your help.  Committed as 
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c077881afaedb9b74063bee992b3e472b4b6e9ca

Best,
Hui



More information about the Gdb-patches mailing list