Re: [PATCH v4] Disable get_ptrace_pid for NetBSD

Simon Marchi
2020-03-19T12:55:26Z

On 2020-03-19 8:28 a.m., Kamil Rytarowski wrote:
> Unlike most other Operating Systems, NetBSD tracks both pid and lwp.
> The process id on NetBSD is stored always in the pid field of ptid.
>
> gdb/ChangeLog:
>
> * inf-ptrace.h: Disable get_ptrace_pid on NetBSD.
> * inf-ptrace.c: Likewise.
> * (gdb_ptrace): Add.
> * (inf_ptrace_target::resume): Update.
> * (inf_ptrace_target::xfer_partial): Likewise.
> * (inf_ptrace_peek_poke): Change argument `pid' to `ptid'.
> * (inf_ptrace_peek_poke): Update.

Hmm, this breaks simple debugging on Linux:

$ ./gdb --data-directory=data-directory a.out -ex start
Reading symbols from a.out...
Temporary breakpoint 1 at 0x4004da: file test.c, line 2.
Starting program: /home/smarchi/build/binutils-gdb/gdb/a.out

Program received signal SIGILL, Illegal instruction.
0x00007ffff7dda96d in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:1517
1517 rtld.c: No such file or directory.

I haven't figured out why by inspecting the code yet, I'll try to debug it later today.

Simon