From patchwork Wed Oct 14 11:14:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: henrik.wallin@windriver.com X-Patchwork-Id: 9113 Received: (qmail 102119 invoked by alias); 14 Oct 2015 15:12:06 -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 102106 invoked by uid 89); 14 Oct 2015 15:12:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mail.windriver.com Received: from mail.windriver.com (HELO mail.windriver.com) (147.11.1.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 14 Oct 2015 15:12:01 +0000 Received: from arn-build2.wrs.com (arn-build2.wrs.com [128.224.95.15]) by mail.windriver.com (8.15.2/8.15.1) with ESMTP id t9EBEZL9010726 for ; Wed, 14 Oct 2015 04:14:35 -0700 (PDT) Received: by arn-build2.wrs.com (Postfix, from userid 18580) id 0520A220D63; Wed, 14 Oct 2015 13:14:34 +0200 (CEST) From: henrik.wallin@windriver.com To: gdb-patches@sourceware.org Subject: [RFC][PATCH 14/15] gdbserver: Add linux-arm-ipa.c Date: Wed, 14 Oct 2015 13:14:32 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: From: Henrik Wallin This adds the ipa for arm. Currently hard-code to "arm_with_neon". This probably needs to be improved to validate the arm architecture that actually is running. The ipa does not support jit compilation of the fast tracepoint expressions. gdb/gdbserver/ChangeLog: * configure.srv : Add IPA for arm * Makefile.in : Add IPA for arm * linux-arm-ipa.c : New file Signed-off-by: Henrik Wallin --- gdb/gdbserver/Makefile.in | 6 +++ gdb/gdbserver/configure.srv | 1 + gdb/gdbserver/linux-arm-ipa.c | 97 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 gdb/gdbserver/linux-arm-ipa.c diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index cd146f4abd20..8b57072b59a1 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -517,6 +517,12 @@ rsp-low-ipa.o: ../common/rsp-low.c errors-ipa.o: ../common/errors.c $(IPAGENT_COMPILE) $< $(POSTCOMPILE) +arm-linux-ipa.o: arm-with-neon.c + $(IPAGENT_COMPILE) $< + $(POSTCOMPILE) +linux-arm-ipa.o: linux-arm-ipa.c + $(IPAGENT_COMPILE) $< + $(POSTCOMPILE) ax.o: ax.c $(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $< diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index f187c9de0e65..93fe855b93d9 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -81,6 +81,7 @@ case "${target}" in srv_linux_usrregs=yes srv_linux_regsets=yes srv_linux_thread_db=yes + ipa_obj="arm-linux-ipa.o linux-arm-ipa.o" ;; arm*-*-mingw32ce*) srv_regobj=reg-arm.o srv_tgtobj="win32-low.o win32-arm-low.o" diff --git a/gdb/gdbserver/linux-arm-ipa.c b/gdb/gdbserver/linux-arm-ipa.c new file mode 100644 index 000000000000..e14465b94423 --- /dev/null +++ b/gdb/gdbserver/linux-arm-ipa.c @@ -0,0 +1,97 @@ +/* GNU/Linux/arm specific low level interface, for the in-process + agent library for GDB. + + Copyright (C) 2015 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "server.h" +#include +#include +#include "tracepoint.h" + +/* Defined in auto-generated file regs-arm.c. */ +void init_registers_arm_with_neon (void); +extern const struct target_desc *tdesc_arm_with_neon; + +/* reg map + */ +int index_map[] = { + 2, /* 0 - r0 */ + 3, /* 1 - r1 */ + 4, /* 2 - r2 */ + 5, /* 3 - r3 */ + 6, /* 4 - r4 */ + 7, /* 5 - r5 */ + 8, /* 6 - r6 */ + 9, /* 7 - r7 */ + 10, /* 8 - r8 */ + 11, /* 9 - r9 */ + 12, /* 10 - r10 */ + 13, /* 11 - r11 */ + 14, /* 12 - r12 */ + -1, /* 13 - r13 - sp */ + 15, /* 14 - r14 - lr */ + 0, /* 15 - r15 - pc */ + -1, /* 16 - */ + -1, /* 17 - */ + -1, /* 18 - */ + -1, /* 19 - */ + -1, /* 20 - */ + -1, /* 21 - */ + -1, /* 22 - */ + -1, /* 23 - */ + -1, /* 24 - */ + 1, /* 25 - cpsr */ +}; + +void +supply_fast_tracepoint_registers (struct regcache *regcache, + const unsigned char *buf) +{ + const uint32_t *regs = (const uint32_t *) buf; + uint32_t val; + int i; + + for (i = 0; i < sizeof(index_map) / sizeof(index_map[0]); i++) + { + int index = index_map[i]; + if (index != -1) + { + val = regs[index]; + supply_register (regcache, i, &val); + } + } + /* special for sp */ + val = (uint32_t) regs + 16 * 4; + supply_register (regcache, 13, &val); +} + +IP_AGENT_EXPORT_FUNC ULONGEST +gdb_agent_get_raw_reg (const unsigned char *raw_regs, int regnum) +{ + /* only for jit */ + return 0; +} + +const char *gdbserver_xmltarget; + +void +initialize_low_tracepoint (void) +{ + init_registers_arm_with_neon (); + ipa_tdesc = tdesc_arm_with_neon; +}