From: Fred Fish Date: Wed, 24 Jun 1992 04:49:48 +0000 (+0000) Subject: * Makefile.in (VERSION): Bump to 4.5.6. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e676a15f0b9ef089973311249917e203917b3903;p=binutils-gdb.git * Makefile.in (VERSION): Bump to 4.5.6. * coffread.c (coff_end_symtab): Cast 2nd arg of complain() to correct type. * defs.h (NORETURN): Define away for Lucid compiler. * remote.c (remote_timer, remote_interrupt): Signal handlers take one int arg. * ser-termios.c (serial_write, serial_close): Return whatever value the write/close call returns, rather than falling off end. * inferior.h (PTRACE_ARG3_TYPE): Third arg to ptrace is int on more systems than it is "char *". Define PTRACE_ARG3_TYPE to default to int. * infptrace.c, hppabsd-xdep.c, hppahpux-xdep.c, i386-xdep.c, inferior.h (call_ptrace): Use PTRACE_ARG3_TYPE to declare type of third arg. * a68v-xdep.c, arm-xdep.c, convex-xdep.c, hp300ux-xdep.c, infrun.c, m88k-xdep.c, mach386-xdep.c, mips-xdep.c, os68k-xdep.c, pyr-tdep.c, pyr-xdep.c, rs6000-xdep.c, sparc-xdep.c, sun3-xdep.c, sun386-xdep.c, symm-xdep.c, ultra3-xdep.c: Use PTRACE_ARG3_TYPE to cast ptrace argument 3. * sparc-xdep.c, a68v-xdep.c (fetch_inferior_registers, store_inferior_registers): Supply missing fourth argument to ptrace(). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0c8aa7c86c5..517543476bf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,28 @@ +Tue Jun 23 21:46:26 1992 Fred Fish (fnf@cygnus.com) + + * Makefile.in (VERSION): Bump to 4.5.6. + * coffread.c (coff_end_symtab): Cast 2nd arg of complain() to + correct type. + * defs.h (NORETURN): Define away for Lucid compiler. + * remote.c (remote_timer, remote_interrupt): Signal handlers + take one int arg. + * ser-termios.c (serial_write, serial_close): Return whatever + value the write/close call returns, rather than falling off end. + * inferior.h (PTRACE_ARG3_TYPE): Third arg to ptrace is int on + more systems than it is "char *". Define PTRACE_ARG3_TYPE to + default to int. + * infptrace.c, hppabsd-xdep.c, hppahpux-xdep.c, i386-xdep.c, + inferior.h (call_ptrace): Use PTRACE_ARG3_TYPE to declare type + of third arg. + * a68v-xdep.c, arm-xdep.c, convex-xdep.c, hp300ux-xdep.c, infrun.c, + m88k-xdep.c, mach386-xdep.c, mips-xdep.c, os68k-xdep.c, pyr-tdep.c, + pyr-xdep.c, rs6000-xdep.c, sparc-xdep.c, sun3-xdep.c, sun386-xdep.c, + symm-xdep.c, ultra3-xdep.c: Use PTRACE_ARG3_TYPE to cast ptrace + argument 3. + * sparc-xdep.c, a68v-xdep.c (fetch_inferior_registers, + store_inferior_registers): Supply missing fourth argument to + ptrace(). + Mon Jun 22 20:18:06 1992 Fred Fish (fnf@cygnus.com) * command.c (add_abbrev_prefix_cmd): Fix misspelling in comment. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c1b0b5062c8..b78657eaed7 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -163,7 +163,7 @@ CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_LIB} ${MMALLOC_LIB} ${LIBIBERTY} \ ADD_FILES = ${REGEX} ${ALLOCA} ${XM_ADD_FILES} ${TM_ADD_FILES} ADD_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES} -VERSION = 4.5.5 +VERSION = 4.5.6 DIST=gdb LINT=/usr/5bin/lint diff --git a/gdb/a68v-xdep.c b/gdb/a68v-xdep.c index 036ef7bc0fa..9aa6aff6130 100644 --- a/gdb/a68v-xdep.c +++ b/gdb/a68v-xdep.c @@ -36,9 +36,11 @@ fetch_inferior_registers () registers_fetched (); - ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers); + ptrace (PTRACE_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); #ifdef FP0_REGNUM - ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); #endif bcopy (&inferior_registers, registers, 16 * 4); @@ -82,9 +84,11 @@ store_inferior_registers (regno) sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); #endif - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); + ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); #if FP0_REGNUM - ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); #endif } diff --git a/gdb/arm-xdep.c b/gdb/arm-xdep.c index 149b30fd3cd..64aa0d8c33d 100644 --- a/gdb/arm-xdep.c +++ b/gdb/arm-xdep.c @@ -50,29 +50,33 @@ fetch_inferior_registers (regno) struct user u; unsigned int offset = (char *) &u.u_ar0 - (char *) &u; - offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR; + offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) + - KERNEL_U_ADDR; registers_fetched (); for (regno = 0; regno < 16; regno++) { regaddr = offset + regno * 4; - *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, regaddr, 0); + *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, 0); if (regno == PC_REGNUM) *(int *)&buf[0] = GET_PC_PART(*(int *)&buf[0]); supply_register (regno, buf); } - *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, offset + PC*4); + *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, + (PTRACE_ARG3_TYPE) (offset + PC*4), 0); supply_register (PS_REGNUM, buf); /* set virtual register ps same as pc */ /* read the floating point registers */ offset = (char *) &u.u_fp_regs - (char *)&u; - *(int *)buf = ptrace (PT_READ_U, inferior_pid, offset, 0); + *(int *)buf = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0); supply_register (FPS_REGNUM, buf); for (regno = 16; regno < 24; regno++) { regaddr = offset + 4 + 12 * (regno - 16); for (i = 0; i < 12; i += sizeof(int)) - *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, regaddr + i, 0); + *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, + (PTRACE_ARG3_TYPE) (regaddr + i), 0); supply_register (regno, buf); } } @@ -91,7 +95,8 @@ store_inferior_registers (regno) struct user u; unsigned long value; unsigned int offset = (char *) &u.u_ar0 - (char *) &u; - offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR; + offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) + - KERNEL_U_ADDR; if (regno >= 0) { if (regno >= 16) return; @@ -100,7 +105,7 @@ store_inferior_registers (regno) value = read_register(regno); if (regno == PC_REGNUM) value = SET_PC_PART(read_register (PS_REGNUM), value); - ptrace (PT_WRITE_U, inferior_pid, regaddr, value); + ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); if (errno != 0) { sprintf (buf, "writing register number %d", regno); @@ -114,7 +119,7 @@ store_inferior_registers (regno) value = read_register(regno); if (regno == PC_REGNUM) value = SET_PC_PART(read_register (PS_REGNUM), value); - ptrace (6, inferior_pid, regaddr, value); + ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); if (errno != 0) { sprintf (buf, "writing all regs, number %d", regno); diff --git a/gdb/coffread.c b/gdb/coffread.c index ee9b9e87cc8..75468f7224e 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -614,7 +614,8 @@ coff_end_symtab (objfile) if (BLOCK_START(pb->block) < BLOCK_START(pbnext->block)) { struct block *tmp = pb->block; - complain (&misordered_blocks_complaint, BLOCK_START (pb->block)); + complain (&misordered_blocks_complaint, + (char *) BLOCK_START (pb->block)); pb->block = pbnext->block; pbnext->block = tmp; swapped = 1; diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c index 6bd57ab8079..ba4da80218e 100644 --- a/gdb/convex-xdep.c +++ b/gdb/convex-xdep.c @@ -218,7 +218,9 @@ static ptr_cmp (); int call_ptrace (request, pid, procaddr, buf) - int request, pid, procaddr, buf; + int request, pid; + PTRACE_ARG3_TYPE procaddr; + int buf; { if (request == 0) return; diff --git a/gdb/defs.h b/gdb/defs.h index 35151c7134e..1ea3a1e7766 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -223,6 +223,9 @@ n_spaces PARAMS ((int)); extern void printchar PARAMS ((int, FILE *, int)); +extern char * +strdup_demangled PARAMS ((const char *)); + extern void fprint_symbol PARAMS ((FILE *, char *)); @@ -407,7 +410,11 @@ local_hex_string_custom PARAMS ((int, char *)); /* language.c */ to keep them happy */ #ifndef NORETURN -# define NORETURN volatile +# ifdef __lucid +# define NORETURN /*nothing*/ +# else +# define NORETURN volatile +# endif #endif /* Defaults for system-wide constants (if not defined by xm.h, we fake it). */ @@ -558,7 +565,7 @@ mmtrace PARAMS ((void)); extern int parse_escape PARAMS ((char **)); -extern char *reg_names[]; +extern const char * const reg_names[]; extern NORETURN void /* Does not return to the caller. */ error (); @@ -688,7 +695,9 @@ strerror PARAMS ((int)); /* 4.11.6.2 */ # ifdef sparc # include # endif - extern char *alloca (); +# ifndef alloca /* May be macro, with args, in */ + extern char *alloca (); +# endif # endif #endif diff --git a/gdb/hp300ux-xdep.c b/gdb/hp300ux-xdep.c index 6c30766cff8..f043accd0b0 100644 --- a/gdb/hp300ux-xdep.c +++ b/gdb/hp300ux-xdep.c @@ -41,7 +41,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define INFERIOR_AR0(u) \ ((ptrace \ - (PT_RUAREA, inferior_pid, ((char *) &u.u_ar0 - (char *) &u), 0)) \ + (PT_RUAREA, inferior_pid, \ + (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0)) \ - KERNEL_U_ADDR) static void @@ -55,7 +56,8 @@ fetch_inferior_register (regno, regaddr) union { int i; short s[2]; } ps_val; int regval; - ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0)); + ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + 0)); regval = ps_val.s[0]; supply_register (regno, ®val); } @@ -67,7 +69,8 @@ fetch_inferior_register (regno, regaddr) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { - *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, regaddr, 0); + *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, 0); regaddr += sizeof (int); } supply_register (regno, buf); @@ -82,7 +85,7 @@ store_inferior_register_1 (regno, regaddr, value) int value; { errno = 0; - ptrace (PT_WUAREA, inferior_pid, regaddr, value); + ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); #if 0 /* HP-UX randomly sets errno to non-zero for regno == 25. However, the value is correctly written, so ignore errno. */ @@ -107,7 +110,8 @@ store_inferior_register (regno, regaddr) { union { int i; short s[2]; } ps_val; - ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0)); + ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + 0)); ps_val.s[0] = (read_register (regno)); store_inferior_register_1 (regno, regaddr, ps_val.i); } diff --git a/gdb/hppabsd-xdep.c b/gdb/hppabsd-xdep.c index ca3d10e610f..3c1b1ea2b28 100644 --- a/gdb/hppabsd-xdep.c +++ b/gdb/hppabsd-xdep.c @@ -60,7 +60,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ machine-dependent file. */ int call_ptrace (request, pid, addr, data) - int request, pid, *addr, data; + int request, pid; + PTRACE_ARG3_TYPE addr; + int data; { return ptrace (request, pid, addr, data); } @@ -78,7 +80,7 @@ kill_inferior_fast () { if (inferior_pid == 0) return; - ptrace (PT_KILL, inferior_pid, 0, 0); + ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0); wait ((int *)0); } @@ -100,14 +102,14 @@ child_resume (step, signal) { errno = 0; - /* An address of (int *)1 tells ptrace to continue from where it was. - (If GDB wanted it to start some other way, we have already written - a new PC value to the child.) */ + /* An address of (PTRACE_ARG3_TYPE) 1 tells ptrace to continue from where + it was. (If GDB wanted it to start some other way, we have already + written a new PC value to the child.) */ if (step) - ptrace (PT_STEP, inferior_pid, (int *)1, signal); + ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); else - ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal); + ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); if (errno) perror_with_name ("ptrace"); @@ -124,7 +126,7 @@ attach (pid) int pid; { errno = 0; - ptrace (PT_ATTACH, pid, 0, 0); + ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0); if (errno) perror_with_name ("ptrace"); attach_flag = 1; @@ -140,7 +142,7 @@ detach (signal) int signal; { errno = 0; - ptrace (PT_DETACH, inferior_pid, 1, signal); + ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); if (errno) perror_with_name ("ptrace"); attach_flag = 0; @@ -202,7 +204,8 @@ void _initialize_kernel_u_addr () #if !defined (U_REGS_OFFSET) #define U_REGS_OFFSET \ ptrace (PT_READ_U, inferior_pid, \ - (int *)(offsetof (struct user, u_ar0)), 0) - KERNEL_U_ADDR + (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \ + - KERNEL_U_ADDR #endif /* Registers we shouldn't try to fetch. */ @@ -237,7 +240,8 @@ fetch_register (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { errno = 0; - *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, (int *)regaddr, 0); + *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, 0); regaddr += sizeof (int); if (errno != 0) { @@ -290,7 +294,7 @@ store_inferior_registers (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) { errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr, + ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, *(int *) ®isters[REGISTER_BYTE (regno) + i]); if (errno != 0) { @@ -310,7 +314,7 @@ store_inferior_registers (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) { errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr, + ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, *(int *) ®isters[REGISTER_BYTE (regno) + i]); if (errno != 0) { @@ -363,14 +367,16 @@ child_xfer_memory (memaddr, myaddr, len, write, target) if (addr != memaddr || len < (int)sizeof (int)) { /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0); + buffer[0] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, + 0); } if (count > 1) /* FIXME, avoid if even boundary */ { buffer[count - 1] = ptrace (PT_READ_I, inferior_pid, - (int *)(addr + (count - 1) * sizeof (int)), 0); + (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)), + 0); } /* Copy data to be written over corresponding part of buffer */ @@ -382,13 +388,15 @@ child_xfer_memory (memaddr, myaddr, len, write, target) for (i = 0; i < count; i++, addr += sizeof (int)) { errno = 0; - ptrace (PT_WRITE_D, inferior_pid, (int *)addr, buffer[i]); + ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, + buffer[i]); if (errno) { /* Using the appropriate one (I or D) is necessary for Gould NP1, at least. */ errno = 0; - ptrace (PT_WRITE_I, inferior_pid, (int *)addr, buffer[i]); + ptrace (PT_WRITE_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, + buffer[i]); } if (errno) return 0; @@ -400,7 +408,8 @@ child_xfer_memory (memaddr, myaddr, len, write, target) for (i = 0; i < count; i++, addr += sizeof (int)) { errno = 0; - buffer[i] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0); + buffer[i] = ptrace (PT_READ_I, inferior_pid, + (PTRACE_ARG3_TYPE) addr, 0); if (errno) return 0; QUIT; diff --git a/gdb/hppahpux-xdep.c b/gdb/hppahpux-xdep.c index d5fa3c4a96a..cd32c4e1cae 100644 --- a/gdb/hppahpux-xdep.c +++ b/gdb/hppahpux-xdep.c @@ -59,7 +59,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ machine-dependent file. */ int call_ptrace (request, pid, addr, data) - int request, pid, *addr, data; + int request, pid; + PTRACE_ARG3_TYPE addr; + int data; { return ptrace (request, pid, addr, data, 0); } @@ -77,7 +79,7 @@ kill_inferior_fast () { if (inferior_pid == 0) return; - ptrace (PT_EXIT, inferior_pid, 0, 0, 0); /* PT_EXIT = PT_KILL ? */ + ptrace (PT_EXIT, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0, 0); /* PT_EXIT = PT_KILL ? */ wait ((int *)0); } @@ -99,14 +101,14 @@ child_resume (step, signal) { errno = 0; - /* An address of (int *)1 tells ptrace to continue from where it was. - (If GDB wanted it to start some other way, we have already written - a new PC value to the child.) */ + /* An address of (PTRACE_ARG3_TYPE) 1 tells ptrace to continue from where + it was. (If GDB wanted it to start some other way, we have already + written a new PC value to the child.) */ if (step) - ptrace (PT_SINGLE, inferior_pid, (int *)1, signal, 0); + ptrace (PT_SINGLE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); else - ptrace (PT_CONTIN, inferior_pid, (int *)1, signal, 0); + ptrace (PT_CONTIN, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); if (errno) perror_with_name ("ptrace"); @@ -123,7 +125,7 @@ attach (pid) int pid; { errno = 0; - ptrace (PT_ATTACH, pid, 0, 0, 0); + ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0, 0); if (errno) perror_with_name ("ptrace"); attach_flag = 1; @@ -139,7 +141,7 @@ detach (signal) int signal; { errno = 0; - ptrace (PT_DETACH, inferior_pid, 1, signal, 0); + ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); if (errno) perror_with_name ("ptrace"); attach_flag = 0; @@ -201,7 +203,8 @@ void _initialize_kernel_u_addr () #if !defined (U_REGS_OFFSET) #define U_REGS_OFFSET \ ptrace (PT_READ_U, inferior_pid, \ - (int *)(offsetof (struct user, u_ar0)), 0, 0) - KERNEL_U_ADDR + (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0, 0) \ + - KERNEL_U_ADDR #endif /* Registers we shouldn't try to fetch. */ @@ -236,7 +239,8 @@ fetch_register (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { errno = 0; - *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, (int *)regaddr, 0, 0); + *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, 0, 0); regaddr += sizeof (int); if (errno != 0) { @@ -289,7 +293,7 @@ store_inferior_registers (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) { errno = 0; - ptrace (PT_WUAREA, inferior_pid, (int *)regaddr, + ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, *(int *) ®isters[REGISTER_BYTE (regno) + i], 0); if (errno != 0) { @@ -309,7 +313,7 @@ store_inferior_registers (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) { errno = 0; - ptrace (PT_WUAREA, inferior_pid, (int *)regaddr, + ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, *(int *) ®isters[REGISTER_BYTE (regno) + i], 0); if (errno != 0) { @@ -362,14 +366,16 @@ child_xfer_memory (memaddr, myaddr, len, write, target) if (addr != memaddr || len < (int)sizeof (int)) { /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_RIUSER, inferior_pid, (int *)addr, 0, 0); + buffer[0] = ptrace (PT_RIUSER, inferior_pid, + (PTRACE_ARG3_TYPE) addr, 0, 0); } if (count > 1) /* FIXME, avoid if even boundary */ { buffer[count - 1] = ptrace (PT_RIUSER, inferior_pid, - (int *)(addr + (count - 1) * sizeof (int)), 0, 0); + (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)), + 0, 0); } /* Copy data to be written over corresponding part of buffer */ @@ -381,13 +387,15 @@ child_xfer_memory (memaddr, myaddr, len, write, target) for (i = 0; i < count; i++, addr += sizeof (int)) { errno = 0; - ptrace (PT_WDUSER, inferior_pid, (int *)addr, buffer[i], 0); + ptrace (PT_WDUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr, + buffer[i], 0); if (errno) { /* Using the appropriate one (I or D) is necessary for Gould NP1, at least. */ errno = 0; - ptrace (PT_WIUSER, inferior_pid, (int *)addr, buffer[i], 0); + ptrace (PT_WIUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr, + buffer[i], 0); } if (errno) return 0; @@ -399,7 +407,8 @@ child_xfer_memory (memaddr, myaddr, len, write, target) for (i = 0; i < count; i++, addr += sizeof (int)) { errno = 0; - buffer[i] = ptrace (PT_RIUSER, inferior_pid, (int *)addr, 0, 0); + buffer[i] = ptrace (PT_RIUSER, inferior_pid, + (PTRACE_ARG3_TYPE) addr, 0, 0); if (errno) return 0; QUIT; diff --git a/gdb/i386-xdep.c b/gdb/i386-xdep.c index 65bba6fd103..38ba8f037af 100644 --- a/gdb/i386-xdep.c +++ b/gdb/i386-xdep.c @@ -194,7 +194,7 @@ i386_float_info () unsigned int mask; rounded_addr = uaddr & -sizeof (int); - data = ptrace (3, inferior_pid, rounded_addr, 0); + data = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); mask = 0xff << ((uaddr - rounded_addr) * 8); fpvalid = ((data & mask) != 0); @@ -229,7 +229,7 @@ i386_float_info () ip = (int *)buf; for (i = 0; i < rounded_size; i++) { - *ip++ = ptrace (3, inferior_pid, rounded_addr, 0); + *ip++ = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); rounded_addr += sizeof (int); } } diff --git a/gdb/inflow.c b/gdb/inflow.c index 22b4968c573..8d9a6aac153 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include "defs.h" #include "frame.h" #include "inferior.h" @@ -37,7 +36,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include -extern char *strerror(); /* strings corresponding to errno */ +static void +kill_command PARAMS ((char *, int)); + +static void +terminal_ours_1 PARAMS ((int)); extern struct target_ops child_ops; @@ -51,10 +54,10 @@ int attach_flag; /* Does GDB have a terminal (on stdin)? */ int gdb_has_a_terminal; - +#if !defined(__GO32__) static TERMINAL sg_inferior; static TERMINAL sg_ours; - +#endif static int tflags_inferior; static int tflags_ours; @@ -111,6 +114,7 @@ static void terminal_ours_1 (); void terminal_init_inferior () { +#if !defined(__GO32__) sg_inferior = sg_ours; tflags_inferior = tflags_ours; @@ -129,7 +133,7 @@ terminal_init_inferior () #ifdef TIOCGPGRP pgrp_inferior = inferior_pid; #endif /* TIOCGPGRP */ - +#endif terminal_is_ours = 1; } @@ -139,6 +143,7 @@ terminal_init_inferior () void terminal_inferior () { +#if !defined(__GO32__) int result; if (gdb_has_a_terminal && terminal_is_ours && inferior_thisrun_terminal == 0) @@ -175,6 +180,7 @@ terminal_inferior () sigquit_ours = (void (*) ()) signal (SIGQUIT, SIG_IGN); #endif /* TIOCGPGRP */ } +#endif terminal_is_ours = 0; } @@ -206,6 +212,7 @@ static void terminal_ours_1 (output_only) int output_only; { +#if !defined(__GO32__) int result; #ifdef TIOCGPGRP /* Ignore this signal since it will happen when we try to set the pgrp. */ @@ -278,6 +285,9 @@ terminal_ours_1 (output_only) #else /* not HAVE_TERMIO */ sg_ours.sg_flags &= ~RAW & ~CBREAK; #endif /* not HAVE_TERMIO */ + + result = result; /* lint */ +#endif } /* ARGSUSED */ @@ -301,7 +311,7 @@ child_terminal_info (args, from_tty) printf_filtered ("This GDB does not control a terminal.\n"); return; } - +#if !defined(__GO32__) #ifdef TIOCGPGRP printf_filtered ("Inferior's terminal status (currently saved by GDB):\n"); @@ -343,6 +353,10 @@ child_terminal_info (args, from_tty) #ifdef TIOCLGET printf_filtered ("lmode: 0x%x\n", lmode_inferior); #endif +#else + printf_filtered("This is a DOS machine; there is no terminal state\n"); +#endif + } /* NEW_TTY_PREFORK is called before forking a new child process, @@ -367,17 +381,22 @@ void new_tty () { register int tty; + void (*osigttou) (); if (inferior_thisrun_terminal == 0) return; - +#if !defined(__GO32__) #ifdef TIOCNOTTY - /* Disconnect the child process from our controlling terminal. */ + /* Disconnect the child process from our controlling terminal. On some + systems (SVR4 for example), this may cause a SIGTTOU, so temporarily + ignore SIGTTOU. */ tty = open("/dev/tty", O_RDWR); if (tty > 0) { + osigttou = (void (*)()) signal(SIGTTOU, SIG_IGN); ioctl(tty, TIOCNOTTY, 0); close(tty); + (void) signal(SIGTTOU, osigttou); } #endif @@ -403,6 +422,7 @@ new_tty () { close (2); dup (tty); } if (tty > 2) close(tty); +#endif /* !go32*/o } /* Kill the inferior process. Make us have no inferior. */ @@ -492,8 +512,8 @@ try_writing_regs_command (arg, from_tty) { QUIT; errno = 0; - value = call_ptrace (3, inferior_pid, i, 0); - call_ptrace (6, inferior_pid, i, value); + value = call_ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) i, 0); + call_ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) i, value); if (errno == 0) { printf (" Succeeded with address 0x%x; value 0x%x (%d).\n", @@ -527,8 +547,8 @@ Report which ones can be written."); /* Get all the current tty settings (including whether we have a tty at all!). */ +#if !defined(__GO32__) tflags_ours = fcntl (0, F_GETFL, 0); - OOPSY ("fcntl F_GETFL"); /* Should always work */ result = ioctl (0, TIOCGETP, &sg_ours); if (result == 0) { @@ -549,6 +569,10 @@ Report which ones can be written."); } else { gdb_has_a_terminal = 0; } +#else + gdb_has_a_terminal = 0; +#endif + terminal_is_ours = 1; } diff --git a/gdb/infptrace.c b/gdb/infptrace.c index 3c26c870955..52461579cbb 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include "defs.h" #include "frame.h" #include "inferior.h" @@ -66,13 +65,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include /* For struct nlist */ #endif /* KERNEL_U_ADDR_BSD. */ #endif /* !FETCH_INFERIOR_REGISTERS */ + /* This function simply calls ptrace with the given arguments. It exists so that all calls to ptrace are isolated in this machine-dependent file. */ int call_ptrace (request, pid, addr, data) - int request, pid, *addr, data; + int request, pid; + PTRACE_ARG3_TYPE addr; + int data; { return ptrace (request, pid, addr, data); } @@ -90,7 +92,7 @@ kill_inferior_fast () { if (inferior_pid == 0) return; - ptrace (PT_KILL, inferior_pid, 0, 0); + ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0); wait ((int *)0); } @@ -112,14 +114,22 @@ child_resume (step, signal) { errno = 0; - /* An address of (int *)1 tells ptrace to continue from where it was. - (If GDB wanted it to start some other way, we have already written - a new PC value to the child.) */ + /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where + it was. (If GDB wanted it to start some other way, we have already + written a new PC value to the child.) */ if (step) - ptrace (PT_STEP, inferior_pid, (int *)1, signal); +#ifdef NO_SINGLE_STEP + single_step (signal); +#else + ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); +#endif else - ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal); +#ifdef AIX_BUGGY_PTRACE_CONTINUE + AIX_BUGGY_PTRACE_CONTINUE; +#else + ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); +#endif if (errno) perror_with_name ("ptrace"); @@ -136,7 +146,7 @@ attach (pid) int pid; { errno = 0; - ptrace (PT_ATTACH, pid, 0, 0); + ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0); if (errno) perror_with_name ("ptrace"); attach_flag = 1; @@ -152,7 +162,7 @@ detach (signal) int signal; { errno = 0; - ptrace (PT_DETACH, inferior_pid, 1, signal); + ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); if (errno) perror_with_name ("ptrace"); attach_flag = 0; @@ -211,7 +221,8 @@ void _initialize_kernel_u_addr () #if !defined (U_REGS_OFFSET) #define U_REGS_OFFSET \ ptrace (PT_READ_U, inferior_pid, \ - (int *)(offsetof (struct user, u_ar0)), 0) - KERNEL_U_ADDR + (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \ + - KERNEL_U_ADDR #endif /* Registers we shouldn't try to fetch. */ @@ -246,7 +257,8 @@ fetch_register (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { errno = 0; - *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, (int *)regaddr, 0); + *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, 0); regaddr += sizeof (int); if (errno != 0) { @@ -280,7 +292,7 @@ fetch_inferior_registers (regno) If REGNO is -1, do this for all registers. Otherwise, REGNO specifies which register (so we can save time). */ -int +void store_inferior_registers (regno) int regno; { @@ -288,7 +300,6 @@ store_inferior_registers (regno) char buf[80]; extern char registers[]; register int i; - int result = 0; unsigned int offset = U_REGS_OFFSET; @@ -298,13 +309,12 @@ store_inferior_registers (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) { errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr, + ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, *(int *) ®isters[REGISTER_BYTE (regno) + i]); if (errno != 0) { sprintf (buf, "writing register number %d(%d)", regno, i); perror_with_name (buf); - result = -1; } regaddr += sizeof(int); } @@ -319,19 +329,17 @@ store_inferior_registers (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) { errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr, + ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, *(int *) ®isters[REGISTER_BYTE (regno) + i]); if (errno != 0) { sprintf (buf, "writing register number %d(%d)", regno, i); perror_with_name (buf); - result = -1; } regaddr += sizeof(int); } } } - return result; } #endif /* !defined (FETCH_INFERIOR_REGISTERS). */ @@ -373,14 +381,16 @@ child_xfer_memory (memaddr, myaddr, len, write, target) if (addr != memaddr || len < (int)sizeof (int)) { /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0); + buffer[0] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, + 0); } if (count > 1) /* FIXME, avoid if even boundary */ { buffer[count - 1] = ptrace (PT_READ_I, inferior_pid, - (int *)(addr + (count - 1) * sizeof (int)), 0); + (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)), + 0); } /* Copy data to be written over corresponding part of buffer */ @@ -392,13 +402,15 @@ child_xfer_memory (memaddr, myaddr, len, write, target) for (i = 0; i < count; i++, addr += sizeof (int)) { errno = 0; - ptrace (PT_WRITE_D, inferior_pid, (int *)addr, buffer[i]); + ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, + buffer[i]); if (errno) { /* Using the appropriate one (I or D) is necessary for Gould NP1, at least. */ errno = 0; - ptrace (PT_WRITE_I, inferior_pid, (int *)addr, buffer[i]); + ptrace (PT_WRITE_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, + buffer[i]); } if (errno) return 0; @@ -410,7 +422,8 @@ child_xfer_memory (memaddr, myaddr, len, write, target) for (i = 0; i < count; i++, addr += sizeof (int)) { errno = 0; - buffer[i] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0); + buffer[i] = ptrace (PT_READ_I, inferior_pid, + (PTRACE_ARG3_TYPE) addr, 0); if (errno) return 0; QUIT; diff --git a/gdb/infrun.c b/gdb/infrun.c index e23f5016d05..924bfcd6320 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -581,9 +581,11 @@ child_create_inferior (exec_file, allargs, env) for the inferior. */ #ifdef USE_PROC_FS - proc_set_exec_trap (); /* Use SVR4 /proc interface */ + /* Use SVR4 /proc interface */ + proc_set_exec_trap (); #else - call_ptrace (0, 0, 0, 0); /* "Trace me, Dr. Memory!" */ + /* "Trace me, Dr. Memory!" */ + call_ptrace (0, 0, (PTRACE_ARG3_TYPE) 0, 0); #endif /* There is no execlpe call, so we have to set the environment diff --git a/gdb/m88k-xdep.c b/gdb/m88k-xdep.c index d2d338dae1f..9c4d1c55853 100644 --- a/gdb/m88k-xdep.c +++ b/gdb/m88k-xdep.c @@ -78,7 +78,7 @@ fetch_inferior_registers (regno) offset = (char *) &u.pt_r0 - (char *) &u; regaddr = offset; /* byte offset to r0;*/ -/* offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR; */ +/* offset = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ for (regno = 0; regno < NUM_REGS; regno++) { /*regaddr = register_addr (regno, offset);*/ @@ -86,17 +86,21 @@ fetch_inferior_registers (regno) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { - *(int *) &buf[i] = ptrace (3, inferior_pid, regaddr, 0); + *(int *) &buf[i] = ptrace (3, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, 0); regaddr += sizeof (int); } supply_register (regno, buf); } /* now load up registers 36 - 38; special pc registers */ - *(int *) &buf[0] = ptrace (3,inferior_pid,SXIP_OFFSET ,0); + *(int *) &buf[0] = ptrace (3,inferior_pid, + (PTRACE_ARG3_TYPE) SXIP_OFFSET ,0); supply_register (SXIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid,SNIP_OFFSET,0); + *(int *) &buf[0] = ptrace (3, inferior_pid, + (PTRACE_ARG3_TYPE) SNIP_OFFSET,0); supply_register (SNIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid,SFIP_OFFSET,0); + *(int *) &buf[0] = ptrace (3, inferior_pid, + (PTRACE_ARG3_TYPE) SFIP_OFFSET,0); supply_register (SFIP_REGNUM, buf); } @@ -125,7 +129,8 @@ store_inferior_registers (regno) { regaddr = offset + regno * sizeof (int); errno = 0; - ptrace (6, inferior_pid, regaddr, read_register (regno)); + ptrace (6, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); if (errno != 0) { sprintf (buf, "writing register number %d", regno); @@ -133,11 +138,14 @@ store_inferior_registers (regno) } } else if (regno == SXIP_REGNUM) - ptrace (6, inferior_pid, SXIP_OFFSET, read_register(regno)); + ptrace (6, inferior_pid, + (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno)); else if (regno == SNIP_REGNUM) - ptrace (6, inferior_pid, SNIP_OFFSET, read_register(regno)); + ptrace (6, inferior_pid, + (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno)); else if (regno == SFIP_REGNUM) - ptrace (6, inferior_pid, SFIP_OFFSET, read_register(regno)); + ptrace (6, inferior_pid, + (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno)); else printf ("Bad register number for store_inferior routine\n"); } else { @@ -146,16 +154,20 @@ store_inferior_registers (regno) /* regaddr = register_addr (regno, offset); */ errno = 0; regaddr = offset + regno * sizeof (int); - ptrace (6, inferior_pid, regaddr, read_register (regno)); + ptrace (6, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); if (errno != 0) { sprintf (buf, "writing register number %d", regno); perror_with_name (buf); } } - ptrace (6,inferior_pid,SXIP_OFFSET,read_register(SXIP_REGNUM)); - ptrace (6,inferior_pid,SNIP_OFFSET,read_register(SNIP_REGNUM)); - ptrace (6,inferior_pid,SFIP_OFFSET,read_register(SFIP_REGNUM)); + ptrace (6,inferior_pid, + (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM)); + ptrace (6,inferior_pid, + (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM)); + ptrace (6,inferior_pid, + (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM)); } diff --git a/gdb/mach386-xdep.c b/gdb/mach386-xdep.c index 10777857c6c..8f7ca166a47 100644 --- a/gdb/mach386-xdep.c +++ b/gdb/mach386-xdep.c @@ -49,8 +49,10 @@ fetch_inferior_registers (regno) registers_fetched (); - ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers); - ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); + ptrace (PTRACE_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); bcopy (&inferior_registers, registers, sizeof inferior_registers); @@ -87,20 +89,24 @@ store_inferior_registers (regno) instruction that moves eax into ebp gets single-stepped. */ { int stack = inferior_registers.r_reg[SP_REGNUM]; - int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, stack); + int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, + (PTRACE_ARG3_TYPE) stack); int reg = inferior_registers.r_reg[EAX]; inferior_registers.r_reg[EAX] = inferior_registers.r_reg[FP_REGNUM]; - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); - ptrace (PTRACE_POKEDATA, inferior_pid, stack, 0xc589); - ptrace (PTRACE_SINGLESTEP, inferior_pid, stack, 0); + ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); + ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0xc589); + ptrace (PTRACE_SINGLESTEP, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0); wait (0); - ptrace (PTRACE_POKEDATA, inferior_pid, stack, stuff); + ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, stuff); inferior_registers.r_reg[EAX] = reg; } #endif - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); - ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); + ptrace (PTRACE_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); } #else /* Not mach386 target. */ diff --git a/gdb/mips-xdep.c b/gdb/mips-xdep.c index e08ee6fc16b..511c8c5f803 100644 --- a/gdb/mips-xdep.c +++ b/gdb/mips-xdep.c @@ -105,7 +105,8 @@ fetch_inferior_registers (regno) regaddr = REGISTER_PTRACE_ADDR (regno); for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { - *(int *) &buf[i] = ptrace (3, inferior_pid, regaddr, 0); + *(int *) &buf[i] = ptrace (3, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, 0); regaddr += sizeof (int); } supply_register (regno, buf); @@ -130,7 +131,8 @@ store_inferior_registers (regno) { regaddr = REGISTER_PTRACE_ADDR (regno); errno = 0; - ptrace (6, inferior_pid, regaddr, read_register (regno)); + ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + read_register (regno)); if (errno != 0) { sprintf (buf, "writing register number %d", regno); @@ -148,7 +150,8 @@ store_inferior_registers (regno) continue; regaddr = register_addr (regno, 1); errno = 0; - ptrace (6, inferior_pid, regaddr, read_register (regno)); + ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + read_register (regno)); if (errno != 0) { sprintf (buf, "writing all regs, number %d", regno); diff --git a/gdb/os68k-xdep.c b/gdb/os68k-xdep.c index 02530127a83..da7150c19be 100644 --- a/gdb/os68k-xdep.c +++ b/gdb/os68k-xdep.c @@ -40,9 +40,11 @@ fetch_inferior_registers () registers_fetched (); - ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers); + ptrace (PTRACE_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); #ifdef FP0_REGNUM - ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); #endif bcopy (&inferior_registers, registers, 16 * 4); @@ -86,9 +88,11 @@ store_inferior_registers (regno) sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); #endif - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); + ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); #if FP0_REGNUM - ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); #endif } diff --git a/gdb/procfs.c b/gdb/procfs.c index aa4561a3e86..251ddb4786a 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -1007,7 +1007,7 @@ GLOBAL FUNCTION SYNOPSIS - int ptrace (int request, int pid, int arg3, int arg4) + int ptrace (int request, int pid, PTRACE_ARG3_TYPE arg3, int arg4) DESCRIPTION @@ -1022,7 +1022,7 @@ int ptrace (request, pid, arg3, arg4) int request; int pid; - int arg3; + PTRACE_ARG3_TYPE arg3; int arg4; { error ("internal error - there is a call to ptrace() somewhere"); diff --git a/gdb/pyr-tdep.c b/gdb/pyr-tdep.c index 7dc2f47b71d..69b84eb5213 100644 --- a/gdb/pyr-tdep.c +++ b/gdb/pyr-tdep.c @@ -37,11 +37,11 @@ pyr_print_registers(reg_buf, regnum) reg_names[regno+48], reg_buf[regno+48]); } usp = ptrace (3, inferior_pid, - ((char *)&u.u_pcb.pcb_usp) - - ((char *)&u), 0); + (PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_usp) - + ((char *)&u), 0); ksp = ptrace (3, inferior_pid, - ((char *)&u.u_pcb.pcb_ksp) - - ((char *)&u), 0); + (PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_ksp) - + ((char *)&u), 0); printf/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n", reg_names[CSP_REGNUM],reg_buf[CSP_REGNUM], reg_names[KSP_REGNUM], reg_buf[KSP_REGNUM], ksp, diff --git a/gdb/pyr-xdep.c b/gdb/pyr-xdep.c index 4517c0b2224..84b01565a88 100644 --- a/gdb/pyr-xdep.c +++ b/gdb/pyr-xdep.c @@ -46,7 +46,7 @@ fetch_inferior_registers (regno) registers_fetched (); for (regno = 0; regno < 64; regno++) { - reg_buf[regno] = ptrace (3, inferior_pid, regno, 0); + reg_buf[regno] = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0); #if defined(PYRAMID_CONTROL_FRAME_DEBUGGING) printf ("Fetching %s from inferior, got %0x\n", @@ -63,8 +63,8 @@ fetch_inferior_registers (regno) } /* that leaves regs 64, 65, and 66 */ datum = ptrace (3, inferior_pid, - ((char *)&u.u_pcb.pcb_csp) - - ((char *)&u), 0); + (PTRACE_ARG3_TYPE) (((char *)&u.u_pcb.pcb_csp) - + ((char *)&u)), 0); @@ -100,7 +100,8 @@ fetch_inferior_registers (regno) while (1) { register int inferior_saved_pc; - inferior_saved_pc = ptrace (1, inferior_pid, datum+((32+15)*4), 0); + inferior_saved_pc = ptrace (1, inferior_pid, + (PTRACE_ARG3_TYPE) (datum+((32+15)*4)), 0); if (inferior_saved_pc > 0) break; #if defined(PYRAMID_CONTROL_FRAME_DEBUGGING) printf("skipping kernel frame %08x, pc=%08x\n", datum, @@ -138,7 +139,8 @@ store_inferior_registers (regno) /*regaddr = register_addr (regno, offset);*/ regaddr = regno; errno = 0; - ptrace (6, inferior_pid, regaddr, read_register (regno)); + ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + read_register (regno)); if (errno != 0) { sprintf (buf, "writing register number %d", regno); @@ -153,7 +155,8 @@ store_inferior_registers (regno) /*regaddr = register_addr (regno, offset);*/ regaddr = regno; errno = 0; - ptrace (6, inferior_pid, regaddr, read_register (regno)); + ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + read_register (regno)); if (errno != 0) { sprintf (buf, "writing all regs, number %d", regno); diff --git a/gdb/remote.c b/gdb/remote.c index 681a3145305..f38a02e85e0 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -174,7 +174,8 @@ int remote_desc = -1; /* Called when SIGALRM signal sent due to alarm() timeout. */ #ifndef HAVE_TERMIO void -remote_timer () +remote_timer (signo) + int signo; { if (kiodebug) printf ("remote_timer called\n"); @@ -391,7 +392,8 @@ remote_resume (step, siggnal) /* Send ^C to target to halt it. Target will respond, and send us a packet. */ -void remote_interrupt() +void remote_interrupt(signo) + int signo; { if (kiodebug) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 1a26ab2e3ac..290fb7747e7 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -143,7 +143,7 @@ int signal; } one_stepped = 1; - ptrace (PT_CONTINUE, inferior_pid, 1, signal, 0); + ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); } else { diff --git a/gdb/rs6000-xdep.c b/gdb/rs6000-xdep.c index 516331da20e..b4a1851e390 100644 --- a/gdb/rs6000-xdep.c +++ b/gdb/rs6000-xdep.c @@ -75,18 +75,20 @@ fetch_inferior_registers (regno) for (ii=0; ii < 32; ++ii) *(int*)®isters[REGISTER_BYTE (ii)] = - ptrace (PT_READ_GPR, inferior_pid, ii, 0, 0); + ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii, 0, 0); /* read general purpose floating point registers. */ for (ii=0; ii < 32; ++ii) ptrace (PT_READ_FPR, inferior_pid, - (int*)®isters [REGISTER_BYTE (FP0_REGNUM+ii)], FPR0+ii, 0); + (PTRACE_ARG3_TYPE) ®isters [REGISTER_BYTE (FP0_REGNUM+ii)], + FPR0+ii, 0); /* read special registers. */ for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii) *(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)] = - ptrace (PT_READ_GPR, inferior_pid, special_regs[ii], 0, 0); + ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) special_regs[ii], + 0, 0); registers_fetched (); return; @@ -96,16 +98,17 @@ fetch_inferior_registers (regno) else if (regno < FP0_REGNUM) { /* a GPR */ *(int*)®isters[REGISTER_BYTE (regno)] = - ptrace (PT_READ_GPR, inferior_pid, regno, 0, 0); + ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0, 0); } else if (regno <= FPLAST_REGNUM) { /* a FPR */ ptrace (PT_READ_FPR, inferior_pid, - (int*)®isters [REGISTER_BYTE (regno)], (regno-FP0_REGNUM+FPR0), 0); + (PTRACE_ARG3_TYPE) ®isters [REGISTER_BYTE (regno)], + (regno-FP0_REGNUM+FPR0), 0); } else if (regno <= LAST_SP_REGNUM) { /* a special register */ *(int*)®isters[REGISTER_BYTE (regno)] = ptrace (PT_READ_GPR, inferior_pid, - special_regs[regno-FIRST_SP_REGNUM], 0, 0); + (PTRACE_ARG3_TYPE) special_regs[regno-FIRST_SP_REGNUM], 0, 0); } else fprintf (stderr, "gdb error: register no %d not implemented.\n", regno); @@ -137,7 +140,7 @@ store_inferior_registers (regno) /* write general purpose registers first! */ for ( ii=GPR0; ii<=GPR31; ++ii) { - ptrace (PT_WRITE_GPR, inferior_pid, ii, + ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii, *(int*)®isters[REGISTER_BYTE (ii)], 0); if ( errno ) { perror ("ptrace write_gpr"); errno = 0; @@ -147,7 +150,8 @@ store_inferior_registers (regno) /* write floating point registers now. */ for ( ii=0; ii < 32; ++ii) { ptrace (PT_WRITE_FPR, inferior_pid, - (int*)®isters[REGISTER_BYTE (FP0_REGNUM+ii)], FPR0+ii, 0); + (PTRACE_ARG3_TYPE) ®isters[REGISTER_BYTE (FP0_REGNUM+ii)], + FPR0+ii, 0); if ( errno ) { perror ("ptrace write_fpr"); errno = 0; } @@ -155,8 +159,9 @@ store_inferior_registers (regno) /* write special registers. */ for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii) { - ptrace (PT_WRITE_GPR, inferior_pid, special_regs[ii], - *(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)], 0); + ptrace (PT_WRITE_GPR, inferior_pid, + (PTRACE_ARG3_TYPE) special_regs[ii], + *(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)], 0); if ( errno ) { perror ("ptrace write_gpr"); errno = 0; } @@ -167,19 +172,21 @@ store_inferior_registers (regno) else if (regno < FP0_REGNUM) { /* a GPR */ - ptrace (PT_WRITE_GPR, inferior_pid, regno, + ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno, *(int*)®isters[REGISTER_BYTE (regno)], 0); } else if (regno <= FPLAST_REGNUM) { /* a FPR */ ptrace (PT_WRITE_FPR, inferior_pid, - (int*)®isters[REGISTER_BYTE (regno)], regno-FP0_REGNUM+FPR0, 0); + (PTRACE_ARG3_TYPE) ®isters[REGISTER_BYTE (regno)], + regno-FP0_REGNUM+FPR0, 0); } else if (regno <= LAST_SP_REGNUM) { /* a special register */ - ptrace (PT_WRITE_GPR, inferior_pid, special_regs [regno-FIRST_SP_REGNUM], - *(int*)®isters[REGISTER_BYTE (regno)], 0); + ptrace (PT_WRITE_GPR, inferior_pid, + (PTRACE_ARG3_TYPE) special_regs [regno-FIRST_SP_REGNUM], + *(int*)®isters[REGISTER_BYTE (regno)], 0); } else @@ -382,7 +389,8 @@ unsigned int pid; usleep (36000); errno = 0; - ptrace(PT_LDINFO, pid, ldi, MAX_LOAD_SEGS * sizeof(*ldi), ldi); + ptrace(PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi, + MAX_LOAD_SEGS * sizeof(*ldi), ldi); if (errno) { perror_with_name ("ptrace ldinfo"); return 0; @@ -497,7 +505,7 @@ exec_one_dummy_insn () target_insert_breakpoint (DUMMY_INSN_ADDR, &shadow); errno = 0; - ptrace (PT_CONTINUE, inferior_pid, DUMMY_INSN_ADDR, 0, 0); + ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) DUMMY_INSN_ADDR, 0, 0); if (errno) perror ("pt_continue"); diff --git a/gdb/ser-termios.c b/gdb/ser-termios.c index d9376241a2b..3bf8f172bb1 100644 --- a/gdb/ser-termios.c +++ b/gdb/ser-termios.c @@ -197,12 +197,12 @@ DEFUN(serial_write,(str, len), CONST char *str AND int len) { - write (desc, str, len); + return (write (desc, str, len)); } int DEFUN_VOID(serial_close) { -close(desc); + return (close(desc)); } diff --git a/gdb/sparc-xdep.c b/gdb/sparc-xdep.c index 01ae20410f7..2cc150e19e8 100644 --- a/gdb/sparc-xdep.c +++ b/gdb/sparc-xdep.c @@ -71,8 +71,9 @@ fetch_inferior_registers (regno) || regno >= Y_REGNUM || (!register_valid[SP_REGNUM] && regno < I7_REGNUM)) { - if (0 != ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers)) - perror("ptrace_getregs"); + if (0 != ptrace (PTRACE_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0)) + perror("ptrace_getregs"); registers[REGISTER_BYTE (0)] = 0; bcopy (&inferior_registers.r_g1, ®isters[REGISTER_BYTE (1)], 15 * REGISTER_RAW_SIZE (G0_REGNUM)); @@ -98,7 +99,9 @@ fetch_inferior_registers (regno) /* Floating point registers */ if (regno == -1 || (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31)) { - if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers)) + if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers, + 0)) perror("ptrace_getfpregs"); bcopy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], sizeof inferior_fp_registers.fpu_fr); @@ -218,7 +221,8 @@ store_inferior_registers (regno) inferior_registers.r_y = *(int *)®isters[REGISTER_BYTE (Y_REGNUM)]; - if (0 != ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers)) + if (0 != ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0)) perror("ptrace_setregs"); } @@ -234,7 +238,8 @@ store_inferior_registers (regno) sizeof (FPU_FSR_TYPE)); ****/ if (0 != - ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers)) + ptrace (PTRACE_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0)) perror("ptrace_setfpregs"); } } diff --git a/gdb/sun3-xdep.c b/gdb/sun3-xdep.c index f6db72da0ec..03cc3ae4913 100644 --- a/gdb/sun3-xdep.c +++ b/gdb/sun3-xdep.c @@ -41,9 +41,11 @@ fetch_inferior_registers (regno) registers_fetched (); - ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers); + ptrace (PTRACE_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); #ifdef FP0_REGNUM - ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); #endif bcopy (&inferior_registers, registers, 16 * 4); @@ -88,9 +90,11 @@ store_inferior_registers (regno) sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); #endif - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); + ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); #if FP0_REGNUM - ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); #endif } diff --git a/gdb/sun386-xdep.c b/gdb/sun386-xdep.c index e24111400ec..7da605b7f74 100644 --- a/gdb/sun386-xdep.c +++ b/gdb/sun386-xdep.c @@ -51,8 +51,10 @@ fetch_inferior_registers (regno) registers_fetched (); - ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers); - ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); + ptrace (PTRACE_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); bcopy (&inferior_registers, registers, sizeof inferior_registers); @@ -89,20 +91,27 @@ store_inferior_registers (regno) instruction that moves eax into ebp gets single-stepped. */ { int stack = inferior_registers.r_reg[SP_REGNUM]; - int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, stack); + int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, + (PTRACE_ARG3_TYPE) stack); int reg = inferior_registers.r_reg[EAX]; inferior_registers.r_reg[EAX] = inferior_registers.r_reg[FP_REGNUM]; - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); - ptrace (PTRACE_POKEDATA, inferior_pid, stack, 0xc589); - ptrace (PTRACE_SINGLESTEP, inferior_pid, stack, 0); + ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); + ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, + 0xc589); + ptrace (PTRACE_SINGLESTEP, inferior_pid, (PTRACE_ARG3_TYPE) stack, + 0); wait (0); - ptrace (PTRACE_POKEDATA, inferior_pid, stack, stuff); + ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, + stuff); inferior_registers.r_reg[EAX] = reg; } #endif - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); - ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers); + ptrace (PTRACE_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers); + ptrace (PTRACE_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_fp_registers); } /* Machine-dependent code which would otherwise be in core.c */ diff --git a/gdb/symm-xdep.c b/gdb/symm-xdep.c index 65cab3494c9..4ce743a521e 100644 --- a/gdb/symm-xdep.c +++ b/gdb/symm-xdep.c @@ -70,7 +70,7 @@ int regno; else { reg_tmp = *(int *)®isters[REGISTER_BYTE(regno)]; - ptrace(XPT_RREGS, inferior_pid, ®s, 0); + ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); switch (regno) { case 0: @@ -106,7 +106,7 @@ int regno; } } #endif /* 0 */ - ptrace(XPT_WREGS, inferior_pid, ®s, 0); + ptrace(XPT_WREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); } void @@ -119,7 +119,7 @@ fetch_inferior_registers (regno) registers_fetched (); - ptrace(XPT_RREGS, inferior_pid, ®s, 0); + ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0); *(int *)®isters[REGISTER_BYTE(0)] = regs.pr_eax; *(int *)®isters[REGISTER_BYTE(5)] = regs.pr_ebx; *(int *)®isters[REGISTER_BYTE(2)] = regs.pr_ecx; @@ -427,7 +427,7 @@ i386_float_info () extern int corechan; if (have_inferior_p()) { - call_ptrace(XPT_RREGS, inferior_pid, ®set, 0); + call_ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®set, 0); } else { if (lseek (corechan, 0, 0) < 0) { perror ("seek on core file"); diff --git a/gdb/tm-rs6000.h b/gdb/tm-rs6000.h index dd27da6fa29..43eb2d3ebb1 100644 --- a/gdb/tm-rs6000.h +++ b/gdb/tm-rs6000.h @@ -25,7 +25,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define AIX_BUGGY_PTRACE_CONTINUE \ { \ - int ret = ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal, 0); \ + int ret = ptrace (PT_CONTINUE, inferior_pid, \ + (PTRACE_ARG3_TYPE) 1, signal, 0); \ if (errno) { \ /* printf ("ret: %d, errno: %d, signal: %d\n", ret, errno, signal); */ \ errno = 0; } \ diff --git a/gdb/ultra3-xdep.c b/gdb/ultra3-xdep.c index 82ad2867b42..3fff182c506 100644 --- a/gdb/ultra3-xdep.c +++ b/gdb/ultra3-xdep.c @@ -72,7 +72,8 @@ fetch_register (regno) supply_register (regno, &val); } else { errno = 0; - val = ptrace (PT_READ_U, inferior_pid, (int*)register_addr(regno,0), 0); + val = ptrace (PT_READ_U, inferior_pid, + (PTRACE_ARG3_TYPE) register_addr(regno,0), 0); if (errno != 0) { sprintf(buf,"reading register %s (#%d)",reg_names[regno],regno); perror_with_name (buf); @@ -103,8 +104,9 @@ fetch_inferior_registers (regno) /* Global Registers */ #ifdef ULTRA3 errno = 0; - ptrace (PT_READ_STRUCT, inferior_pid, (int*)register_addr(GR96_REGNUM,0), - (int)&pt_struct.pt_gr[0], 32*4); + ptrace (PT_READ_STRUCT, inferior_pid, + (PTRACE_ARG3_TYPE) register_addr(GR96_REGNUM,0), + (int)&pt_struct.pt_gr[0], 32*4); if (errno != 0) { perror_with_name ("reading global registers"); ret_val = -1; @@ -119,8 +121,9 @@ fetch_inferior_registers (regno) /* Local Registers */ #ifdef ULTRA3 errno = 0; - ptrace (PT_READ_STRUCT, inferior_pid, (int*)register_addr(LR0_REGNUM,0), - (int)&pt_struct.pt_lr[0], 128*4); + ptrace (PT_READ_STRUCT, inferior_pid, + (PTRACE_ARG3_TYPE) register_addr(LR0_REGNUM,0), + (int)&pt_struct.pt_lr[0], 128*4); if (errno != 0) { perror_with_name ("reading local registers"); ret_val = -1; @@ -168,7 +171,8 @@ store_inferior_registers (regno) return; regaddr = register_addr (regno, 0); errno = 0; - ptrace (PT_WRITE_U, inferior_pid,(int*)regaddr,read_register(regno)); + ptrace (PT_WRITE_U, inferior_pid, + (PTRACE_ARG3_TYPE) regaddr, read_register(regno)); if (errno != 0) { sprintf (buf, "writing register %s (#%d)", reg_names[regno],regno); @@ -184,8 +188,9 @@ store_inferior_registers (regno) for (regno = LR0_REGNUM; regno < LR0_REGNUM+128; regno++) pt_struct.pt_gr[regno] = read_register(regno); errno = 0; - ptrace (PT_WRITE_STRUCT, inferior_pid, (int*)register_addr(GR1_REGNUM,0), - (int)&pt_struct.pt_gr1,(1*32*128)*4); + ptrace (PT_WRITE_STRUCT, inferior_pid, + (PTRACE_ARG3_TYPE) register_addr(GR1_REGNUM,0), + (int)&pt_struct.pt_gr1,(1*32*128)*4); if (errno != 0) { sprintf (buf, "writing all local/global registers"); @@ -202,8 +207,9 @@ store_inferior_registers (regno) pt_struct.pt_bp = read_register(BP_REGNUM); pt_struct.pt_fc = read_register(FC_REGNUM); errno = 0; - ptrace (PT_WRITE_STRUCT, inferior_pid, (int*)register_addr(CPS_REGNUM,0), - (int)&pt_struct.pt_psr,(10)*4); + ptrace (PT_WRITE_STRUCT, inferior_pid, + (PTRACE_ARG3_TYPE) register_addr(CPS_REGNUM,0), + (int)&pt_struct.pt_psr,(10)*4); if (errno != 0) { sprintf (buf, "writing all special registers"); diff --git a/gdb/xm-sun4os4.h b/gdb/xm-sun4os4.h index b20a602eba1..4a6133c544b 100644 --- a/gdb/xm-sun4os4.h +++ b/gdb/xm-sun4os4.h @@ -48,3 +48,6 @@ extern char* malloc PARAMS (()); extern char* realloc PARAMS (()); extern int free PARAMS (()); +/* SunOS 4.x uses nonstandard "char *" as type of third argument to ptrace() */ + +#define PTRACE_ARG3_TYPE char*