Changeset View
Changeset View
Standalone View
Standalone View
devel/gdb/files/extrapatch-threads
diff --git a/gdb/Makefile.in b/gdb/Makefile.in | diff --git gdb/Makefile.in gdb/Makefile.in | ||||
index ea27cf5..d17752f 100644 | index 7937801..6122f16 100644 | ||||
--- gdb/Makefile.in | --- gdb/Makefile.in | ||||
+++ gdb/Makefile.in | +++ gdb/Makefile.in | ||||
@@ -668,6 +668,7 @@ ALL_TARGET_OBS = \ | @@ -691,6 +691,7 @@ ALL_TARGET_OBS = \ | ||||
xtensa-config.o xtensa-tdep.o xtensa-linux-tdep.o \ | xtensa-config.o xtensa-tdep.o xtensa-linux-tdep.o \ | ||||
glibc-tdep.o \ | glibc-tdep.o \ | ||||
bsd-uthread.o \ | bsd-uthread.o \ | ||||
+ fbsd-threads.o \ | + fbsd-threads.o \ | ||||
nbsd-tdep.o obsd-tdep.o \ | nbsd-tdep.o obsd-tdep.o \ | ||||
sol2-tdep.o \ | sol2-tdep.o \ | ||||
solib-frv.o solib-irix.o solib-svr4.o \ | solib-frv.o solib-svr4.o \ | ||||
@@ -1327,7 +1328,7 @@ libgdb.a: $(LIBGDB_OBS) | @@ -1366,7 +1367,7 @@ libgdb.a: $(LIBGDB_OBS) | ||||
# Removing the old gdb first works better if it is running, at least on SunOS. | # Removing the old gdb first works better if it is running, at least on SunOS. | ||||
gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) | gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) | ||||
rm -f gdb$(EXEEXT) | rm -f gdb$(EXEEXT) | ||||
- $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \ | - $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \ | ||||
+ $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) -Wl,-E \ | + $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) -Wl,-E \ | ||||
-o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \ | -o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \ | ||||
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) | $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) | ||||
@@ -1600,7 +1601,7 @@ ALLDEPFILES = \ | @@ -1639,7 +1640,7 @@ ALLDEPFILES = \ | ||||
armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \ | armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \ | ||||
avr-tdep.c \ | avr-tdep.c \ | ||||
bfin-linux-tdep.c bfin-tdep.c \ | bfin-linux-tdep.c bfin-tdep.c \ | ||||
- bsd-uthread.c bsd-kvm.c \ | - bsd-uthread.c bsd-kvm.c \ | ||||
+ bsd-uthread.c fbsd-threads.c bsd-kvm.c \ | + bsd-uthread.c fbsd-threads.c bsd-kvm.c \ | ||||
core-regset.c \ | core-regset.c \ | ||||
dcache.c dicos-tdep.c darwin-nat.c \ | dcache.c dicos-tdep.c darwin-nat.c \ | ||||
exec.c \ | exec.c \ | ||||
diff --git a/gdb/amd64bsd-nat.c b/gdb/amd64bsd-nat.c | diff --git gdb/amd64bsd-nat.c gdb/amd64bsd-nat.c | ||||
index 9e6a0df..7aff6f0 100644 | index b1d4a0e..7f189f6 100644 | ||||
--- gdb/amd64bsd-nat.c | --- gdb/amd64bsd-nat.c | ||||
+++ gdb/amd64bsd-nat.c | +++ gdb/amd64bsd-nat.c | ||||
@@ -41,6 +41,19 @@ | @@ -40,6 +40,19 @@ | ||||
size_t x86_xsave_len; | size_t amd64bsd_xsave_len; | ||||
#endif | #endif | ||||
+static pid_t | +static pid_t | ||||
+ptrace_pid (ptid_t ptid) | +ptrace_pid (ptid_t ptid) | ||||
+{ | +{ | ||||
+ pid_t pid; | + pid_t pid; | ||||
+ | + | ||||
+#ifdef __FreeBSD__ | +#ifdef __FreeBSD__ | ||||
+ pid = ptid_get_lwp (ptid); | + pid = ptid_get_lwp (ptid); | ||||
+ if (pid == 0) | + if (pid == 0) | ||||
+#endif | +#endif | ||||
+ pid = ptid_get_pid (ptid); | + pid = ptid_get_pid (ptid); | ||||
+ return pid; | + return pid; | ||||
+} | +} | ||||
+ | + | ||||
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this | /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this | ||||
for all registers (including the floating-point registers). */ | for all registers (including the floating-point registers). */ | ||||
@@ -54,7 +67,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, | @@ -53,7 +66,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
struct reg regs; | struct reg regs; | ||||
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't get registers")); | perror_with_name (_("Couldn't get registers")); | ||||
@@ -72,7 +85,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, | @@ -71,7 +84,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, | ||||
if (x86_xsave_len != 0) | if (amd64bsd_xsave_len != 0) | ||||
{ | { | ||||
xstateregs = alloca(x86_xsave_len); | xstateregs = alloca (amd64bsd_xsave_len); | ||||
- if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get extended state status")); | perror_with_name (_("Couldn't get extended state status")); | ||||
@@ -81,7 +94,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, | @@ -80,7 +93,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, | ||||
} | } | ||||
#endif | #endif | ||||
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get floating point status")); | perror_with_name (_("Couldn't get floating point status")); | ||||
@@ -104,11 +117,11 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, | @@ -103,11 +116,11 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, | ||||
memset( ®s, 0, sizeof(struct reg)); | memset( ®s, 0, sizeof(struct reg)); | ||||
memset( &oldregs, 0, sizeof(struct reg)); | memset( &oldregs, 0, sizeof(struct reg)); | ||||
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't get registers")); | perror_with_name (_("Couldn't get registers")); | ||||
- ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | - ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | ||||
+ ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | + ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &oldregs, 0); | (PTRACE_TYPE_ARG3) &oldregs, 0); | ||||
amd64_collect_native_gregset (regcache, ®s, regnum); | amd64_collect_native_gregset (regcache, ®s, regnum); | ||||
@@ -118,7 +131,7 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, | @@ -117,7 +130,7 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, | ||||
regs.r_rflags ^= (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE; | regs.r_rflags ^= (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE; | ||||
//printf(" allowed regs.r_rflags = 0x%8.8X\n", regs.r_rflags ); | //printf(" allowed regs.r_rflags = 0x%8.8X\n", regs.r_rflags ); | ||||
} | } | ||||
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't write registers")); | perror_with_name (_("Couldn't write registers")); | ||||
@@ -135,26 +148,26 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, | @@ -134,26 +147,26 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, | ||||
if (x86_xsave_len != 0) | if (amd64bsd_xsave_len != 0) | ||||
{ | { | ||||
xstateregs = alloca(x86_xsave_len); | xstateregs = alloca (amd64bsd_xsave_len); | ||||
- if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get extended state status")); | perror_with_name (_("Couldn't get extended state status")); | ||||
amd64_collect_xsave (regcache, regnum, xstateregs, 0); | amd64_collect_xsave (regcache, regnum, xstateregs, 0); | ||||
- if (ptrace (PT_SETXSTATE, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETXSTATE, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETXSTATE, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETXSTATE, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xstateregs, x86_xsave_len) == -1) | (PTRACE_TYPE_ARG3) xstateregs, amd64bsd_xsave_len) == -1) | ||||
perror_with_name (_("Couldn't write extended state status")); | perror_with_name (_("Couldn't write extended state status")); | ||||
return; | return; | ||||
} | } | ||||
#endif | #endif | ||||
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get floating point status")); | perror_with_name (_("Couldn't get floating point status")); | ||||
amd64_collect_fxsave (regcache, regnum, &fpregs); | amd64_collect_fxsave (regcache, regnum, &fpregs); | ||||
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't write floating point status")); | perror_with_name (_("Couldn't write floating point status")); | ||||
} | } | ||||
@@ -184,7 +197,7 @@ amd64bsd_dr_get (ptid_t ptid, int regnum) | @@ -183,7 +196,7 @@ amd64bsd_dr_get (ptid_t ptid, int regnum) | ||||
{ | { | ||||
struct dbreg dbregs; | struct dbreg dbregs; | ||||
- if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | ||||
perror_with_name (_("Couldn't read debug registers")); | perror_with_name (_("Couldn't read debug registers")); | ||||
@@ -196,7 +209,7 @@ amd64bsd_dr_set (int regnum, unsigned long value) | @@ -195,7 +208,7 @@ amd64bsd_dr_set (int regnum, unsigned long value) | ||||
{ | { | ||||
struct dbreg dbregs; | struct dbreg dbregs; | ||||
- if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get debug registers")); | perror_with_name (_("Couldn't get debug registers")); | ||||
@@ -207,7 +220,7 @@ amd64bsd_dr_set (int regnum, unsigned long value) | @@ -206,7 +219,7 @@ amd64bsd_dr_set (int regnum, unsigned long value) | ||||
DBREG_DRX ((&dbregs), regnum) = value; | DBREG_DRX ((&dbregs), regnum) = value; | ||||
- if (ptrace (PT_SETDBREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETDBREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETDBREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETDBREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | ||||
perror_with_name (_("Couldn't write debug registers")); | perror_with_name (_("Couldn't write debug registers")); | ||||
} | } | ||||
diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c | diff --git gdb/amd64fbsd-nat.c gdb/amd64fbsd-nat.c | ||||
index eea2472..9ce6a54 100644 | index a721f48..2534360 100644 | ||||
--- gdb/amd64fbsd-nat.c | --- gdb/amd64fbsd-nat.c | ||||
+++ gdb/amd64fbsd-nat.c | +++ gdb/amd64fbsd-nat.c | ||||
@@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */ | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||||
#include "defs.h" | #include "defs.h" | ||||
+#include "gregset.h" | +#include "gregset.h" | ||||
#include "inferior.h" | #include "inferior.h" | ||||
#include "regcache.h" | #include "regcache.h" | ||||
#include "target.h" | #include "target.h" | ||||
@@ -95,6 +96,46 @@ static int amd64fbsd32_r_reg_offset[I386_NUM_GREGS] = | @@ -92,6 +93,46 @@ static int amd64fbsd32_r_reg_offset[I386_NUM_GREGS] = | ||||
}; | }; | ||||
␌ | ␌ | ||||
+/* Transfering the registers between GDB, inferiors and core files. */ | +/* Transfering the registers between GDB, inferiors and core files. */ | ||||
+ | + | ||||
+/* Fill GDB's register array with the general-purpose register values | +/* Fill GDB's register array with the general-purpose register values | ||||
+ in *GREGSETP. */ | + in *GREGSETP. */ | ||||
+ | + | ||||
Show All 30 Lines | |||||
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regnum) | +fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regnum) | ||||
+{ | +{ | ||||
+ amd64_collect_fxsave (regcache, regnum, fpregsetp); | + amd64_collect_fxsave (regcache, regnum, fpregsetp); | ||||
+} | +} | ||||
+␌ | +␌ | ||||
/* Support for debugging kernel virtual memory images. */ | /* Support for debugging kernel virtual memory images. */ | ||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c | diff --git gdb/amd64fbsd-tdep.c gdb/amd64fbsd-tdep.c | ||||
index 582ae50..8e07369 100644 | index 52705d9..6d48d8f 100644 | ||||
--- gdb/amd64fbsd-tdep.c | --- gdb/amd64fbsd-tdep.c | ||||
+++ gdb/amd64fbsd-tdep.c | +++ gdb/amd64fbsd-tdep.c | ||||
@@ -31,7 +31,6 @@ | @@ -28,7 +28,6 @@ | ||||
#include <string.h> | #include "x86-xstate.h" | ||||
#include "amd64-tdep.h" | #include "amd64-tdep.h" | ||||
-#include "bsd-uthread.h" | -#include "bsd-uthread.h" | ||||
#include "fbsd-tdep.h" | |||||
#include "solib-svr4.h" | #include "solib-svr4.h" | ||||
/* Supported register note sections. */ | @@ -226,46 +225,6 @@ amd64fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, | ||||
@@ -178,46 +177,6 @@ amd64fbsd_core_read_description (struct gdbarch *gdbarch, | |||||
} | } | ||||
static void | static void | ||||
-amd64fbsd_supply_uthread (struct regcache *regcache, | -amd64fbsd_supply_uthread (struct regcache *regcache, | ||||
- int regnum, CORE_ADDR addr) | - int regnum, CORE_ADDR addr) | ||||
-{ | -{ | ||||
- gdb_byte buf[8]; | - gdb_byte buf[8]; | ||||
- int i; | - int i; | ||||
Show All 30 Lines | |||||
- } | - } | ||||
- } | - } | ||||
-} | -} | ||||
- | - | ||||
-static void | -static void | ||||
amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||||
{ | { | ||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||||
@@ -245,10 +204,6 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | @@ -298,10 +257,6 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||||
set_gdbarch_core_read_description (gdbarch, | set_gdbarch_core_read_description (gdbarch, | ||||
amd64fbsd_core_read_description); | amd64fbsd_core_read_description); | ||||
- /* FreeBSD provides a user-level threads implementation. */ | - /* FreeBSD provides a user-level threads implementation. */ | ||||
- bsd_uthread_set_supply_uthread (gdbarch, amd64fbsd_supply_uthread); | - bsd_uthread_set_supply_uthread (gdbarch, amd64fbsd_supply_uthread); | ||||
- bsd_uthread_set_collect_uthread (gdbarch, amd64fbsd_collect_uthread); | - bsd_uthread_set_collect_uthread (gdbarch, amd64fbsd_collect_uthread); | ||||
- | - | ||||
/* FreeBSD uses SVR4-style shared libraries. */ | /* FreeBSD uses SVR4-style shared libraries. */ | ||||
set_solib_svr4_fetch_link_map_offsets | set_solib_svr4_fetch_link_map_offsets | ||||
(gdbarch, svr4_lp64_fetch_link_map_offsets); | (gdbarch, svr4_lp64_fetch_link_map_offsets); | ||||
diff --git a/gdb/configure.tgt b/gdb/configure.tgt | diff --git gdb/configure.tgt gdb/configure.tgt | ||||
index 01311b2..0929a25 100644 | index 7fdd34e..64afacf 100644 | ||||
--- gdb/configure.tgt | --- gdb/configure.tgt | ||||
+++ gdb/configure.tgt | +++ gdb/configure.tgt | ||||
@@ -189,7 +189,7 @@ i[34567]86-*-dicos*) | @@ -187,7 +187,7 @@ i[34567]86-*-dicos*) | ||||
i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) | i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) | ||||
# Target: FreeBSD/i386 | # Target: FreeBSD/i386 | ||||
gdb_target_obs="i386-tdep.o i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ | gdb_target_obs="i386-tdep.o i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ | ||||
- bsd-uthread.o solib-svr4.o" | - bsd-uthread.o fbsd-tdep.o solib-svr4.o" | ||||
+ fbsd-threads.o solib-svr4.o" | + fbsd-threads.o fbsd-tdep.o solib-svr4.o" | ||||
;; | ;; | ||||
i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu) | i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu) | ||||
# Target: NetBSD/i386 | # Target: NetBSD/i386 | ||||
@@ -415,7 +415,7 @@ nios2*-*-*) | @@ -410,7 +410,7 @@ nios2*-*-*) | ||||
powerpc*-*-freebsd*) | powerpc*-*-freebsd*) | ||||
# Target: FreeBSD/powerpc | # Target: FreeBSD/powerpc | ||||
gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ | gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ | ||||
- ppcfbsd-tdep.o solib-svr4.o \ | - ppcfbsd-tdep.o fbsd-tdep.o solib-svr4.o \ | ||||
+ ppcfbsd-tdep.o solib-svr4.o fbsd-threads.o \ | + ppcfbsd-tdep.o fbsd-threads.o fbsd-tdep.o solib-svr4.o \ | ||||
ravenscar-thread.o ppc-ravenscar-thread.o" | ravenscar-thread.o ppc-ravenscar-thread.o" | ||||
;; | ;; | ||||
@@ -667,7 +667,7 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) | @@ -663,7 +663,7 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) | ||||
# Target: FreeBSD/amd64 | # Target: FreeBSD/amd64 | ||||
gdb_target_obs="amd64-tdep.o amd64fbsd-tdep.o i386-tdep.o \ | gdb_target_obs="amd64-tdep.o amd64fbsd-tdep.o i386-tdep.o \ | ||||
i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ | i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ | ||||
- bsd-uthread.o solib-svr4.o" | - bsd-uthread.o fbsd-tdep.o solib-svr4.o" | ||||
+ fbsd-threads.o solib-svr4.o" | + fbsd-threads.o fbsd-tdep.o solib-svr4.o" | ||||
;; | ;; | ||||
x86_64-*-mingw* | x86_64-*-cygwin*) | x86_64-*-mingw* | x86_64-*-cygwin*) | ||||
# Target: MingW/amd64 | # Target: MingW/amd64 | ||||
diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c | diff --git gdb/i386bsd-nat.c gdb/i386bsd-nat.c | ||||
index c26e830..246acdd 100644 | index ac8a19b..cb2d50e 100644 | ||||
--- gdb/i386bsd-nat.c | --- gdb/i386bsd-nat.c | ||||
+++ gdb/i386bsd-nat.c | +++ gdb/i386bsd-nat.c | ||||
@@ -89,9 +89,22 @@ size_t x86_xsave_len; | @@ -87,9 +87,22 @@ size_t i386bsd_xsave_len; | ||||
#endif | #endif | ||||
␌ | ␌ | ||||
+static pid_t | +static pid_t | ||||
+ptrace_pid (ptid_t ptid) | +ptrace_pid (ptid_t ptid) | ||||
+{ | +{ | ||||
+ pid_t pid; | + pid_t pid; | ||||
+ | + | ||||
+#ifdef __FreeBSD__ | +#ifdef __FreeBSD__ | ||||
+ pid = ptid_get_lwp (ptid); | + pid = ptid_get_lwp (ptid); | ||||
+ if (pid == 0) | + if (pid == 0) | ||||
+#endif | +#endif | ||||
+ pid = ptid_get_pid (ptid); | + pid = ptid_get_pid (ptid); | ||||
+ return pid; | + return pid; | ||||
+} | +} | ||||
+ | + | ||||
/* Supply the general-purpose registers in GREGS, to REGCACHE. */ | /* Supply the general-purpose registers in GREGS, to REGCACHE. */ | ||||
-static void | -static void | ||||
+void | +void | ||||
i386bsd_supply_gregset (struct regcache *regcache, const void *gregs) | i386bsd_supply_gregset (struct regcache *regcache, const void *gregs) | ||||
{ | { | ||||
const char *regs = gregs; | const char *regs = gregs; | ||||
@@ -110,7 +123,7 @@ i386bsd_supply_gregset (struct regcache *regcache, const void *gregs) | @@ -108,7 +121,7 @@ i386bsd_supply_gregset (struct regcache *regcache, const void *gregs) | ||||
GREGS. If REGNUM is -1, collect and store all appropriate | GREGS. If REGNUM is -1, collect and store all appropriate | ||||
registers. */ | registers. */ | ||||
-static void | -static void | ||||
+void | +void | ||||
i386bsd_collect_gregset (const struct regcache *regcache, | i386bsd_collect_gregset (const struct regcache *regcache, | ||||
void *gregs, int regnum) | void *gregs, int regnum) | ||||
{ | { | ||||
@@ -140,7 +153,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | @@ -138,7 +151,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
struct reg regs; | struct reg regs; | ||||
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't get registers")); | perror_with_name (_("Couldn't get registers")); | ||||
@@ -162,7 +175,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | @@ -160,7 +173,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | ||||
char *xstateregs; | char *xstateregs; | ||||
xstateregs = alloca(x86_xsave_len); | xstateregs = alloca (i386bsd_xsave_len); | ||||
- if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get extended state status")); | perror_with_name (_("Couldn't get extended state status")); | ||||
@@ -174,7 +187,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | @@ -171,7 +184,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | ||||
#ifdef HAVE_PT_GETXMMREGS | #ifdef HAVE_PT_GETXMMREGS | ||||
if (have_ptrace_xmmregs != 0 | if (have_ptrace_xmmregs != 0 | ||||
- && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid), | - && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid), | ||||
+ && ptrace(PT_GETXMMREGS, ptrace_pid (inferior_ptid), | + && ptrace(PT_GETXMMREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xmmregs, 0) == 0) | (PTRACE_TYPE_ARG3) xmmregs, 0) == 0) | ||||
{ | { | ||||
have_ptrace_xmmregs = 1; | have_ptrace_xmmregs = 1; | ||||
@@ -184,7 +197,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | @@ -181,7 +194,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
have_ptrace_xmmregs = 0; | have_ptrace_xmmregs = 0; | ||||
#endif | #endif | ||||
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get floating point status")); | perror_with_name (_("Couldn't get floating point status")); | ||||
@@ -206,13 +219,13 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | @@ -203,13 +216,13 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
struct reg regs; | struct reg regs; | ||||
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't get registers")); | perror_with_name (_("Couldn't get registers")); | ||||
i386bsd_collect_gregset (regcache, ®s, regnum); | i386bsd_collect_gregset (regcache, ®s, regnum); | ||||
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't write registers")); | perror_with_name (_("Couldn't write registers")); | ||||
@@ -233,13 +246,13 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | @@ -230,13 +243,13 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | ||||
char *xstateregs; | char *xstateregs; | ||||
xstateregs = alloca(x86_xsave_len); | xstateregs = alloca (i386bsd_xsave_len); | ||||
- if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETXSTATE, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get extended state status")); | perror_with_name (_("Couldn't get extended state status")); | ||||
i387_collect_xsave (regcache, -1, xstateregs, 0); | i387_collect_xsave (regcache, -1, xstateregs, 0); | ||||
- if (ptrace (PT_SETXSTATE, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETXSTATE, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETXSTATE, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETXSTATE, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xstateregs, x86_xsave_len) == -1) | (PTRACE_TYPE_ARG3) xstateregs, i386bsd_xsave_len) == -1) | ||||
perror_with_name (_("Couldn't write extended state status")); | perror_with_name (_("Couldn't write extended state status")); | ||||
} | return; | ||||
@@ -247,14 +260,14 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | @@ -245,14 +258,14 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | ||||
#ifdef HAVE_PT_GETXMMREGS | #ifdef HAVE_PT_GETXMMREGS | ||||
if (have_ptrace_xmmregs != 0 | if (have_ptrace_xmmregs != 0 | ||||
- && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid), | - && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid), | ||||
+ && ptrace(PT_GETXMMREGS, ptrace_pid (inferior_ptid), | + && ptrace(PT_GETXMMREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xmmregs, 0) == 0) | (PTRACE_TYPE_ARG3) xmmregs, 0) == 0) | ||||
{ | { | ||||
have_ptrace_xmmregs = 1; | have_ptrace_xmmregs = 1; | ||||
i387_collect_fxsave (regcache, regnum, xmmregs); | i387_collect_fxsave (regcache, regnum, xmmregs); | ||||
- if (ptrace (PT_SETXMMREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETXMMREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETXMMREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETXMMREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) xmmregs, 0) == -1) | (PTRACE_TYPE_ARG3) xmmregs, 0) == -1) | ||||
perror_with_name (_("Couldn't write XMM registers")); | perror_with_name (_("Couldn't write XMM registers")); | ||||
} | } | ||||
@@ -262,13 +275,13 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | @@ -260,13 +273,13 @@ i386bsd_store_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
have_ptrace_xmmregs = 0; | have_ptrace_xmmregs = 0; | ||||
#endif | #endif | ||||
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get floating point status")); | perror_with_name (_("Couldn't get floating point status")); | ||||
i387_collect_fsave (regcache, regnum, &fpregs); | i387_collect_fsave (regcache, regnum, &fpregs); | ||||
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't write floating point status")); | perror_with_name (_("Couldn't write floating point status")); | ||||
#ifdef HAVE_PT_GETXMMREGS | #ifdef HAVE_PT_GETXMMREGS | ||||
@@ -307,7 +320,7 @@ i386bsd_dr_get (ptid_t ptid, int regnum) | @@ -305,7 +318,7 @@ i386bsd_dr_get (ptid_t ptid, int regnum) | ||||
{ | { | ||||
struct dbreg dbregs; | struct dbreg dbregs; | ||||
- if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | ||||
perror_with_name (_("Couldn't read debug registers")); | perror_with_name (_("Couldn't read debug registers")); | ||||
@@ -319,7 +332,7 @@ i386bsd_dr_set (int regnum, unsigned int value) | @@ -317,7 +330,7 @@ i386bsd_dr_set (int regnum, unsigned int value) | ||||
{ | { | ||||
struct dbreg dbregs; | struct dbreg dbregs; | ||||
- if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETDBREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETDBREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get debug registers")); | perror_with_name (_("Couldn't get debug registers")); | ||||
@@ -330,7 +343,7 @@ i386bsd_dr_set (int regnum, unsigned int value) | @@ -328,7 +341,7 @@ i386bsd_dr_set (int regnum, unsigned int value) | ||||
DBREG_DRX ((&dbregs), regnum) = value; | DBREG_DRX ((&dbregs), regnum) = value; | ||||
- if (ptrace (PT_SETDBREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETDBREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETDBREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETDBREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) | ||||
perror_with_name (_("Couldn't write debug registers")); | perror_with_name (_("Couldn't write debug registers")); | ||||
} | } | ||||
diff --git a/gdb/i386bsd-nat.h b/gdb/i386bsd-nat.h | diff --git gdb/i386bsd-nat.h gdb/i386bsd-nat.h | ||||
index 044f530..2fca773 100644 | index 2f50c32..bf7f2ff 100644 | ||||
--- gdb/i386bsd-nat.h | --- gdb/i386bsd-nat.h | ||||
+++ gdb/i386bsd-nat.h | +++ gdb/i386bsd-nat.h | ||||
@@ -38,6 +38,14 @@ extern CORE_ADDR i386bsd_dr_get_addr (int regnum); | @@ -38,6 +38,14 @@ extern CORE_ADDR i386bsd_dr_get_addr (int regnum); | ||||
extern unsigned long i386bsd_dr_get_status (void); | extern unsigned long i386bsd_dr_get_status (void); | ||||
+/* low level i386 register functions used in i386fbsd-nat.c. */ | +/* low level i386 register functions used in i386fbsd-nat.c. */ | ||||
+ | + | ||||
+extern void i386bsd_supply_gregset (struct regcache *regcache, | +extern void i386bsd_supply_gregset (struct regcache *regcache, | ||||
+ const void *gregs); | + const void *gregs); | ||||
+ | + | ||||
+extern void i386bsd_collect_gregset (const struct regcache *regcache, | +extern void i386bsd_collect_gregset (const struct regcache *regcache, | ||||
+ void *gregs, int regnum); | + void *gregs, int regnum); | ||||
+ | + | ||||
extern unsigned long i386bsd_dr_get_control (void); | extern unsigned long i386bsd_dr_get_control (void); | ||||
#endif /* i386bsd-nat.h */ | #endif /* i386bsd-nat.h */ | ||||
diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c | diff --git gdb/i386fbsd-nat.c gdb/i386fbsd-nat.c | ||||
index b9620e1..71abcdf 100644 | index a205a26..29b9444 100644 | ||||
--- gdb/i386fbsd-nat.c | --- gdb/i386fbsd-nat.c | ||||
+++ gdb/i386fbsd-nat.c | +++ gdb/i386fbsd-nat.c | ||||
@@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||||
#include "inferior.h" | #include "inferior.h" | ||||
#include "regcache.h" | #include "regcache.h" | ||||
#include "target.h" | #include "target.h" | ||||
+#include "gregset.h" | +#include "gregset.h" | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | ||||
@@ -82,6 +83,49 @@ i386fbsd_resume (struct target_ops *ops, | @@ -81,6 +82,49 @@ i386fbsd_resume (struct target_ops *ops, | ||||
} | } | ||||
␌ | ␌ | ||||
+/* Transfering the registers between GDB, inferiors and core files. */ | +/* Transfering the registers between GDB, inferiors and core files. */ | ||||
+ | + | ||||
+/* Fill GDB's register array with the general-purpose register values | +/* Fill GDB's register array with the general-purpose register values | ||||
+ in *GREGSETP. */ | + in *GREGSETP. */ | ||||
+ | + | ||||
Show All 33 Lines | |||||
+{ | +{ | ||||
+ i387_collect_fsave (regcache, regnum, fpregsetp); | + i387_collect_fsave (regcache, regnum, fpregsetp); | ||||
+} | +} | ||||
+␌ | +␌ | ||||
+ | + | ||||
/* Support for debugging kernel virtual memory images. */ | /* Support for debugging kernel virtual memory images. */ | ||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
diff --git a/gdb/i386fbsd-tdep.c b/gdb/i386fbsd-tdep.c | diff --git gdb/i386fbsd-tdep.c gdb/i386fbsd-tdep.c | ||||
index 8f7109f..fcb85d8 100644 | index 99e08cb..5bb15f6 100644 | ||||
--- gdb/i386fbsd-tdep.c | --- gdb/i386fbsd-tdep.c | ||||
+++ gdb/i386fbsd-tdep.c | +++ gdb/i386fbsd-tdep.c | ||||
@@ -30,7 +30,6 @@ | @@ -28,7 +28,6 @@ | ||||
#include "i386-tdep.h" | #include "i386-tdep.h" | ||||
#include "i387-tdep.h" | #include "i387-tdep.h" | ||||
-#include "bsd-uthread.h" | -#include "bsd-uthread.h" | ||||
#include "fbsd-tdep.h" | |||||
#include "solib-svr4.h" | #include "solib-svr4.h" | ||||
/* FreeBSD 3.0-RELEASE or later. */ | @@ -333,46 +332,6 @@ i386fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, | ||||
@@ -153,46 +152,6 @@ i386fbsd_core_read_description (struct gdbarch *gdbarch, | |||||
} | } | ||||
static void | static void | ||||
-i386fbsd_supply_uthread (struct regcache *regcache, | -i386fbsd_supply_uthread (struct regcache *regcache, | ||||
- int regnum, CORE_ADDR addr) | - int regnum, CORE_ADDR addr) | ||||
-{ | -{ | ||||
- gdb_byte buf[4]; | - gdb_byte buf[4]; | ||||
- int i; | - int i; | ||||
Show All 30 Lines | |||||
- } | - } | ||||
- } | - } | ||||
-} | -} | ||||
- | - | ||||
-static void | -static void | ||||
i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||||
{ | { | ||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||||
@@ -217,10 +176,6 @@ i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | @@ -399,10 +358,6 @@ i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||||
/* FreeBSD has a more complete `struct sigcontext'. */ | /* FreeBSD has a more complete `struct sigcontext'. */ | ||||
tdep->sc_reg_offset = i386fbsd_sc_reg_offset; | tdep->sc_reg_offset = i386fbsd_sc_reg_offset; | ||||
tdep->sc_num_regs = ARRAY_SIZE (i386fbsd_sc_reg_offset); | tdep->sc_num_regs = ARRAY_SIZE (i386fbsd_sc_reg_offset); | ||||
- | - | ||||
- /* FreeBSD provides a user-level threads implementation. */ | - /* FreeBSD provides a user-level threads implementation. */ | ||||
- bsd_uthread_set_supply_uthread (gdbarch, i386fbsd_supply_uthread); | - bsd_uthread_set_supply_uthread (gdbarch, i386fbsd_supply_uthread); | ||||
- bsd_uthread_set_collect_uthread (gdbarch, i386fbsd_collect_uthread); | - bsd_uthread_set_collect_uthread (gdbarch, i386fbsd_collect_uthread); | ||||
} | } | ||||
static void | static void | ||||
diff --git a/gdb/ppcfbsd-nat.c b/gdb/ppcfbsd-nat.c | diff --git gdb/ppcfbsd-nat.c gdb/ppcfbsd-nat.c | ||||
index 079bd12..74922f2 100644 | index 778b4bb..fa9285f 100644 | ||||
--- gdb/ppcfbsd-nat.c | --- gdb/ppcfbsd-nat.c | ||||
+++ gdb/ppcfbsd-nat.c | +++ gdb/ppcfbsd-nat.c | ||||
@@ -39,6 +39,19 @@ | @@ -37,6 +37,19 @@ | ||||
#include "inf-ptrace.h" | #include "inf-ptrace.h" | ||||
#include "bsd-kvm.h" | #include "bsd-kvm.h" | ||||
+static pid_t | +static pid_t | ||||
+ptrace_pid (ptid_t ptid) | +ptrace_pid (ptid_t ptid) | ||||
+{ | +{ | ||||
+ pid_t pid; | + pid_t pid; | ||||
+ | + | ||||
+#ifdef __FreeBSD__ | +#ifdef __FreeBSD__ | ||||
+ pid = ptid_get_lwp (ptid); | + pid = ptid_get_lwp (ptid); | ||||
+ if (pid == 0) | + if (pid == 0) | ||||
+#endif | +#endif | ||||
+ pid = ptid_get_pid (ptid); | + pid = ptid_get_pid (ptid); | ||||
+ return pid; | + return pid; | ||||
+} | +} | ||||
+ | + | ||||
/* Fill GDB's register array with the general-purpose register values | /* Fill GDB's register array with the general-purpose register values | ||||
in *GREGSETP. */ | in *GREGSETP. */ | ||||
@@ -123,7 +136,7 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops, | @@ -121,7 +134,7 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
gdb_gregset_t regs; | gdb_gregset_t regs; | ||||
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't get registers")); | perror_with_name (_("Couldn't get registers")); | ||||
@@ -134,7 +147,7 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops, | @@ -132,7 +145,7 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops, | ||||
const struct regset *fpregset = ppc_fbsd_fpregset (); | const struct regset *fpregset = ppc_fbsd_fpregset (); | ||||
gdb_fpregset_t fpregs; | gdb_fpregset_t fpregs; | ||||
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get FP registers")); | perror_with_name (_("Couldn't get FP registers")); | ||||
@@ -151,13 +164,13 @@ ppcfbsd_store_inferior_registers (struct target_ops *ops, | @@ -149,13 +162,13 @@ ppcfbsd_store_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
gdb_gregset_t regs; | gdb_gregset_t regs; | ||||
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't get registers")); | perror_with_name (_("Couldn't get registers")); | ||||
fill_gregset (regcache, ®s, regno); | fill_gregset (regcache, ®s, regno); | ||||
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1) | (PTRACE_TYPE_ARG3) ®s, 0) == -1) | ||||
perror_with_name (_("Couldn't write registers")); | perror_with_name (_("Couldn't write registers")); | ||||
@@ -165,13 +178,13 @@ ppcfbsd_store_inferior_registers (struct target_ops *ops, | @@ -163,13 +176,13 @@ ppcfbsd_store_inferior_registers (struct target_ops *ops, | ||||
{ | { | ||||
gdb_fpregset_t fpregs; | gdb_fpregset_t fpregs; | ||||
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_GETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't get FP registers")); | perror_with_name (_("Couldn't get FP registers")); | ||||
fill_fpregset (regcache, &fpregs, regno); | fill_fpregset (regcache, &fpregs, regno); | ||||
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), | - if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), | ||||
+ if (ptrace (PT_SETFPREGS, ptrace_pid (inferior_ptid), | + if (ptrace (PT_SETFPREGS, ptrace_pid (inferior_ptid), | ||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) | ||||
perror_with_name (_("Couldn't set FP registers")); | perror_with_name (_("Couldn't set FP registers")); | ||||
} | } |