Fix s390 GNU/Linux build after enum __ptrace_request changes

The buildbot noticed that the enum __ptrace_request series broke the
s390 GNU/Linux build:

../../binutils-gdb/gdb/s390-linux-nat.c: In function 'fetch_regs':
../../binutils-gdb/gdb/s390-linux-nat.c:226:54: error: macro "ptrace" requires 4 arguments, but only 3 given
   if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
                                                      ^
../../binutils-gdb/gdb/s390-linux-nat.c: In function 'store_regs':
../../binutils-gdb/gdb/s390-linux-nat.c:243:54: error: macro "ptrace" requires 4 arguments, but only 3 given
   if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
                                                      ^

Fix this the same way it's handled everywhere else -- just pass 0 as
forth argument, which also handles non-varargs ptrace prototypes in
non-glibc libcs, e.g., Bionic (if it ever gets a s390 port...).

gdb/ChangeLog:
2015-07-24  Pedro Alves  <palves@redhat.com>

	* s390-linux-nat.c (fetch_regs, store_regs, fetch_fpregs)
	(s390_stopped_by_watchpoint, s390_prepare_to_resume): Pass 0 as
	forth argument to ptrace PTRACE_PEEKUSR_AREA/PTRACE_POKEUSR_AREA.
This commit is contained in:
Pedro Alves 2015-07-24 20:29:53 +01:00
parent 5068630ad3
commit 2b4cab8654
2 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2015-07-24 Pedro Alves <palves@redhat.com>
* s390-linux-nat.c (fetch_regs, store_regs, fetch_fpregs)
(s390_stopped_by_watchpoint, s390_prepare_to_resume): Pass 0 as
forth argument to ptrace PTRACE_PEEKUSR_AREA/PTRACE_POKEUSR_AREA.
2015-07-24 Pedro Alves <palves@redhat.com>
PR gdb/18717

View File

@ -223,7 +223,7 @@ fetch_regs (struct regcache *regcache, int tid)
parea.len = sizeof (regs);
parea.process_addr = (addr_t) &regs;
parea.kernel_addr = offsetof (struct user_regs_struct, psw);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
perror_with_name (_("Couldn't get registers"));
supply_gregset (regcache, (const gregset_t *) &regs);
@ -240,12 +240,12 @@ store_regs (const struct regcache *regcache, int tid, int regnum)
parea.len = sizeof (regs);
parea.process_addr = (addr_t) &regs;
parea.kernel_addr = offsetof (struct user_regs_struct, psw);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
perror_with_name (_("Couldn't get registers"));
fill_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea, 0) < 0)
perror_with_name (_("Couldn't write registers"));
}
@ -260,7 +260,7 @@ fetch_fpregs (struct regcache *regcache, int tid)
parea.len = sizeof (fpregs);
parea.process_addr = (addr_t) &fpregs;
parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
perror_with_name (_("Couldn't get floating point status"));
supply_fpregset (regcache, (const fpregset_t *) &fpregs);
@ -277,12 +277,12 @@ store_fpregs (const struct regcache *regcache, int tid, int regnum)
parea.len = sizeof (fpregs);
parea.process_addr = (addr_t) &fpregs;
parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
perror_with_name (_("Couldn't get floating point status"));
fill_fpregset (regcache, &fpregs, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea, 0) < 0)
perror_with_name (_("Couldn't write floating point status"));
}
@ -459,7 +459,7 @@ s390_stopped_by_watchpoint (struct target_ops *ops)
parea.len = sizeof (per_lowcore);
parea.process_addr = (addr_t) & per_lowcore;
parea.kernel_addr = offsetof (struct user_regs_struct, per_info.lowcore);
if (ptrace (PTRACE_PEEKUSR_AREA, s390_inferior_tid (), &parea) < 0)
if (ptrace (PTRACE_PEEKUSR_AREA, s390_inferior_tid (), &parea, 0) < 0)
perror_with_name (_("Couldn't retrieve watchpoint status"));
result = (per_lowcore.perc_storage_alteration == 1
@ -469,7 +469,7 @@ s390_stopped_by_watchpoint (struct target_ops *ops)
{
/* Do not report this watchpoint again. */
memset (&per_lowcore, 0, sizeof (per_lowcore));
if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea) < 0)
if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea, 0) < 0)
perror_with_name (_("Couldn't clear watchpoint status"));
}
@ -508,7 +508,7 @@ s390_prepare_to_resume (struct lwp_info *lp)
parea.len = sizeof (per_info);
parea.process_addr = (addr_t) & per_info;
parea.kernel_addr = offsetof (struct user_regs_struct, per_info);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea) < 0)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea, 0) < 0)
perror_with_name (_("Couldn't retrieve watchpoint status"));
if (watch_base)
@ -524,7 +524,7 @@ s390_prepare_to_resume (struct lwp_info *lp)
per_info.starting_addr = watch_lo_addr;
per_info.ending_addr = watch_hi_addr;
if (ptrace (PTRACE_POKEUSR_AREA, tid, &parea) < 0)
if (ptrace (PTRACE_POKEUSR_AREA, tid, &parea, 0) < 0)
perror_with_name (_("Couldn't modify watchpoint status"));
}