Re: [PATCH] Disable get_ptrace_pid for NetBSD

Tom Tromey
2020-03-18T20:48:20Z

>>>>> "Kamil" == Kamil Rytarowski <n54@gmx.com> writes:

Kamil> Unlike most other Operating Systems, NetBSD tracks both pid and lwp.
Kamil> The process id on NetBSD is stored always in the pid field of ptid.

Kamil> gdb/ChangeLog:

Kamil> * inf-ptrace.h: Disable get_ptrace_pid on NetBSD.
Kamil> * inf-ptrace.c: Likewise.
Kamil> * (inf_ptrace_target::resume): Update.
Kamil> * (inf_ptrace_target::xfer_partial): Likewise.

Kamil> +#ifndef __NetBSD__
Kamil> /* Return which PID to pass to ptrace in order to observe/control the
Kamil> - tracee identified by PTID. */
Kamil> + tracee identified by PTID.
Kamil> +
Kamil> + Unlike most other Operating Systems, NetBSD tracks both pid and lwp
Kamil> + and avoids this function. */

Kamil> pid_t
Kamil> get_ptrace_pid (ptid_t ptid)
Kamil> @@ -328,6 +332,7 @@ get_ptrace_pid (ptid_t ptid)
Kamil> pid = ptid.pid ();
Kamil> return pid;

Why not make just the body of this function

#ifdef __NetBSD__
return ptid.pid ()
#else
... old code

That would mean fewer #ifs.

Tom