[PATCH 2/3 v4] Remove some GDBSERVER checks from linux-ptrace

Tom Tromey tromey@redhat.com
Thu Jul 24 14:09:00 GMT 2014


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> +	  current_ptrace_options |= PTRACE_O_TRACECLONE |
>> +	    (additional_flags & ~(PTRACE_O_TRACESYSGOOD
>> +				  | PTRACE_O_TRACEVFORKDONE));

Pedro> This isn't right.  That enables e.g., PTRACE_O_TRACEEXIT, for example,
Pedro> and possibly invalid flags even.

I don't see how that can happen.  I think the "&" prevents it.

Pedro> Please reverse that and spell out the flags we want here
Pedro> explicitly, like:

Pedro> 	  current_ptrace_options |= PTRACE_O_TRACECLONE;
Pedro> 	  current_ptrace_options |= (additional_flags & (PTRACE_O_TRACEFORK
Pedro>                                  			 | PTRACE_O_TRACEVFORK
Pedro> 		                                         | PTRACE_O_TRACEEXEC));

Though FWIW this does seem clearer.

Tom



More information about the Gdb-patches mailing list