Remove parameter sysret from linux_target_ops.get_syscall_trapinfo

When I implement linux_target_ops.get_syscall_trapinfo for aarch64 and arm,
I find the second parameter sysret isn't used at all.  In RSP, we don't
need syscall return value either, because GDB can figure out the return
value from registers content got by 'g' packet.

This patch is to remove them.

gdb/gdbserver:

2016-06-28  Yao Qi  <yao.qi@linaro.org>

	* linux-low.c (get_syscall_trapinfo): Remove parameter sysret.
	Callers updated.
	* linux-low.h (struct linux_target_ops) <get_syscall_trapinfo>:
	Remove parameter sysno.
	* linux-x86-low.c (x86_get_syscall_trapinfo): Remove parameter
	sysret.
This commit is contained in:
Yao Qi 2016-06-28 12:02:35 +01:00
parent a31d2f068f
commit 4cc32bec04
4 changed files with 22 additions and 28 deletions

View file

@ -1,3 +1,12 @@
2016-06-28 Yao Qi <yao.qi@linaro.org>
* linux-low.c (get_syscall_trapinfo): Remove parameter sysret.
Callers updated.
* linux-low.h (struct linux_target_ops) <get_syscall_trapinfo>:
Remove parameter sysno.
* linux-x86-low.c (x86_get_syscall_trapinfo): Remove parameter
sysret.
2016-06-21 Andreas Arnez <arnez@linux.vnet.ibm.com> 2016-06-21 Andreas Arnez <arnez@linux.vnet.ibm.com>
* linux-s390-low.c (s390_emit_eq_goto): Mark function static. * linux-s390-low.c (s390_emit_eq_goto): Mark function static.

View file

@ -758,11 +758,10 @@ get_pc (struct lwp_info *lwp)
} }
/* This function should only be called if LWP got a SYSCALL_SIGTRAP. /* This function should only be called if LWP got a SYSCALL_SIGTRAP.
Fill *SYSNO with the syscall nr trapped. Fill *SYSRET with the Fill *SYSNO with the syscall nr trapped. */
return code. */
static void static void
get_syscall_trapinfo (struct lwp_info *lwp, int *sysno, int *sysret) get_syscall_trapinfo (struct lwp_info *lwp, int *sysno)
{ {
struct thread_info *saved_thread; struct thread_info *saved_thread;
struct regcache *regcache; struct regcache *regcache;
@ -770,9 +769,8 @@ get_syscall_trapinfo (struct lwp_info *lwp, int *sysno, int *sysret)
if (the_low_target.get_syscall_trapinfo == NULL) if (the_low_target.get_syscall_trapinfo == NULL)
{ {
/* If we cannot get the syscall trapinfo, report an unknown /* If we cannot get the syscall trapinfo, report an unknown
system call number and -ENOSYS return value. */ system call number. */
*sysno = UNKNOWN_SYSCALL; *sysno = UNKNOWN_SYSCALL;
*sysret = -ENOSYS;
return; return;
} }
@ -780,13 +778,10 @@ get_syscall_trapinfo (struct lwp_info *lwp, int *sysno, int *sysret)
current_thread = get_lwp_thread (lwp); current_thread = get_lwp_thread (lwp);
regcache = get_thread_regcache (current_thread, 1); regcache = get_thread_regcache (current_thread, 1);
(*the_low_target.get_syscall_trapinfo) (regcache, sysno, sysret); (*the_low_target.get_syscall_trapinfo) (regcache, sysno);
if (debug_threads) if (debug_threads)
{ debug_printf ("get_syscall_trapinfo sysno %d\n", *sysno);
debug_printf ("get_syscall_trapinfo sysno %d sysret %d\n",
*sysno, *sysret);
}
current_thread = saved_thread; current_thread = saved_thread;
} }
@ -3116,7 +3111,7 @@ static int
gdb_catch_this_syscall_p (struct lwp_info *event_child) gdb_catch_this_syscall_p (struct lwp_info *event_child)
{ {
int i, iter; int i, iter;
int sysno, sysret; int sysno;
struct thread_info *thread = get_lwp_thread (event_child); struct thread_info *thread = get_lwp_thread (event_child);
struct process_info *proc = get_thread_process (thread); struct process_info *proc = get_thread_process (thread);
@ -3126,7 +3121,7 @@ gdb_catch_this_syscall_p (struct lwp_info *event_child)
if (VEC_index (int, proc->syscalls_to_catch, 0) == ANY_SYSCALL) if (VEC_index (int, proc->syscalls_to_catch, 0) == ANY_SYSCALL)
return 1; return 1;
get_syscall_trapinfo (event_child, &sysno, &sysret); get_syscall_trapinfo (event_child, &sysno);
for (i = 0; for (i = 0;
VEC_iterate (int, proc->syscalls_to_catch, i, iter); VEC_iterate (int, proc->syscalls_to_catch, i, iter);
i++) i++)
@ -3734,10 +3729,8 @@ linux_wait_1 (ptid_t ptid,
if (WSTOPSIG (w) == SYSCALL_SIGTRAP) if (WSTOPSIG (w) == SYSCALL_SIGTRAP)
{ {
int sysret;
get_syscall_trapinfo (event_child, get_syscall_trapinfo (event_child,
&ourstatus->value.syscall_number, &sysret); &ourstatus->value.syscall_number);
ourstatus->kind = event_child->syscall_state; ourstatus->kind = event_child->syscall_state;
} }
else if (current_thread->last_resume_kind == resume_stop else if (current_thread->last_resume_kind == resume_stop

View file

@ -241,11 +241,9 @@ struct linux_target_ops
/* See target.h. */ /* See target.h. */
int (*supports_hardware_single_step) (void); int (*supports_hardware_single_step) (void);
/* Fill *SYSNO with the syscall nr trapped. Fill *SYSRET with the /* Fill *SYSNO with the syscall nr trapped. Only to be called when
return code. Only to be called when inferior is stopped inferior is stopped due to SYSCALL_SIGTRAP. */
due to SYSCALL_SIGTRAP. */ void (*get_syscall_trapinfo) (struct regcache *regcache, int *sysno);
void (*get_syscall_trapinfo) (struct regcache *regcache,
int *sysno, int *sysret);
/* See target.h. */ /* See target.h. */
int (*get_ipa_tdesc_idx) (void); int (*get_ipa_tdesc_idx) (void);

View file

@ -991,25 +991,19 @@ x86_arch_setup (void)
code. This should only be called if LWP got a SYSCALL_SIGTRAP. */ code. This should only be called if LWP got a SYSCALL_SIGTRAP. */
static void static void
x86_get_syscall_trapinfo (struct regcache *regcache, int *sysno, int *sysret) x86_get_syscall_trapinfo (struct regcache *regcache, int *sysno)
{ {
int use_64bit = register_size (regcache->tdesc, 0) == 8; int use_64bit = register_size (regcache->tdesc, 0) == 8;
if (use_64bit) if (use_64bit)
{ {
long l_sysno; long l_sysno;
long l_sysret;
collect_register_by_name (regcache, "orig_rax", &l_sysno); collect_register_by_name (regcache, "orig_rax", &l_sysno);
collect_register_by_name (regcache, "rax", &l_sysret);
*sysno = (int) l_sysno; *sysno = (int) l_sysno;
*sysret = (int) l_sysret;
} }
else else
{ collect_register_by_name (regcache, "orig_eax", sysno);
collect_register_by_name (regcache, "orig_eax", sysno);
collect_register_by_name (regcache, "eax", sysret);
}
} }
static int static int