Re: [PATCH] Disable get_ptrace_pid for NetBSD

Simon Marchi
2020-03-18T21:22:19Z

On 2020-03-18 4:54 p.m., Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
>
> Tom> Why not make just the body of this function
>
> Tom> #ifdef __NetBSD__
> Tom> return ptid.pid ()
> Tom> #else
> Tom> ... old code
>
> Tom> That would mean fewer #ifs.
>
> I see that's what you did originally and Simon requested this version.
>
> Personally I think the new patch is uglier than the original, on the
> basis that use of "#if" generally makes the code harder to understand.
>
> Tom
>

Indeed, I suggested that. I am hoping that we can isolate the ifdefs in these
"gdb_ptrace" functions (we should probably find a better name for those...), to
which you pass a "ptid" and do the right thing according to the current OS. I
agree that adding ifdefs in the more complex code is ugly and less readable.

If my suggestion doesn't work well in practice, then feel free to revert to your
original solution, I certainly don't want to impose it if it turns out not to be
a good idea.

Simon