diff options
author | tegge <tegge@FreeBSD.org> | 1997-06-27 15:48:22 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 1997-06-27 15:48:22 +0000 |
commit | 62169ef6d3cadc3d5626c25c3284f78f95160287 (patch) | |
tree | 56a08293e7bfd1aa8bed68bca3bbb410a67de458 /gnu/usr.bin | |
parent | 85a4ec2f439a5c0c66a7408254d90b5c6150bf99 (diff) | |
download | FreeBSD-src-62169ef6d3cadc3d5626c25c3284f78f95160287.zip FreeBSD-src-62169ef6d3cadc3d5626c25c3284f78f95160287.tar.gz |
Don't depend upon the user structure having been aligned on a 8 KB boundary.
Reviewed by: Peter Wemm <peter@spinner.dialix.com.au>
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c | 13 | ||||
-rw-r--r-- | gnu/usr.bin/gdb/gdb/freebsd-nat.c | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c index c7c506f..4fdb09f 100644 --- a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c +++ b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <sys/ptrace.h> #include <machine/reg.h> #include <machine/frame.h> +#include <sys/param.h> +#include <sys/user.h> #include "gdbcore.h" #include "value.h" #include "inferior.h" @@ -91,8 +93,17 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) register int cregno; register int addr; int bad_reg = -1; - int offset = -reg_addr & (core_reg_size - 1); + int offset; + struct user *tmp_uaddr; + /* + * First get virtual address of user structure. Then calculate offset. + */ + memcpy(&tmp_uaddr, + &((struct user *) core_reg_sect)->u_kproc.kp_proc.p_addr, + sizeof(tmp_uaddr)); + offset = -reg_addr - (int) tmp_uaddr; + for (regno = 0; regno < NUM_REGS; regno++) { cregno = tregmap[regno]; diff --git a/gnu/usr.bin/gdb/gdb/freebsd-nat.c b/gnu/usr.bin/gdb/gdb/freebsd-nat.c index c7c506f..4fdb09f 100644 --- a/gnu/usr.bin/gdb/gdb/freebsd-nat.c +++ b/gnu/usr.bin/gdb/gdb/freebsd-nat.c @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <sys/ptrace.h> #include <machine/reg.h> #include <machine/frame.h> +#include <sys/param.h> +#include <sys/user.h> #include "gdbcore.h" #include "value.h" #include "inferior.h" @@ -91,8 +93,17 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) register int cregno; register int addr; int bad_reg = -1; - int offset = -reg_addr & (core_reg_size - 1); + int offset; + struct user *tmp_uaddr; + /* + * First get virtual address of user structure. Then calculate offset. + */ + memcpy(&tmp_uaddr, + &((struct user *) core_reg_sect)->u_kproc.kp_proc.p_addr, + sizeof(tmp_uaddr)); + offset = -reg_addr - (int) tmp_uaddr; + for (regno = 0; regno < NUM_REGS; regno++) { cregno = tregmap[regno]; |