From patchwork Fri Jun 17 10:16:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 13156 Received: (qmail 49791 invoked by alias); 17 Jun 2016 10:16:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 49780 invoked by uid 89); 17 Jun 2016 10:16:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:4941, trapped, 7698 X-HELO: mail-pa0-f66.google.com Received: from mail-pa0-f66.google.com (HELO mail-pa0-f66.google.com) (209.85.220.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 17 Jun 2016 10:16:39 +0000 Received: by mail-pa0-f66.google.com with SMTP id us13so5594368pab.1 for ; Fri, 17 Jun 2016 03:16:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=ghHhi6AQV7416lHoCko9QNXAHgYx9V+xSfw73CCduI4=; b=l0+04eEtvuHxEbBw7F75TqmUF8ZipR7GAjJcxGP/70Cb05Rd+BEFQvA7fFZKS+DWtJ xsNBIR1cg72nCrZrZZIOsc9dYQs+mP3Kt6jFbF25UdLgl8EdGxmXFP9YRTUh1HYbq1sR XkHyRWiEm2SRaqcbcv0orJ7FzonLDbzegOuihpGFbSUVSp+tgHIZYNJVJB8k86HG3tyN 4D45PY/m7gZYZOJML1HvsCQkEAJZm/hP5osQqMAepgrVm1HSNvLDSQ6ApcCqtVtj9c5Y lIr6Qea3PYQAh8VB/6lXzFNlNbR6jLId9uEl1JG6N7wUEar23q/oC5zuIx4Y5fZPWnDW qk0g== X-Gm-Message-State: ALyK8tIigJOzFeKteKwPqZ1oGOQu7TccmMKCCVvuthd7GWsvzDm3Pa+aRem02kID674s7w== X-Received: by 10.66.132.45 with SMTP id or13mr1594816pab.79.1466158597891; Fri, 17 Jun 2016 03:16:37 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc113.osuosl.org. [140.211.9.71]) by smtp.gmail.com with ESMTPSA id z88sm39535357pfa.59.2016.06.17.03.16.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 03:16:37 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 2/4] Remove parameter sysret from linux_target_ops.get_syscall_trapinfo Date: Fri, 17 Jun 2016 11:16:23 +0100 Message-Id: <1466158585-21833-3-git-send-email-yao.qi@linaro.org> In-Reply-To: <1466158585-21833-1-git-send-email-yao.qi@linaro.org> References: <1466158585-21833-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes 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-16 Yao Qi * linux-low.c (get_syscall_trapinfo): Remove parameter sysret. Callers updated. * linux-low.h (struct linux_target_ops) : Remove parameter sysno. * linux-x86-low.c (x86_get_syscall_trapinfo): Remove parameter sysret. --- gdb/gdbserver/linux-low.c | 23 ++++++++--------------- gdb/gdbserver/linux-low.h | 8 +++----- gdb/gdbserver/linux-x86-low.c | 10 ++-------- 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index dd92e78..0f4bb87 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -758,11 +758,10 @@ get_pc (struct lwp_info *lwp) } /* This function should only be called if LWP got a SYSCALL_SIGTRAP. - Fill *SYSNO with the syscall nr trapped. Fill *SYSRET with the - return code. */ + Fill *SYSNO with the syscall nr trapped. */ 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 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 we cannot get the syscall trapinfo, report an unknown - system call number and -ENOSYS return value. */ + system call number. */ *sysno = UNKNOWN_SYSCALL; - *sysret = -ENOSYS; return; } @@ -780,13 +778,10 @@ get_syscall_trapinfo (struct lwp_info *lwp, int *sysno, int *sysret) current_thread = get_lwp_thread (lwp); 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) - { - debug_printf ("get_syscall_trapinfo sysno %d sysret %d\n", - *sysno, *sysret); - } + debug_printf ("get_syscall_trapinfo sysno %d\n", *sysno); current_thread = saved_thread; } @@ -3116,7 +3111,7 @@ static int gdb_catch_this_syscall_p (struct lwp_info *event_child) { int i, iter; - int sysno, sysret; + int sysno; struct thread_info *thread = get_lwp_thread (event_child); 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) return 1; - get_syscall_trapinfo (event_child, &sysno, &sysret); + get_syscall_trapinfo (event_child, &sysno); for (i = 0; VEC_iterate (int, proc->syscalls_to_catch, i, iter); i++) @@ -3734,10 +3729,8 @@ linux_wait_1 (ptid_t ptid, if (WSTOPSIG (w) == SYSCALL_SIGTRAP) { - int sysret; - get_syscall_trapinfo (event_child, - &ourstatus->value.syscall_number, &sysret); + &ourstatus->value.syscall_number); ourstatus->kind = event_child->syscall_state; } else if (current_thread->last_resume_kind == resume_stop diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index 6e7ddbd..5057e66 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -241,11 +241,9 @@ struct linux_target_ops /* See target.h. */ int (*supports_hardware_single_step) (void); - /* Fill *SYSNO with the syscall nr trapped. Fill *SYSRET with the - return code. Only to be called when inferior is stopped - due to SYSCALL_SIGTRAP. */ - void (*get_syscall_trapinfo) (struct regcache *regcache, - int *sysno, int *sysret); + /* Fill *SYSNO with the syscall nr trapped. Only to be called when + inferior is stopped due to SYSCALL_SIGTRAP. */ + void (*get_syscall_trapinfo) (struct regcache *regcache, int *sysno); /* See target.h. */ int (*get_ipa_tdesc_idx) (void); diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 2535959..5080dec 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -991,25 +991,19 @@ x86_arch_setup (void) code. This should only be called if LWP got a SYSCALL_SIGTRAP. */ 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; if (use_64bit) { long l_sysno; - long l_sysret; collect_register_by_name (regcache, "orig_rax", &l_sysno); - collect_register_by_name (regcache, "rax", &l_sysret); *sysno = (int) l_sysno; - *sysret = (int) l_sysret; } else - { - collect_register_by_name (regcache, "orig_eax", sysno); - collect_register_by_name (regcache, "eax", sysret); - } + collect_register_by_name (regcache, "orig_eax", sysno); } static int