From patchwork Fri Jun 17 10:16:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 13159 Received: (qmail 51202 invoked by alias); 17 Jun 2016 10:16:59 -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 51118 invoked by uid 89); 17 Jun 2016 10:16:59 -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=sk:arm_get, Hx-languages-length:1645 X-HELO: mail-pf0-f196.google.com Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 17 Jun 2016 10:16:42 +0000 Received: by mail-pf0-f196.google.com with SMTP id 66so5994421pfy.1 for ; Fri, 17 Jun 2016 03:16:41 -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=Jm8mQbAUsifTFrrO9I+ew7PpC3cQwHW0+ShcZ3WkicQ=; b=YlTAodAPUZ8yeCavA8xdx0NeJ/cSxwsSJyY0I1yDRiUXkWhC/XUJXk1gZH9P6XzXtR 9hKmJfiV0pIg2VcNj1FqMNqT81ZjwUss9vUpZx1e8QWY2CIk3qovkqbZzeydqTipn9er zqPOsHq7RkSexbiIqY5+VEvaUv+30zgs/PihgI6fkeYyo+Or/tQ4nQ9BGOml7ZmbCbDj j+c7++dLHlpDDhgGSLtztVrg+y1mewHhFMSWNLgYhWmD+Bc09y8IHKDRf56sdKtlBm5p 6J+3H8Oip5F/M1bdW4jY0QT82ZD/cfsf10hQvsFNXtHiMC5FSbEea0qtBE04dAB3lsLM 9QjA== X-Gm-Message-State: ALyK8tJLLHhzWDiPiUxJRhUHmNKzjnhNOSdUhpWjSyy32KW8lGts5PE1xNYJ60cx/9IEyQ== X-Received: by 10.98.10.148 with SMTP id 20mr1653035pfk.154.1466158600226; Fri, 17 Jun 2016 03:16:40 -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.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 03:16:39 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 4/4] Implement get_syscall_trapinfo for arm-linux Date: Fri, 17 Jun 2016 11:16:25 +0100 Message-Id: <1466158585-21833-5-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 gdb/gdbserver: 2016-06-16 Yao Qi * linux-arm-low.c (arm_get_syscall_trapinfo): New function. (the_low_target): Install arm_get_syscall_trapinfo. --- gdb/gdbserver/linux-arm-low.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 2ffda87..67d1bbf 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -951,6 +951,36 @@ arm_supports_hardware_single_step (void) return 0; } +/* Implementation of linux_target_ops method "get_syscall_trapinfo". */ + +static void +arm_get_syscall_trapinfo (struct regcache *regcache, int *sysno) +{ + if (arm_is_thumb_mode ()) + collect_register_by_name (regcache, "r7", sysno); + else + { + unsigned long pc; + unsigned long insn; + unsigned long svc_operand; + + collect_register_by_name (regcache, "pc", &pc); + (*the_target->read_memory) (pc - 4, (unsigned char *) &insn, 4); + svc_operand = (0x00ffffff & insn); + + if (svc_operand) + { + /* OABI */ + *sysno = svc_operand - 0x900000; + } + else + { + /* EABI */ + collect_register_by_name (regcache, "r7", sysno); + } + } +} + /* Register sets without using PTRACE_GETREGSET. */ static struct regset_info arm_regsets[] = { @@ -1031,7 +1061,8 @@ struct linux_target_ops the_low_target = { NULL, /* get_min_fast_tracepoint_insn_len */ NULL, /* supports_range_stepping */ arm_breakpoint_kind_from_current_state, - arm_supports_hardware_single_step + arm_supports_hardware_single_step, + arm_get_syscall_trapinfo, }; void