Module Name: src Committed By: christos Date: Tue May 28 15:30:39 UTC 2019
Modified Files: src/external/gpl3/gdb/dist/gdb: alpha-bsd-nat.c amd64-bsd-nat.c amd64-nbsd-tdep.c arm-nbsd-nat.c event-loop.h hppa-nbsd-nat.c i386-bsd-nat.c inf-ptrace.c m68k-bsd-nat.c mips-nbsd-nat.c nbsd-nat.c nbsd-nat.h ppc-nbsd-nat.c sh-nbsd-nat.c sparc-nat.c vax-bsd-nat.c x86-bsd-nat.c Log Message: Start adjusting to the c++ world. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c \ src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c \ src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c \ src/external/gpl3/gdb/dist/gdb/nbsd-nat.h cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c \ src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c \ src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/event-loop.h \ src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c cvs rdiff -u -r1.19 -r1.20 src/external/gpl3/gdb/dist/gdb/inf-ptrace.c cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gdb/dist/gdb/sparc-nat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.6 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c Tue May 28 11:30:39 2019 @@ -103,7 +103,7 @@ alpha_bsd_nat_target::fetch_registers (s struct reg gregs; if (ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &gregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &gregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); alphabsd_supply_reg (regcache, (char *) &gregs, regno); @@ -117,7 +117,7 @@ alpha_bsd_nat_target::fetch_registers (s struct fpreg fpregs; if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); alphabsd_supply_fpreg (regcache, (char *) &fpregs, regno); @@ -134,13 +134,13 @@ alpha_bsd_nat_target::store_registers (s { struct reg gregs; if (ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &gregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &gregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); alphabsd_fill_reg (regcache, (char *) &gregs, regno); if (ptrace (PT_SETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &gregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &gregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); if (regno != -1) @@ -153,13 +153,13 @@ alpha_bsd_nat_target::store_registers (s struct fpreg fpregs; if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno); if (ptrace (PT_SETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c:1.6 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c Tue May 28 11:30:39 2019 @@ -73,7 +73,7 @@ mips_nbsd_nat_target::fetch_registers (s struct reg regs; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); mipsnbsd_supply_reg (regcache, (char *) ®s, regno); @@ -87,7 +87,7 @@ mips_nbsd_nat_target::fetch_registers (s struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno); @@ -105,13 +105,13 @@ mips_nbsd_nat_target::store_registers (s struct reg regs; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); mipsnbsd_fill_reg (regcache, (char *) ®s, regno); if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); if (regno != -1) @@ -124,13 +124,13 @@ mips_nbsd_nat_target::store_registers (s struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno); if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c:1.3 src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c:1.4 --- src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c:1.3 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c Tue May 28 11:30:39 2019 @@ -48,7 +48,7 @@ amd64bsd_fetch_inferior_registers (struc { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); amd64_supply_native_gregset (regcache, ®s, -1); @@ -92,7 +92,7 @@ amd64bsd_fetch_inferior_registers (struc if (x86bsd_xsave_len != 0) { xstateregs = alloca (x86bsd_xsave_len); - if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) + if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get extended state status")); @@ -101,7 +101,7 @@ amd64bsd_fetch_inferior_registers (struc } #endif - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); amd64_supply_fxsave (regcache, -1, &fpregs); @@ -121,12 +121,12 @@ amd64bsd_store_inferior_registers (struc { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); amd64_collect_native_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); if (regnum != -1) @@ -169,11 +169,11 @@ amd64bsd_store_inferior_registers (struc if (x86bsd_xsave_len != 0) { xstateregs = alloca (x86bsd_xsave_len); - if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) + if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get extended state status")); - amd64_collect_xsave (regcache, regnum, xstateregs, ptid_get_lwp (inferior_ptid)); + amd64_collect_xsave (regcache, regnum, xstateregs, inferior_ptid.lwp ()); if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1) @@ -182,12 +182,12 @@ amd64bsd_store_inferior_registers (struc } #endif - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); amd64_collect_fxsave (regcache, regnum, &fpregs); - if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c:1.3 src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c:1.4 --- src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c:1.3 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c Tue May 28 11:30:39 2019 @@ -136,7 +136,7 @@ i386bsd_fetch_inferior_registers (struct { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); i386bsd_supply_gregset (regcache, ®s); @@ -158,7 +158,7 @@ i386bsd_fetch_inferior_registers (struct xstateregs = alloca (x86bsd_xsave_len); if (ptrace (PT_GETXSTATE, pid, - (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get extended state status")); i387_supply_xsave (regcache, -1, xstateregs); @@ -168,7 +168,7 @@ i386bsd_fetch_inferior_registers (struct #ifdef HAVE_PT_GETXMMREGS if (have_ptrace_xmmregs != 0 - && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == 0) + && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, inferior_ptid.lwp ()) == 0) { have_ptrace_xmmregs = 1; i387_supply_fxsave (regcache, -1, xmmregs); @@ -177,7 +177,7 @@ i386bsd_fetch_inferior_registers (struct { have_ptrace_xmmregs = 0; #endif - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); i387_supply_fsave (regcache, -1, &fpregs); @@ -199,12 +199,12 @@ i386bsd_store_inferior_registers (struct { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); i386bsd_collect_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); if (regnum != -1) @@ -225,10 +225,10 @@ i386bsd_store_inferior_registers (struct xstateregs = alloca (x86bsd_xsave_len); if (ptrace (PT_GETXSTATE, pid, - (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get extended state status")); - i387_collect_xsave (regcache, -1, xstateregs, ptid_get_lwp (inferior_ptid)); + i387_collect_xsave (regcache, -1, xstateregs, inferior_ptid.lwp ()); if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1) @@ -239,25 +239,25 @@ i386bsd_store_inferior_registers (struct #ifdef HAVE_PT_GETXMMREGS if (have_ptrace_xmmregs != 0 - && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == 0) + && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, inferior_ptid.lwp ()) == 0) { have_ptrace_xmmregs = 1; i387_collect_fxsave (regcache, regnum, xmmregs); - if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write XMM registers")); } else { have_ptrace_xmmregs = 0; #endif - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); i387_collect_fsave (regcache, regnum, &fpregs); - if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write floating point status")); #ifdef HAVE_PT_GETXMMREGS } Index: src/external/gpl3/gdb/dist/gdb/nbsd-nat.h diff -u src/external/gpl3/gdb/dist/gdb/nbsd-nat.h:1.3 src/external/gpl3/gdb/dist/gdb/nbsd-nat.h:1.4 --- src/external/gpl3/gdb/dist/gdb/nbsd-nat.h:1.3 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/nbsd-nat.h Tue May 28 11:30:39 2019 @@ -27,6 +27,34 @@ struct nbsd_nat_target : public inf_ptrace_target { char *pid_to_exec_file (int pid) override; + int find_memory_regions (find_memory_region_ftype func, void *data) override; + + enum target_xfer_status xfer_partial (enum target_object object, + const char *annex, + gdb_byte *readbuf, + const gdb_byte *writebuf, + ULONGEST offset, ULONGEST len, + ULONGEST *xfered_len) override; + + bool thread_alive (ptid_t ptid) override; + const char *pid_to_str (ptid_t) override; + + const char *thread_name (struct thread_info *) override; + + void update_thread_list () override; + + thread_control_capabilities get_thread_control_capabilities () override + { return tc_schedlock; } + + void resume (ptid_t, int, enum gdb_signal) override; + + ptid_t wait (ptid_t, struct target_waitstatus *, int) override; + + void post_startup_inferior (ptid_t) override; + void post_attach (int) override; + + int follow_fork (int, int) override; + }; #endif /* nbsd-nat.h */ Index: src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c diff -u src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.5 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.6 --- src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.5 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c Tue May 28 11:30:39 2019 @@ -242,16 +242,15 @@ amd64nbsd_trapframe_sniffer (const struc { ULONGEST cs = 0; const char *name; - volatile struct gdb_exception ex; TRY { cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM); } - CATCH (ex, RETURN_MASK_ERROR) + CATCH (except, RETURN_MASK_ERROR) { - if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR) - throw_exception (ex); + if (except.reason < 0 && except.error != NOT_AVAILABLE_ERROR) + throw_exception (except); } END_CATCH if ((cs & I386_SEL_RPL) == I386_SEL_UPL) Index: src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c:1.5 src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c:1.6 --- src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c:1.5 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c Tue May 28 11:30:39 2019 @@ -175,7 +175,7 @@ hppa_nbsd_nat_target::fetch_registers (s struct reg regs; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); hppanbsd_supply_gregset (regcache, ®s); @@ -186,7 +186,7 @@ hppa_nbsd_nat_target::fetch_registers (s struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); hppanbsd_supply_fpregset (regcache, &fpregs); @@ -206,13 +206,13 @@ hppa_nbsd_nat_target::store_registers (s struct reg regs; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); hppanbsd_collect_gregset (regcache, ®s, regnum); if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); } @@ -221,13 +221,13 @@ hppa_nbsd_nat_target::store_registers (s struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); hppanbsd_collect_fpregset (regcache, &fpregs, regnum); if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c:1.5 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c:1.6 --- src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c:1.5 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c Tue May 28 11:30:39 2019 @@ -99,7 +99,7 @@ ppc_nbsd_nat_target::fetch_registers (st struct reg regs; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); ppc_supply_gregset (&ppcnbsd_gregset, regcache, @@ -111,7 +111,7 @@ ppc_nbsd_nat_target::fetch_registers (st struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get FP registers")); ppc_supply_fpregset (&ppcnbsd_fpregset, regcache, @@ -130,14 +130,14 @@ ppc_nbsd_nat_target::store_registers (st struct reg regs; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); ppc_collect_gregset (&ppcnbsd_gregset, regcache, regnum, ®s, sizeof regs); if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); } @@ -146,14 +146,14 @@ ppc_nbsd_nat_target::store_registers (st struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get FP registers")); ppc_collect_fpregset (&ppcnbsd_fpregset, regcache, regnum, &fpregs, sizeof fpregs); if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't set FP registers")); } } @@ -162,7 +162,7 @@ void supply_gregset (struct regcache *regcache, const gregset_t *gregs) { if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) gregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) gregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); } @@ -170,7 +170,7 @@ void supply_fpregset (struct regcache *regcache, const fpregset_t *fpregs) { if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't set FP registers")); } @@ -178,7 +178,7 @@ void fill_gregset (const struct regcache *regcache, gregset_t *gregs, int regnum) { if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) gregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) gregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); } @@ -186,7 +186,7 @@ void fill_fpregset (const struct regcache *regcache, fpregset_t *fpregs, int regnum) { if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get FP registers")); } Index: src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c:1.5 src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c:1.6 --- src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c:1.5 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c Tue May 28 11:30:39 2019 @@ -69,7 +69,7 @@ sh_nbsd_nat_target::fetch_registers (str struct reg inferior_registers; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); sh_corefile_supply_regset (&sh_corefile_gregset, regcache, regno, @@ -91,7 +91,7 @@ sh_nbsd_nat_target::store_registers (str struct reg inferior_registers; if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno, @@ -99,7 +99,7 @@ sh_nbsd_nat_target::store_registers (str SHNBSD_SIZEOF_GREGS); if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't set registers")); if (regno != -1) Index: src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c:1.5 src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c:1.6 --- src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c:1.5 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c Tue May 28 11:30:39 2019 @@ -45,7 +45,7 @@ static vax_bsd_nat_target the_vax_bsd_na static void vaxbsd_supply_gregset (struct regcache *regcache, const void *gregs) { - const gdb_byte *regs = (const gdb_byte *)gregs; + const gdb_byte *regs = gregs; int regnum; for (regnum = 0; regnum < VAX_NUM_REGS; regnum++) @@ -59,7 +59,7 @@ static void vaxbsd_collect_gregset (const struct regcache *regcache, void *gregs, int regnum) { - gdb_byte *regs = (gdb_byte *)gregs; + gdb_byte *regs = gregs; int i; for (i = 0; i <= VAX_NUM_REGS; i++) @@ -79,7 +79,7 @@ vax_bsd_nat_target::fetch_registers (str struct reg regs; pid_t pid = regcache->ptid ().pid (); - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); vaxbsd_supply_gregset (regcache, ®s); @@ -94,12 +94,12 @@ vax_bsd_nat_target::store_registers (str struct reg regs; pid_t pid = regcache->ptid ().pid (); - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); vaxbsd_collect_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); } Index: src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c:1.5 src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c:1.6 --- src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c:1.5 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c Tue May 28 11:30:39 2019 @@ -58,7 +58,7 @@ x86bsd_dr_get (ptid_t ptid, int regnum) struct dbreg dbregs; if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &dbregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &dbregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't read debug registers")); return DBREG_DRX ((&dbregs), regnum); @@ -70,7 +70,7 @@ x86bsd_dr_set (int regnum, unsigned long struct dbreg dbregs; if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &dbregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &dbregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get debug registers")); /* For some mysterious reason, some of the reserved bits in the @@ -83,7 +83,7 @@ x86bsd_dr_set (int regnum, unsigned long for (thread_info *thread : current_inferior ()->non_exited_threads ()) { if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid), - (PTRACE_TYPE_ARG3) &dbregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &dbregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write debug registers")); } } Index: src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.7 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.8 --- src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.7 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c Tue May 28 11:30:39 2019 @@ -149,7 +149,7 @@ fetch_register (struct regcache *regcach int ret; ret = ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); if (ret < 0) { @@ -198,7 +198,7 @@ fetch_regs (struct regcache *regcache) int regno; ret = ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); if (ret < 0) { @@ -216,7 +216,7 @@ fetch_fp_register (struct regcache *regc int ret; ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); if (ret < 0) { @@ -245,7 +245,7 @@ fetch_fp_regs (struct regcache *regcache int ret; ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); if (ret < 0) { @@ -282,7 +282,7 @@ store_register (const struct regcache *r int ret; ret = ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); if (ret < 0) { @@ -340,7 +340,7 @@ store_register (const struct regcache *r } ret = ptrace (PT_SETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); if (ret < 0) warning (_("unable to write register %d to inferior"), regno); @@ -382,7 +382,7 @@ store_regs (const struct regcache *regca } ret = ptrace (PT_SETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); if (ret < 0) warning (_("unable to store general registers")); @@ -395,7 +395,7 @@ store_fp_register (const struct regcache int ret; ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); if (ret < 0) { @@ -417,7 +417,7 @@ store_fp_register (const struct regcache } ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); if (ret < 0) warning (_("unable to write register %d to inferior"), regno); @@ -439,7 +439,7 @@ store_fp_regs (const struct regcache *re (char *) &inferior_fp_registers.fpr_fpsr); ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid)); + (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); if (ret < 0) warning (_("unable to store floating-point registers")); Index: src/external/gpl3/gdb/dist/gdb/event-loop.h diff -u src/external/gpl3/gdb/dist/gdb/event-loop.h:1.4 src/external/gpl3/gdb/dist/gdb/event-loop.h:1.5 --- src/external/gpl3/gdb/dist/gdb/event-loop.h:1.4 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/event-loop.h Tue May 28 11:30:39 2019 @@ -69,8 +69,7 @@ infinite loop. Corollary tasks are the creation and deletion of event sources. */ -#ifndef _EVENT_LOOP_H_ -#define _EVENT_LOOP_H_ + typedef void *gdb_client_data; struct async_signal_handler; struct async_event_handler; Index: src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c:1.4 src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c:1.5 --- src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c:1.4 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c Tue May 28 11:30:39 2019 @@ -123,7 +123,7 @@ m68k_bsd_nat_target::fetch_registers (st { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); m68kbsd_supply_gregset (regcache, ®s); @@ -133,7 +133,7 @@ m68k_bsd_nat_target::fetch_registers (st { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); m68kbsd_supply_fpregset (regcache, &fpregs); @@ -152,12 +152,12 @@ m68k_bsd_nat_target::store_registers (st { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); m68kbsd_collect_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); } @@ -165,12 +165,12 @@ m68k_bsd_nat_target::store_registers (st { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); m68kbsd_collect_fpregset (regcache, &fpregs, regnum); - if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/inf-ptrace.c diff -u src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.19 src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.20 --- src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.19 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/inf-ptrace.c Tue May 28 11:30:39 2019 @@ -368,7 +368,7 @@ inf_ptrace_target::resume (ptid_t ptid, * On NetBSD the data field of PT_STEP contains the thread * to be stepped; all other threads are continued if this value is > 0 */ - sig = ptid_get_lwp(ptid); + sig = ptid.lwp (); #else sig = 0; #endif Index: src/external/gpl3/gdb/dist/gdb/nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.10 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.11 --- src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.10 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/nbsd-nat.c Tue May 28 11:30:39 2019 @@ -24,7 +24,7 @@ #include "regset.h" #include "gdbcmd.h" #include "gdbthread.h" -#include "gdb_wait.h" +#include "common/gdb_wait.h" #include <sys/types.h> #include <sys/ptrace.h> #include <sys/sysctl.h> @@ -71,11 +71,11 @@ nbsd_nat_target::pid_to_exec_file (int p calling FUNC for each memory region. OBFD is passed as the last argument to FUNC. */ -static int -nbsd_find_memory_regions (struct target_ops *self, - find_memory_region_ftype func, void *obfd) +int +nbsd_nat_target::find_memory_regions (find_memory_region_ftype func, + void *obfd) { - pid_t pid = ptid_get_pid (inferior_ptid); + pid_t pid = inferior_ptid.pid (); struct kinfo_vmentry *vmentl, *kve; uint64_t size; struct cleanup *cleanup; @@ -131,15 +131,6 @@ nbsd_find_memory_regions (struct target_ static int debug_nbsd_lwp; -static void (*super_resume) (struct target_ops *, - ptid_t, - int, - enum gdb_signal); -static ptid_t (*super_wait) (struct target_ops *, - ptid_t, - struct target_waitstatus *, - int); - static void show_nbsd_lwp_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -149,15 +140,15 @@ show_nbsd_lwp_debug (struct ui_file *fil /* Return true if PTID is still active in the inferior. */ -static int -nbsd_thread_alive (struct target_ops *ops, ptid_t ptid) +bool +nbsd_nat_target::thread_alive (ptid_t ptid) { - if (ptid_lwp_p (ptid)) + if (ptid.lwp_p ()) { struct ptrace_lwpinfo pl; - pl.pl_lwpid = ptid_get_lwp (ptid); - if (ptrace (PT_LWPINFO, ptid_get_pid (ptid), (caddr_t) &pl, sizeof pl) + pl.pl_lwpid = ptid.lwp (); + if (ptrace (PT_LWPINFO, ptid.pid (), (caddr_t) &pl, sizeof pl) == -1) return 0; } @@ -168,16 +159,16 @@ nbsd_thread_alive (struct target_ops *op /* Convert PTID to a string. Returns the string in a static buffer. */ -static const char * -nbsd_pid_to_str (struct target_ops *ops, ptid_t ptid) +const char * +nbsd_nat_target::pid_to_str (ptid_t ptid) { lwpid_t lwp; - lwp = ptid_get_lwp (ptid); + lwp = ptid.lwp (); if (lwp != 0) { static char buf[64]; - int pid = ptid_get_pid (ptid); + int pid = ptid.pid (); xsnprintf (buf, sizeof buf, "LWP %d of process %d", lwp, pid); return buf; @@ -189,12 +180,12 @@ nbsd_pid_to_str (struct target_ops *ops, /* Return the name assigned to a thread by an application. Returns the string in a static buffer. */ -static const char * -nbsd_thread_name (struct target_ops *self, struct thread_info *thr) +const char * +nbsd_nat_target::thread_name (struct thread_info *thr) { struct kinfo_lwp *kl; - pid_t pid = ptid_get_pid (thr->ptid); - lwpid_t lwp = ptid_get_lwp (thr->ptid); + pid_t pid = thr->ptid.pid (); + lwpid_t lwp = thr->ptid.lwp (); static char buf[KI_LNAMELEN]; int mib[5]; size_t i, nlwps; @@ -269,7 +260,7 @@ nbsd_add_threads (pid_t pid) while ((val = ptrace (PT_LWPINFO, pid, (void *)&pl, sizeof(pl))) != -1 && pl.pl_lwpid != 0) { - ptid_t ptid = ptid_build (pid, pl.pl_lwpid, 0); + ptid_t ptid = ptid_t (pid, pl.pl_lwpid, 0); if (!in_thread_list (ptid)) add_thread (ptid); } @@ -277,12 +268,12 @@ nbsd_add_threads (pid_t pid) /* Implement the "to_update_thread_list" target_ops method. */ -static void -nbsd_update_thread_list (struct target_ops *ops) +void +nbsd_nat_target::update_thread_list () { prune_threads (); - nbsd_add_threads (ptid_get_pid (inferior_ptid)); + nbsd_add_threads (inferior_ptid.pid ()); } @@ -292,71 +283,25 @@ struct nbsd_fork_info ptid_t ptid; }; -static struct nbsd_fork_info *nbsd_pending_children; - -/* Record a new child process event that is reported before the - corresponding fork event in the parent. */ - -static void -nbsd_remember_child (ptid_t pid) -{ - struct nbsd_fork_info *info = XCNEW (struct nbsd_fork_info); - - info->ptid = pid; - info->next = nbsd_pending_children; - nbsd_pending_children = info; -} - -/* Check for a previously-recorded new child process event for PID. - If one is found, remove it from the list and return the PTID. */ - -static ptid_t -nbsd_is_child_pending (pid_t pid) -{ - struct nbsd_fork_info *info, *prev; - ptid_t ptid; - - prev = NULL; - for (info = nbsd_pending_children; info; prev = info, info = info->next) - { - if (ptid_get_pid (info->ptid) == pid) - { - if (prev == NULL) - nbsd_pending_children = info->next; - else - prev->next = info->next; - ptid = info->ptid; - xfree (info); - return ptid; - } - } - return null_ptid; -} - -/* Implement the "to_resume" target_ops method. */ - -static void -nbsd_resume (struct target_ops *ops, - ptid_t ptid, int step, enum gdb_signal signo) +void +nbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) { if (debug_nbsd_lwp) fprintf_unfiltered (gdb_stdlog, "NLWP: nbsd_resume for ptid (%d, %ld, %ld)\n", - ptid_get_pid (ptid), ptid_get_lwp (ptid), - ptid_get_tid (ptid)); - if (ptid_get_pid(ptid) == -1) + ptid.pid (), ptid.lwp (), ptid.tid ()); + if (ptid.pid () == -1) ptid = inferior_ptid; - super_resume (ops, ptid, step, signo); + inf_ptrace_target::resume (ptid, step, signo); } /* Wait for the child specified by PTID to do something. Return the process ID of the child, or MINUS_ONE_PTID in case of error; store the status in *OURSTATUS. */ -static ptid_t -nbsd_wait (struct target_ops *ops, - ptid_t ptid, struct target_waitstatus *ourstatus, - int target_options) +ptid_t +nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, + int target_options) { ptid_t wptid; @@ -372,27 +317,25 @@ nbsd_wait (struct target_ops *ops, if (debug_nbsd_lwp) fprintf_unfiltered (gdb_stdlog, "NLWP: calling super_wait (%d, %ld, %ld) target_options=%#x\n", - ptid_get_pid (ptid), ptid_get_lwp (ptid), - ptid_get_tid (ptid), target_options); + ptid.pid (), ptid.lwp (), ptid.tid (), target_options); - wptid = super_wait (ops, ptid, ourstatus, target_options); + wptid = inf_ptrace_target::wait (ptid, ourstatus, target_options); if (debug_nbsd_lwp) fprintf_unfiltered (gdb_stdlog, "NLWP: returned from super_wait (%d, %ld, %ld) target_options=%#x with ourstatus->kind=%d\n", - ptid_get_pid (ptid), ptid_get_lwp (ptid), - ptid_get_tid (ptid), target_options, ourstatus->kind); + ptid.pid (), ptid.lwp (), ptid.tid (), + target_options, ourstatus->kind); if (ourstatus->kind == TARGET_WAITKIND_STOPPED) { - ptrace_state_t pst, child_pst; + ptrace_state_t pst; ptrace_siginfo_t psi, child_psi; int status; pid_t pid, child, wchild; ptid_t child_ptid; lwpid_t lwp; - struct ptrace_lwpinfo pl; - pid = ptid_get_pid (wptid); + pid = wptid.pid (); // Find the lwp that caused the wait status change if (ptrace(PT_GET_SIGINFO, pid, &psi, sizeof(psi)) == -1) perror_with_name (("ptrace")); @@ -400,20 +343,20 @@ nbsd_wait (struct target_ops *ops, /* For whole-process signals pick random thread */ if (psi.psi_lwpid == 0) { // XXX: Is this always valid? - lwp = ptid_get_lwp (inferior_ptid); + lwp = inferior_ptid.lwp (); } else { lwp = psi.psi_lwpid; } - wptid = ptid_build (pid, lwp, 0); + wptid = ptid_t (pid, lwp, 0); /* Set LWP in the process */ - if (in_thread_list (pid_to_ptid (pid))) { + if (in_thread_list (ptid_t (pid))) { if (debug_nbsd_lwp) fprintf_unfiltered (gdb_stdlog, "NLWP: using LWP %d for first thread\n", lwp); - thread_change_ptid (pid_to_ptid (pid), wptid); + thread_change_ptid (ptid_t (pid), wptid); } if (debug_nbsd_lwp) @@ -446,7 +389,7 @@ nbsd_wait (struct target_ops *ops, break; case TRAP_EXEC: ourstatus->kind = TARGET_WAITKIND_EXECD; - ourstatus->value.execd_pathname = xstrdup(nbsd_pid_to_exec_file (NULL, pid)); + ourstatus->value.execd_pathname = xstrdup(pid_to_exec_file (pid)); break; case TRAP_LWP: case TRAP_CHLD: @@ -494,8 +437,8 @@ nbsd_wait (struct target_ops *ops, return wptid; } - child_ptid = ptid_build(child, child_psi.psi_lwpid, 0); - nbsd_enable_proc_events (ptid_get_pid (child_ptid)); + child_ptid = ptid_t (child, child_psi.psi_lwpid, 0); + nbsd_enable_proc_events (child_ptid.pid ()); ourstatus->value.related_pid = child_ptid; break; case PTRACE_VFORK_DONE: @@ -504,7 +447,7 @@ nbsd_wait (struct target_ops *ops, fprintf_unfiltered (gdb_stdlog, "NLWP: reported VFORK_DONE parent=%d child=%d\n", pid, pst.pe_other_pid); break; case PTRACE_LWP_CREATE: - wptid = ptid_build (pid, pst.pe_lwp, 0); + wptid = ptid_t (pid, pst.pe_lwp, 0); if (in_thread_list (wptid)) { /* Newborn reported after attach? */ ourstatus->kind = TARGET_WAITKIND_SPURIOUS; @@ -516,13 +459,13 @@ nbsd_wait (struct target_ops *ops, fprintf_unfiltered (gdb_stdlog, "NLWP: created LWP %d\n", pst.pe_lwp); break; case PTRACE_LWP_EXIT: - wptid = ptid_build (pid, pst.pe_lwp, 0); + wptid = ptid_t (pid, pst.pe_lwp, 0); if (!in_thread_list (wptid)) { /* Dead child reported after attach? */ ourstatus->kind = TARGET_WAITKIND_SPURIOUS; return wptid; } - delete_thread (wptid); + delete_thread (find_thread_ptid (wptid)); ourstatus->kind = TARGET_WAITKIND_THREAD_EXITED; if (debug_nbsd_lwp) fprintf_unfiltered (gdb_stdlog, "NLWP: exited LWP %d\n", pst.pe_lwp); @@ -538,8 +481,8 @@ nbsd_wait (struct target_ops *ops, if (debug_nbsd_lwp) fprintf_unfiltered (gdb_stdlog, "NLWP: nbsd_wait returned (%d, %ld, %ld)\n", - ptid_get_pid (wptid), ptid_get_lwp (wptid), - ptid_get_tid (wptid)); + wptid.pid (), wptid.lwp (), + wptid.tid ()); inferior_ptid = wptid; } @@ -549,14 +492,13 @@ nbsd_wait (struct target_ops *ops, /* Target hook for follow_fork. On entry and at return inferior_ptid is the ptid of the followed inferior. */ -static int -nbsd_follow_fork (struct target_ops *ops, int follow_child, - int detach_fork) +int +nbsd_nat_target::follow_fork (int follow_child, int detach_fork) { if (!follow_child && detach_fork) { struct thread_info *tp = inferior_thread (); - pid_t child_pid = ptid_get_pid (tp->pending_follow.value.related_pid); + pid_t child_pid = tp->pending_follow.value.related_pid.pid (); /* Breakpoints have already been detached from the child by infrun.c. */ @@ -568,97 +510,19 @@ nbsd_follow_fork (struct target_ops *ops return 0; } -static int -nbsd_insert_fork_catchpoint (struct target_ops *self, int pid) -{ - return 0; -} - -static int -nbsd_remove_fork_catchpoint (struct target_ops *self, int pid) -{ - return 0; -} - -static int -nbsd_insert_vfork_catchpoint (struct target_ops *self, int pid) -{ - return 0; -} - -static int -nbsd_remove_vfork_catchpoint (struct target_ops *self, int pid) -{ - return 0; -} - -/* Implement the "to_post_startup_inferior" target_ops method. */ - -static void -nbsd_post_startup_inferior (struct target_ops *self, ptid_t pid) +void +nbsd_nat_target::post_startup_inferior (ptid_t pid) { - nbsd_enable_proc_events (ptid_get_pid (pid)); + nbsd_enable_proc_events (pid.pid ()); } -/* Implement the "to_post_attach" target_ops method. */ - -static void -nbsd_post_attach (struct target_ops *self, int pid) +void +nbsd_nat_target::post_attach (int pid) { nbsd_enable_proc_events (pid); nbsd_add_threads (pid); } -static int -nbsd_insert_exec_catchpoint (struct target_ops *self, int pid) -{ - return 0; -} - -static int -nbsd_remove_exec_catchpoint (struct target_ops *self, int pid) -{ - return 0; -} - -static int -nbsd_set_syscall_catchpoint (struct target_ops *self, int pid, int needed, - int any_count, int table_size, int *table) -{ - - /* Ignore the arguments. inf-ptrace.c will use PT_SYSCALL which - will catch all system call entries and exits. The system calls - are filtered by GDB rather than the kernel. */ - return 0; -} - -void -nbsd_nat_add_target (struct target_ops *t) -{ - t->to_pid_to_exec_file = nbsd_pid_to_exec_file; - t->to_find_memory_regions = nbsd_find_memory_regions; - t->to_thread_alive = nbsd_thread_alive; - t->to_pid_to_str = nbsd_pid_to_str; - t->to_thread_name = nbsd_thread_name; - t->to_update_thread_list = nbsd_update_thread_list; - t->to_has_thread_control = tc_schedlock; - super_resume = t->to_resume; - t->to_resume = nbsd_resume; - super_wait = t->to_wait; - t->to_wait = nbsd_wait; - t->to_post_startup_inferior = nbsd_post_startup_inferior; - t->to_post_attach = nbsd_post_attach; - t->to_follow_fork = nbsd_follow_fork; - t->to_insert_fork_catchpoint = nbsd_insert_fork_catchpoint; - t->to_remove_fork_catchpoint = nbsd_remove_fork_catchpoint; - t->to_insert_vfork_catchpoint = nbsd_insert_vfork_catchpoint; - t->to_remove_vfork_catchpoint = nbsd_remove_vfork_catchpoint; - t->to_insert_exec_catchpoint = nbsd_insert_exec_catchpoint; - t->to_remove_exec_catchpoint = nbsd_remove_exec_catchpoint; - t->to_set_syscall_catchpoint = nbsd_set_syscall_catchpoint; - add_target (t); -} - /* Provide a prototype to silence -Wmissing-prototypes. */ extern initialize_file_ftype _initialize_nbsd_nat; Index: src/external/gpl3/gdb/dist/gdb/sparc-nat.c diff -u src/external/gpl3/gdb/dist/gdb/sparc-nat.c:1.11 src/external/gpl3/gdb/dist/gdb/sparc-nat.c:1.12 --- src/external/gpl3/gdb/dist/gdb/sparc-nat.c:1.11 Sun May 26 17:40:01 2019 +++ src/external/gpl3/gdb/dist/gdb/sparc-nat.c Tue May 28 11:30:39 2019 @@ -166,7 +166,7 @@ sparc_fetch_inferior_registers (struct r { gregset_t regs; - if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); sparc_supply_gregset (sparc_gregmap, regcache, -1, ®s); @@ -178,7 +178,7 @@ sparc_fetch_inferior_registers (struct r { fpregset_t fpregs; - if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating point status")); sparc_supply_fpregset (sparc_fpregmap, regcache, -1, &fpregs); @@ -199,12 +199,12 @@ sparc_store_inferior_registers (struct r { gregset_t regs; - if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get registers")); sparc_collect_gregset (sparc_gregmap, regcache, regnum, ®s); - if (ptrace (PTRACE_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PTRACE_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write registers")); /* Deal with the stack regs. */ @@ -225,7 +225,7 @@ sparc_store_inferior_registers (struct r { fpregset_t fpregs, saved_fpregs; - if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't get floating-point registers")); memcpy (&saved_fpregs, &fpregs, sizeof (fpregs)); @@ -238,7 +238,7 @@ sparc_store_inferior_registers (struct r if (memcmp (&saved_fpregs, &fpregs, sizeof (fpregs)) != 0) { if (ptrace (PTRACE_SETFPREGS, pid, - (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) + (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) perror_with_name (_("Couldn't write floating-point registers")); }