diff options
author | dfr <dfr@FreeBSD.org> | 1999-05-02 19:50:18 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1999-05-02 19:50:18 +0000 |
commit | 5ba529d419d8eb92b4821af4e4f8e4d1c1710288 (patch) | |
tree | d24cf3aebc487bb35e43bb9e9abe980f95da2b0a /gnu | |
parent | 7d0a3aeb254780245a9188174a6b2eac32c801c9 (diff) | |
download | FreeBSD-src-5ba529d419d8eb92b4821af4e4f8e4d1c1710288.zip FreeBSD-src-5ba529d419d8eb92b4821af4e4f8e4d1c1710288.tar.gz |
* Merge gdb/doc/Makefile into binutils/doc/Makefile
* Update build for gdbserver and gdbreplay to work under binutils
* Fix gdbserver to use PT_GETREGS etc to access registers, removing the
dependancy on the u-area.
* Make gdbserver work on the alpha.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/binutils/Makefile | 4 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/doc/Makefile | 25 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdbreplay/Makefile | 12 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdbserver/Makefile | 12 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdbserver/low-fbsd.c | 228 |
5 files changed, 107 insertions, 174 deletions
diff --git a/gnu/usr.bin/binutils/Makefile b/gnu/usr.bin/binutils/Makefile index bcdffd2..af16d0d 100644 --- a/gnu/usr.bin/binutils/Makefile +++ b/gnu/usr.bin/binutils/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.6 1999/05/02 11:38:12 dfr Exp $ +# $Id: Makefile,v 1.7 1999/05/02 16:11:43 dfr Exp $ # SUBDIR= libiberty libbfd libopcodes libbinutils \ @@ -9,7 +9,7 @@ SUBDIR= libiberty libbfd libopcodes libbinutils \ # Maybe should be unconditional but I don't want to get in the # way of the mips port. .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "alpha" -SUBDIR+= gdb +SUBDIR+= gdb gdbserver gdbreplay .endif .include <bsd.subdir.mk> diff --git a/gnu/usr.bin/binutils/doc/Makefile b/gnu/usr.bin/binutils/doc/Makefile index 1c22a40..55ee170 100644 --- a/gnu/usr.bin/binutils/doc/Makefile +++ b/gnu/usr.bin/binutils/doc/Makefile @@ -1,18 +1,37 @@ -# $Id$ +# $Id: Makefile,v 1.1 1998/10/03 03:59:47 jdp Exp $ .include "../Makefile.inc0" -.PATH: ${SRCDIR}/gas/doc ${SRCDIR}/ld ${SRCDIR}/bfd/doc +GDBDIR= ${.CURDIR}/../../../../contrib/gdb +CONTRIBDIR= ${.CURDIR}/../../../../contrib -INFO = as ld +.PATH: ${SRCDIR}/gas/doc ${SRCDIR}/ld ${SRCDIR}/bfd/doc ${GDBDIR}/gdb/doc + +INFO = as ld annotate gdb gdbint stabs INFOSECTION= "Programming & development tools." INFOENTRY_as= "* As: (as). The GNU assembler." INFOENTRY_ld= "* Ld: (ld). The GNU linker." +INFOENTRY_annotate= "* GDB annotation: (annotate). Annotations for the GNU Debugger (GDB)." MAKEINFOFLAGS+= --no-validate MAKEINFOFLAGS+= -I ${SRCDIR}/gas/doc -I ${SRCDIR}/ld -I ${SRCDIR}/bfd/doc +MAKEINFOFLAGS+= -I ${GDBDIR}/gdb/doc +MAKEINFOFLAGS+= -I ${CONTRIBDIR}/libreadline/doc + +CLEANFILES= gdb-cfg.texi inc-hist.texi inc-hist.texi.orig as.info: as.texinfo asconfig.texi c-i386.texi ld.info: ld.texinfo bfdsumm.texi +gdb.info: gdb.texinfo gdb-cfg.texi GDBvn.texi remote.texi \ + rluser.texinfo inc-hist.texi + +gdb-cfg.texi: all-cfg.texi + ln -sf ${.ALLSRC} ${.TARGET} + +.PATH: ${CONTRIBDIR}/libreadline/doc +inc-hist.texi: hsuser.texinfo inc-hist.diff + cp ${.ALLSRC:M*.texinfo} ${.TARGET} + patch -b .orig < ${.ALLSRC:M*.diff} + .include <bsd.info.mk> diff --git a/gnu/usr.bin/binutils/gdbreplay/Makefile b/gnu/usr.bin/binutils/gdbreplay/Makefile index 1d93cc3..a0809d8 100644 --- a/gnu/usr.bin/binutils/gdbreplay/Makefile +++ b/gnu/usr.bin/binutils/gdbreplay/Makefile @@ -1,16 +1,20 @@ -# $Id: Makefile,v 1.2 1997/04/26 17:34:04 pst Exp $ +# $Id: Makefile,v 1.3 1998/05/01 14:48:04 bde Exp $ + +.include "../Makefile.inc0" GDBDIR= ${.CURDIR}/../../../../contrib/gdb .PATH: ${GDBDIR}/gdb/gdbserver .PATH: ${GDBDIR}/gdb -.PATH: ${GDBDIR}/opcodes PROG= gdbreplay NOMAN= yes SRCS= gdbreplay.c -CFLAGS+=-I${.CURDIR}/../gdb -I${.CURDIR}/../bfd -CFLAGS+=-DNO_MMALLOC +CFLAGS+= -I${.CURDIR}/../gdb/${MACHINE_ARCH} +CFLAGS+= -I${GDBDIR}/gdb +CFLAGS+= -I${GDBDIR}/gdb/config +CFLAGS+= -I${GDBDIR}/gdb/gdbserver +CFLAGS+= -DNO_MMALLOC .include <bsd.prog.mk> diff --git a/gnu/usr.bin/binutils/gdbserver/Makefile b/gnu/usr.bin/binutils/gdbserver/Makefile index 366f1b7..c20ca05 100644 --- a/gnu/usr.bin/binutils/gdbserver/Makefile +++ b/gnu/usr.bin/binutils/gdbserver/Makefile @@ -1,16 +1,20 @@ -# $Id: Makefile,v 1.2 1997/04/26 17:34:05 pst Exp $ +# $Id: Makefile,v 1.3 1998/05/01 14:48:06 bde Exp $ + +.include "../Makefile.inc0" GDBDIR= ${.CURDIR}/../../../../contrib/gdb .PATH: ${GDBDIR}/gdb/gdbserver .PATH: ${GDBDIR}/gdb -.PATH: ${GDBDIR}/opcodes PROG= gdbserver SRCS= remote-utils.c utils.c server.c SRCS+= low-fbsd.c -CFLAGS+=-I${.CURDIR}/../gdb -I${.CURDIR}/../bfd -CFLAGS+=-DNO_MMALLOC +CFLAGS+= -I${.CURDIR}/../gdb/${MACHINE_ARCH} +CFLAGS+= -I${GDBDIR}/gdb +CFLAGS+= -I${GDBDIR}/gdb/config +CFLAGS+= -I${GDBDIR}/gdb/gdbserver +CFLAGS+= -DNO_MMALLOC .include <bsd.prog.mk> diff --git a/gnu/usr.bin/binutils/gdbserver/low-fbsd.c b/gnu/usr.bin/binutils/gdbserver/low-fbsd.c index bc85f36..090628e 100644 --- a/gnu/usr.bin/binutils/gdbserver/low-fbsd.c +++ b/gnu/usr.bin/binutils/gdbserver/low-fbsd.c @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <sys/ioctl.h> #include <sgtty.h> #include <fcntl.h> +#include <string.h> /***************Begin MY defs*********************/ int quit_flag = 0; @@ -147,126 +148,101 @@ myresume (step, signal) perror_with_name ("ptrace"); } +#if defined(__i386__) -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif +/* this table must line up with REGISTER_NAMES in tm-i386v.h */ +/* symbols like 'tEAX' come from <machine/reg.h> */ +static int tregmap[] = +{ + tEAX, tECX, tEDX, tEBX, + tESP, tEBP, tESI, tEDI, + tEIP, tEFLAGS, tCS, tSS, + tDS, tES, tFS, tGS, +}; -/* U_REGS_OFFSET is the offset of the registers within the u area. */ -#if !defined (U_REGS_OFFSET) -#define U_REGS_OFFSET \ - ptrace (PT_READ_U, inferior_pid, \ - (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \ - - KERNEL_U_ADDR -#endif +static struct save87 pcb_savefpu; -unsigned int -register_addr (regno, blockend) +void +fetch_inferior_registers (regno) int regno; - int blockend; { - int addr; - - if (regno < 0 || regno >= ARCH_NUM_REGS) - error ("Invalid register number %d.", regno); + struct reg inferior_registers; /* ptrace order, not gcc/gdb order */ + int r; - REGISTER_U_ADDR (addr, blockend, regno); + ptrace (PT_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); - return addr; + for (r = 0; r < NUM_REGS; r++) + memcpy (®isters[REGISTER_BYTE (r)], ((int *)&inferior_registers) + tregmap[r], 4); } -/* Fetch one register. */ - -static void -fetch_register (regno) +void +store_inferior_registers (regno) int regno; { - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; + struct reg inferior_registers; /* ptrace order, not gcc/gdb order */ + int r; - /* Offset of registers within the u area. */ - unsigned int offset; + ptrace (PT_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); - offset = U_REGS_OFFSET; + for (r = 0; r < NUM_REGS; r++) + memcpy (((int *)&inferior_registers) + tregmap[r], ®isters[REGISTER_BYTE (r)], 4); - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - errno = 0; - *(int *) ®isters[ regno * sizeof(int) + i] = - ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - if (errno != 0) - { - /* Warning, not error, in case we are attached; sometimes the - kernel doesn't let us at the registers. */ - char *err = strerror (errno); - char *msg = alloca (strlen (err) + 128); - sprintf (msg, "reading register %d: %s", regno, err); - error (msg); - goto error_exit; - } - } - error_exit:; + ptrace (PT_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); } -/* Fetch all registers, or just one, from the child process. */ +#elif defined(__alpha__) void fetch_inferior_registers (regno) int regno; { - if (regno == -1 || regno == 0) - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); - else - fetch_register (regno); + struct reg regs; /* ptrace order, not gcc/gdb order */ + struct fpreg fpregs; + int r; + + ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); + ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &fpregs, 0); + + for (r = 0; r < 31; r++) + memcpy (®isters[REGISTER_BYTE (r)], + ®s.r_regs[r], sizeof(u_int64_t)); + for (r = 0; r < 32; r++) + memcpy (®isters[REGISTER_BYTE (r + FP0_REGNUM)], + &fpregs.fpr_regs[r], sizeof(u_int64_t)); + memcpy (®isters[REGISTER_BYTE (PC_REGNUM)], + ®s.r_regs[31], sizeof(u_int64_t)); + + memset (®isters[REGISTER_BYTE (ZERO_REGNUM)], 0, sizeof(u_int64_t)); + memset (®isters[REGISTER_BYTE (FP_REGNUM)], 0, sizeof(u_int64_t)); } -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - void store_inferior_registers (regno) int regno; { - register unsigned int regaddr; - char buf[80]; - extern char registers[]; - register int i; - unsigned int offset = U_REGS_OFFSET; - int scratch; - - if (regno >= 0) - { - regaddr = register_addr (regno, offset); - errno = 0; - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); - if (errno != 0) - { - /* Warning, not error, in case we are attached; sometimes the - kernel doesn't let us at the registers. */ - char *err = strerror (errno); - char *msg = alloca (strlen (err) + 128); - sprintf (msg, "writing register %d: %s", - regno, err); - error (msg); - return; - } - regaddr += sizeof(int); - } - } - else - for (regno = 0; regno < NUM_REGS; regno++) - store_inferior_registers (regno); + struct reg regs; /* ptrace order, not gcc/gdb order */ + struct fpreg fpregs; + int r; + + for (r = 0; r < 31; r++) + memcpy (®s.r_regs[r], + ®isters[REGISTER_BYTE (r)], sizeof(u_int64_t)); + for (r = 0; r < 32; r++) + memcpy (&fpregs.fpr_regs[r], + ®isters[REGISTER_BYTE (r + FP0_REGNUM)], sizeof(u_int64_t)); + memcpy (®s.r_regs[31], + ®isters[REGISTER_BYTE (PC_REGNUM)], sizeof(u_int64_t)); + + ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); + ptrace (PT_SETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &fpregs, 0); } +#endif + + /* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory in the NEW_SUN_PTRACE case. It ought to be straightforward. But it appears that writing did @@ -361,73 +337,3 @@ have_inferior_p () { return inferior_pid != 0; } - -/* Some systems don't provide all the registers on a trap. Use SS as a - default if so. */ - -#ifndef tDS -#define tDS tSS -#endif -#ifndef tES -#define tES tSS -#endif -#ifndef tFS -#define tFS tSS -#endif -#ifndef tGS -#define tGS tSS -#endif - -/* These tables map between the registers on a trap frame, and the register - order used by the rest of GDB. */ -/* this table must line up with REGISTER_NAMES in tm-i386.h */ -/* symbols like 'tEAX' come from <machine/reg.h> */ -static int tregmap[] = -{ - tEAX, tECX, tEDX, tEBX, - tESP, tEBP, tESI, tEDI, - tEIP, tEFLAGS, tCS, tSS, - tDS, tES, tFS, tGS -}; - -#ifdef sEAX -static int sregmap[] = -{ - sEAX, sECX, sEDX, sEBX, - sESP, sEBP, sESI, sEDI, - sEIP, sEFLAGS, sCS, sSS -}; -#else /* No sEAX */ - -/* FreeBSD has decided to collapse the s* and t* symbols. So if the s* - ones aren't around, use the t* ones for sregmap too. */ - -static int sregmap[] = -{ - tEAX, tECX, tEDX, tEBX, - tESP, tEBP, tESI, tEDI, - tEIP, tEFLAGS, tCS, tSS, - tDS, tES, tFS, tGS -}; -#endif /* No sEAX */ - -/* blockend is the value of u.u_ar0, and points to the - place where ES is stored. */ - -int -i386_register_u_addr (blockend, regnum) - int blockend; - int regnum; -{ - /* The following condition is a kludge to get at the proper register map - depending upon the state of pcb_flag. - The proper condition would be - if (u.u_pcb.pcb_flag & FM_TRAP) - but that would require a ptrace call here and wouldn't work - for corefiles. */ - - if (blockend < 0x1fcc) - return (blockend + 4 * tregmap[regnum]); - else - return (blockend + 4 * sregmap[regnum]); -} |