diff options
Diffstat (limited to 'gnu/usr.bin/binutils/gdb/i386')
-rw-r--r-- | gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c | 27 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c | 14 |
2 files changed, 17 insertions, 24 deletions
diff --git a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c index 386f522..45beee1 100644 --- a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c +++ b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c @@ -104,21 +104,21 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) register int addr; int bad_reg = -1; int offset; - struct user *tmp_uaddr; + struct pcb *tmp_pcbaddr; /* * First get virtual address of user structure. Then calculate offset. */ - memcpy(&tmp_uaddr, - &((struct user *) core_reg_sect)->u_kproc.ki_addr, - sizeof(tmp_uaddr)); - offset = -reg_addr - (int) tmp_uaddr; + memcpy(&tmp_pcbaddr, + &((struct user *) core_reg_sect)->u_kproc.ki_pcb, + sizeof(tmp_pcbaddr)); + offset = -reg_addr - (int) tmp_pcbaddr; for (regno = 0; regno < NUM_REGS; regno++) { cregno = tregmap[regno]; if (cregno == tGS) - addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_gs); + addr = offsetof (struct pcb, pcb_gs); else addr = offset + 4 * cregno; if (addr < 0 || addr >= core_reg_size) @@ -136,11 +136,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) error ("Register %s not found in core file.", gdb_register_names[bad_reg]); } -#if __FreeBSD_version >= 500022 - addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_save); -#else - addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_savefpu); -#endif + addr = offsetof (struct pcb, pcb_save); memcpy (&pcb_savefpu, core_reg_sect + addr, sizeof pcb_savefpu); } @@ -170,11 +166,6 @@ extern void print_387_control_word (); /* i387-tdep.h */ extern void print_387_status_word (); #define fpstate save87 -#if __FreeBSD_version >= 500022 -#define U_FPSTATE(u) u.u_pcb.pcb_save.sv_87 -#else -#define U_FPSTATE(u) u.u_pcb.pcb_savefpu -#endif static void i387_to_double (from, to) @@ -344,15 +335,13 @@ i386_float_info () /* fpstate defined in <sys/user.h> */ struct fpstate *fpstatep; char buf[sizeof (struct fpstate) + 2 * sizeof (int)]; - unsigned int uaddr; char fpvalid; unsigned int rounded_addr; unsigned int rounded_size; /*extern int corechan;*/ int skip; extern int inferior_pid; - - uaddr = (char *)&U_FPSTATE(u) - (char *)&u; + if (inferior_pid != 0 && core_bfd == NULL) { int pid = inferior_pid & ((1 << 17) - 1); /* XXX extract pid from tid */ diff --git a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c index fdfc6a3..8a91d97 100644 --- a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c +++ b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c @@ -201,8 +201,12 @@ static struct proc * curProc () { struct proc *p; - CORE_ADDR addr = pcpu + PCPU_OFFSET (curproc); + struct thread *td; + CORE_ADDR addr = pcpu + PCPU_OFFSET (curthread); + if (kvread (addr, &td)) + error ("cannot read thread pointer at %x\n", addr); + addr = (CORE_ADDR)td->td_proc; if (kvread (addr, &p)) error ("cannot read proc pointer at %x\n", addr); return p; @@ -380,13 +384,13 @@ static void get_kcore_registers (regno) int regno; { - struct user *uaddr; + struct pcb *pcbaddr; /* find the pcb for the current process */ - if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr)) + if (cur_proc == NULL || kvread (&cur_proc->p_thread.td_pcb, &pcbaddr)) /* XXXKSE */ error ("cannot read u area ptr for proc at %#x", cur_proc); - if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0) - error ("cannot read pcb at %#x", &uaddr->u_pcb); + if (read_pcb (core_kd, (CORE_ADDR)pcbaddr) < 0) + error ("cannot read pcb at %#x", pcbaddr); } static void |