In preparation for RISC-V/Linux `gdbserver' support factor out parts of native target description determination code that can be shared between the programs. gdb/ * nat/riscv-linux-tdesc.h: New file. * nat/riscv-linux-tdesc.c: New file, taking code from... * riscv-linux-nat.c (riscv_linux_nat_target::read_description): ... here. * configure.nat : Add nat/riscv-linux-tdesc.o to NATDEPFILES. --- New change in v2. --- gdb/configure.nat | 3 + gdb/nat/riscv-linux-tdesc.c | 82 ++++++++++++++++++++++++++++++++++++++++++++ gdb/nat/riscv-linux-tdesc.h | 27 ++++++++++++++ gdb/riscv-linux-nat.c | 50 +------------------------- 4 files changed, 114 insertions(+), 48 deletions(-) gdb-riscv-linux-nat-tdesc.diff Index: binutils-gdb/gdb/configure.nat =================================================================== --- binutils-gdb.orig/gdb/configure.nat +++ binutils-gdb/gdb/configure.nat @@ -276,7 +276,8 @@ case ${gdb_host} in ;; riscv*) # Host: RISC-V, running Linux - NATDEPFILES="${NATDEPFILES} riscv-linux-nat.o" + NATDEPFILES="${NATDEPFILES} riscv-linux-nat.o \ + nat/riscv-linux-tdesc.o" ;; s390) # Host: S390, running Linux Index: binutils-gdb/gdb/nat/riscv-linux-tdesc.c =================================================================== --- /dev/null +++ binutils-gdb/gdb/nat/riscv-linux-tdesc.c @@ -0,0 +1,82 @@ +/* GNU/Linux/RISC-V native target description support for GDB. + Copyright (C) 2020 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 "gdbsupport/common-defs.h" + +#include "gdb_proc_service.h" +#include "arch/riscv.h" +#include "elf/common.h" +#include "nat/gdb_ptrace.h" +#include "nat/riscv-linux-tdesc.h" + +#include + +/* Work around glibc header breakage causing ELF_NFPREG not to be usable. */ +#ifndef NFPREG +# define NFPREG 33 +#endif + +/* Determine XLEN and FLEN and return a corresponding target description. */ + +const struct target_desc * +riscv_linux_read_description (int tid) +{ + struct riscv_gdbarch_features features; + elf_fpregset_t regs; + int flen; + + /* Figuring out xlen is easy. */ + features.xlen = sizeof (elf_greg_t); + + /* Start with no f-registers. */ + features.flen = 0; + + /* How much worth of f-registers can we fetch if any? */ + for (flen = sizeof (regs.__f.__f[0]); ; flen *= 2) + { + size_t regset_size; + struct iovec iov; + + /* Regsets have a uniform slot size, so we count FSCR like an FGR. */ + regset_size = ELF_NFPREG * flen; + if (regset_size > sizeof (regs)) + break; + + iov.iov_base = ®s; + iov.iov_len = regset_size; + if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, + (PTRACE_TYPE_ARG3) &iov) == -1) + { + switch (errno) + { + case EINVAL: + continue; + case EIO: + break; + default: + perror_with_name (_("Couldn't get registers")); + break; + } + } + else + features.flen = flen; + break; + } + + return riscv_create_target_description (features); +} Index: binutils-gdb/gdb/nat/riscv-linux-tdesc.h =================================================================== --- /dev/null +++ binutils-gdb/gdb/nat/riscv-linux-tdesc.h @@ -0,0 +1,27 @@ +/* GNU/Linux/RISC-V native target description support for GDB. + Copyright (C) 2020 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 . */ + +#ifndef NAT_RISCV_LINUX_TDESC_H +#define NAT_RISCV_LINUX_TDESC_H + +struct target_desc; + +/* Return a target description for the LWP identified by TID. */ +const struct target_desc *riscv_linux_read_description (int tid); + +#endif /* NAT_RISCV_LINUX_TDESC_H */ Index: binutils-gdb/gdb/riscv-linux-nat.c =================================================================== --- binutils-gdb.orig/gdb/riscv-linux-nat.c +++ binutils-gdb/gdb/riscv-linux-nat.c @@ -22,10 +22,11 @@ #include "linux-nat.h" #include "riscv-tdep.h" #include "inferior.h" -#include "target-descriptions.h" #include "elf/common.h" +#include "nat/riscv-linux-tdesc.h" + #include /* Work around glibc header breakage causing ELF_NFPREG not to be usable. */ @@ -196,52 +197,7 @@ fill_fpregset (const struct regcache *re const struct target_desc * riscv_linux_nat_target::read_description () { - struct riscv_gdbarch_features features; - elf_fpregset_t regs; - int flen; - int tid; - - /* Figuring out xlen is easy. */ - features.xlen = sizeof (elf_greg_t); - - tid = inferior_ptid.lwp (); - - /* Start with no f-registers. */ - features.flen = 0; - - /* How much worth of f-registers can we fetch if any? */ - for (flen = sizeof (regs.__f.__f[0]); ; flen *= 2) - { - size_t regset_size; - struct iovec iov; - - /* Regsets have a uniform slot size, so we count FSCR like an FGR. */ - regset_size = ELF_NFPREG * flen; - if (regset_size > sizeof (regs)) - break; - - iov.iov_base = ®s; - iov.iov_len = regset_size; - if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, - (PTRACE_TYPE_ARG3) &iov) == -1) - { - switch (errno) - { - case EINVAL: - continue; - case EIO: - break; - default: - perror_with_name (_("Couldn't get registers")); - break; - } - } - else - features.flen = flen; - break; - } - - return riscv_create_target_description (features); + return riscv_linux_read_description (inferior_ptid.lwp ()); } /* Fetch REGNUM (or all registers if REGNUM == -1) from the target From gdb-patches-return-163635-listarch-gdb-patches=sources.redhat.com@sourceware.org Wed Jan 29 18:14:23 2020 Return-Path: Delivered-To: listarch-gdb-patches@sources.redhat.com Received: (qmail 13598 invoked by alias); 29 Jan 2020 18:14:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 13580 invoked by uid 89); 29 Jan 2020 18:14:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_SHORT autolearn=ham version=3.3.1 spammyúvour X-HELO: esa4.hgst.iphmx.com Received: from esa4.hgst.iphmx.com (HELO esa4.hgst.iphmx.com) (216.71.154.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Jan 2020 18:14:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t80321657; x11857657; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=7MweSfYkzmbR/skPXXZJYmxhgFD+cua6xoMnSj8yskU=; b=b/iWCRJNyUWb8mJ0QSfDIKJhU12n51+Tq838E0myWaBnjxh0TWIGmK0G S8dlPOaMhL2rHh8ZTwLOqQ+4GRuPwXmlfHH1QCwd1KK/YL9S9HcPKhlFj FW7+rJDsp6LkovsybfKDnhGIR772JJXZ47rR7jAd7zlgeYPsMM7GP7Lgr jak0ApA8t1bCkhxb04/cIQxguQVPdX5GiEgMvybSN48a3nrWOTU0sL9xs T8tkEa45HTGxOfsuIpYmes9BjJUMeuRmOziEuwel0yJmozmY5M6YNtIMx o8W6fxwRRhLhlNbGEwWoUvqOVLt+7czwK+WvkS8xpIQvu4yczxeI2hv5l g==; IronPort-SDR: uiZAcFLC23+uEyO0sszZ72mdImbXKQnVx34DI6mDU8z/KJ4o0YSHlGhLDUFQ2kUeY5Fd9/EjrX y6bJ+P0V4R3AITMN6ufVbrYDLtRUpgxf+CVa2mvHAJk/jiJBik9vOAR81R1iBBVl3iI59J+llx xnp+sjaLk8mEAruR6Vvw+eDOeZ5J6jQ0SsuNhDtF6qmurYVq4JtabEDPFke+5ttm0HOdfqi5n1 t+2eiDZECahelsgk3l3hgrHa9y3qo+A3vIRCKf7Z9dVg7rNOfgjexzMiQfCxtFOaQhSfmAjfgK l9UReceived: from mail-dm6nam11lp2169.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.169]) by ob1.hgst.iphmx.com with ESMTP; 30 Jan 2020 02:14:14 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QI6dL+g8n42CabSplCgQOhd78Fw/lmdxUID4iJn9uft4J0GFojduX77t61uIGiEMx76zGaqOEctD0c125g4PjLFQ/eVBH1NwFvXI6/e4DpwFUiLedvrQAsGNMByVxSHF+Lmd/T9vwld0+2LnmJouwPDhHHLTMjENP+qOYp7gYbamdVyqdnjfFN1aaQYJrTALC+WMERf4y8/FYLjynTF3yk9+HJnCe9cDIjY8ZtaSu8lq03OXvlDWY1mnu++wldiatRmYvqlh8NVhqQqreGQOy0OHJUYKWN6xH0k/n0/R7ojsRb7HK4gq6yyRVjMsmXTNivZbg+jnbvqKJ/RzxHOafQ=ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bhþlZJrvZNk8BRsSCDWqZI7E8KwUdl1rcdfxYZ9sCAkI=; b=GS94WCRtB+Lf0refhTnF1rgmAEKr2RZrQwkpJB8TBWVdcRCeA5AKjLWJB0bfblRC7oeu2FbqaVDA97IlVn6/w3AZlgOuP8smK3vf+ty3LScwPSAmcBL0zXnI8E6oxBa/5WBfiv+CN4pFZ9TLvx1Pp4xQXGpKDHAj3MtDB0CXzPqtAqZ7+WJuN4ZFjeNCd+x58sugCz55BN1tTSkkrom8SHuC0CDFfkCJPrCMX+pesB1Zqf3h4kna3IWOjLCE3aaA46JLFmCLAk5WS8k1heKyraHGqujsSxpXnf8uBFDuHceyI6fp4hUjT70zJJ31wb7psyJbdZd+2d1m/M/auakt2Q=ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bhþlZJrvZNk8BRsSCDWqZI7E8KwUdl1rcdfxYZ9sCAkI=; b=dj8CMWw1/H6CTFVfs/yM94twGK/I63vhjveptVpglTro0G4AxkxjJM5AYAtWuaW+wV3gU8OIfjf+resykeH17eGCsdBGUR6POgE9PBMgddq7WloMWejIj/xhdXQtlz4Ld4j1hE9R951ey73v6DtEccanzoJUJvQXY75KUbspefAReceived: from BY5PR04MB6980.namprd04.prod.outlook.com (10.186.134.11) by BY5PR04MB6627.namprd04.prod.outlook.com (10.186.135.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.19; Wed, 29 Jan 2020 18:14:13 +0000 Received: from BY5PR04MB6980.namprd04.prod.outlook.com ([fe80::d068:7819:b5cf:353]) by BY5PR04MB6980.namprd04.prod.outlook.com ([fe80::d068:7819:b5cf:353%5]) with mapi id 15.20.2665.027; Wed, 29 Jan 2020 18:14:13 +0000 From: "Maciej W. Rozycki" To: "gdb-patches@sourceware.org" CC: Jim Wilson , Andrew Burgess , Palmer Dabbelt , Tom Tromey , "guoren@kernel.org" , "lifang_xia@c-sky.com" , "yunhai_shang@c-sky.com" , "jiangshuai_li@c-sky.com" Subject: [PATCH v2 3/3] gdbserver: Add RISC-V/Linux support Date: Wed, 29 Jan 2020 18:39:00 -0000 Message-ID: References: In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=macro@wdc.com; x-ms-exchange-transport-forked: True wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-messagedata: m0s5FNaaiYJ9dfY97RbtegjehGzRNQf2f5dQvKGkNM6ayLPtrTwY93HOMHgj7ShSbTvx0lfF6WXWQN7o6eHjV1547Z2Xf0Y+RLFW+A5Iw38fw48vV9C4kCUzaXkkm5RjjekZTniUE3ag/FNNF8fKdQ=Content-Type: text/plain; charset="us-ascii" Content-ID: <1853E36718214E458612A102EF14237C@namprd04.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: le0Uq25GeBUgPUNn78ybovZJ7phKmjC9x+rceW9tDHyo03dIFbWuwy7nXkzD5Crh X-SW-Source: 2020-01/txt/msg00949.txt.bz2 Content-length: 14868 Implement RISC-V/Linux support for both RV64 and RV32 systems, including XML target description handling based on features determined, GPR and FPR regset support including dynamic sizing of the latter, and software breakpoint handling. Define two NT_FPREGSET regsets of a different size matching the FPR sizes supported for generic `gdbserver' code to pick from according to what the OS supplies. Also handle a glibc bug where ELF_NFPREG is defined in terms of NFPREG, however NFPREG is nowhere defined. gdb/ * arch/riscv.h (riscv_create_target_description): Remove `const' qualifier from the return type. * arch/riscv.c (riscv_create_target_description): Likewise. * nat/riscv-linux-tdesc.h (riscv_linux_read_description): Likewise. * nat/riscv-linux-tdesc.c (riscv_linux_read_description): Likewise. * configure.tgt : Set build_gdbserver=yes. gdb/gdbserver/ * linux-riscv-low.c: New file. * Makefile.in (SFILES): Add linux-riscv-low.c, arch/riscv.c, and nat/riscv-linux-tdesc.c. * configure.srv (srv_tgtobj) (srv_linux_regsets, srv_linux_usrregs, srv_linux_thread_db): Define. --- Changes from v1: - Make `gdbserver' selected for automatic build in a RISC-V/Linux/native GDB configuration (thanks, Jim, for pointing this out!). - Remove most of `riscv_arch_setup' and use `riscv_linux_read_description' from 2/3 instead. - Stop using `elf_fpregset_t*' in favour to just a raw `gdb_byte *' buffer and size the regset according to the FPR size in `riscv_fill_fpregset' and `riscv_store_fpregset'. - Define 2 NT_FPREGSET regsets of a different size for generic `gdbserver' code to pick from according to what the OS supplies. --- gdb/arch/riscv.c | 2 gdb/arch/riscv.h | 4 gdb/configure.tgt | 1 gdb/gdbserver/Makefile.in | 3 gdb/gdbserver/configure.srv | 7 + gdb/gdbserver/linux-riscv-low.c | 257 ++++++++++++++++++++++++++++++++++++++++ gdb/nat/riscv-linux-tdesc.c | 2 gdb/nat/riscv-linux-tdesc.h | 2 8 files changed, 273 insertions(+), 5 deletions(-) gdb-riscv-gdbserver-linux.diff Index: binutils-gdb/gdb/arch/riscv.c =================================================================== --- binutils-gdb.orig/gdb/arch/riscv.c +++ binutils-gdb/gdb/arch/riscv.c @@ -43,7 +43,7 @@ static std::unordered_map. */ + +#include "server.h" + +#include "linux-low.h" +#include "tdesc.h" +#include "elf/common.h" +#include "nat/riscv-linux-tdesc.h" +#include "opcode/riscv.h" + +/* Work around glibc header breakage causing ELF_NFPREG not to be usable. */ +#ifndef NFPREG +# define NFPREG 33 +#endif + +/* Implementation of linux_target_ops method "arch_setup". */ + +static void +riscv_arch_setup () +{ + static const char *expedite_regs[] = { "sp", "pc", NULL }; + target_desc *tdesc; + + tdesc = riscv_linux_read_description (lwpid_of (current_thread)); + if (!tdesc->expedite_regs) + init_target_desc (tdesc, expedite_regs); + current_process ()->tdesc = tdesc; +} + +static void +riscv_fill_gregset (struct regcache *regcache, void *buf) +{ + const struct target_desc *tdesc = regcache->tdesc; + elf_gregset_t *regset = (elf_gregset_t *) buf; + int regno = find_regno (tdesc, "zero"); + int i; + + collect_register_by_name (regcache, "pc", *regset); + for (i = 1; i < ARRAY_SIZE (*regset); i++) + collect_register (regcache, regno + i, *regset + i); +} + +static void +riscv_store_gregset (struct regcache *regcache, const void *buf) +{ + const elf_gregset_t *regset = (const elf_gregset_t *) buf; + const struct target_desc *tdesc = regcache->tdesc; + int regno = find_regno (tdesc, "zero"); + int i; + + supply_register_by_name (regcache, "pc", *regset); + supply_register_zeroed (regcache, regno); + for (i = 1; i < ARRAY_SIZE (*regset); i++) + supply_register (regcache, regno + i, *regset + i); +} + +static void +riscv_fill_fpregset (struct regcache *regcache, void *buf) +{ + const struct target_desc *tdesc = regcache->tdesc; + int regno = find_regno (tdesc, "ft0"); + int flen = register_size (regcache->tdesc, regno); + gdb_byte *regset = (gdb_byte *) buf; + int i; + + for (i = 0; i < ELF_NFPREG - 1; i++) + collect_register (regcache, regno + i, regset + i * flen); + collect_register_by_name (regcache, "fcsr", regset + i * flen); +} + +static void +riscv_store_fpregset (struct regcache *regcache, const void *buf) +{ + const struct target_desc *tdesc = regcache->tdesc; + int regno = find_regno (tdesc, "ft0"); + int flen = register_size (regcache->tdesc, regno); + const gdb_byte *regset = (const gdb_byte *) buf; + int i; + + for (i = 0; i < ELF_NFPREG - 1; i++) + supply_register (regcache, regno + i, regset + i * flen); + supply_register_by_name (regcache, "fcsr", regset + i * flen); +} + +static struct regset_info riscv_regsets[] = { + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, + sizeof (elf_gregset_t), GENERAL_REGS, + riscv_fill_gregset, riscv_store_gregset }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, + sizeof (struct __riscv_mc_d_ext_state), FP_REGS, + riscv_fill_fpregset, riscv_store_fpregset }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, + sizeof (struct __riscv_mc_f_ext_state), FP_REGS, + riscv_fill_fpregset, riscv_store_fpregset }, + NULL_REGSET +}; + +static struct regsets_info riscv_regsets_info = + { + riscv_regsets, /* regsets */ + 0, /* num_regsets */ + NULL, /* disabled_regsets */ + }; + +static struct regs_info riscv_regs = + { + NULL, /* regset_bitmap */ + NULL, /* usrregs */ + &riscv_regsets_info, + }; + +/* Implementation of linux_target_ops method "regs_info". */ + +static const struct regs_info * +riscv_regs_info () +{ + return &riscv_regs; +} + +/* Implementation of linux_target_ops method "fetch_register". */ + +static int +riscv_fetch_register (struct regcache *regcache, int regno) +{ + const struct target_desc *tdesc = regcache->tdesc; + + if (regno != find_regno (tdesc, "zero")) + return 0; + supply_register_zeroed (regcache, regno); + return 1; +} + +/* Implementation of linux_target_ops method "get_pc". */ + +static CORE_ADDR +riscv_get_pc (struct regcache *regcache) +{ + elf_gregset_t regset; + + if (sizeof (regset[0]) == 8) + return linux_get_pc_64bit (regcache); + else + return linux_get_pc_32bit (regcache); +} + +/* Implementation of linux_target_ops method "set_pc". */ + +static void +riscv_set_pc (struct regcache *regcache, CORE_ADDR newpc) +{ + elf_gregset_t regset; + + if (sizeof (regset[0]) == 8) + linux_set_pc_64bit (regcache, newpc); + else + linux_set_pc_32bit (regcache, newpc); +} + +/* Correct in either endianness. */ +static const uint16_t riscv_ibreakpoint[] = { 0x0073, 0x0010 }; +static const uint16_t riscv_cbreakpoint = 0x9002; + +/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */ + +static int +riscv_breakpoint_kind_from_pc (CORE_ADDR *pcptr) +{ + union + { + gdb_byte bytes[2]; + uint16_t insn; + } + buf; + + if (target_read_memory (*pcptr, buf.bytes, sizeof (buf.insn)) == 0 + && riscv_insn_length (buf.insn == sizeof (riscv_ibreakpoint))) + return sizeof (riscv_ibreakpoint); + else + return sizeof (riscv_cbreakpoint); +} + +/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ + +static const gdb_byte * +riscv_sw_breakpoint_from_kind (int kind, int *size) +{ + *size = kind; + switch (kind) + { + case sizeof (riscv_ibreakpoint): + return (const gdb_byte *) &riscv_ibreakpoint; + default: + return (const gdb_byte *) &riscv_cbreakpoint; + } +} + +/* Implementation of linux_target_ops method "breakpoint_at". */ + +static int +riscv_breakpoint_at (CORE_ADDR pc) +{ + union + { + gdb_byte bytes[2]; + uint16_t insn; + } + buf; + + if (target_read_memory (pc, buf.bytes, sizeof (buf.insn)) == 0 + && (buf.insn == riscv_cbreakpoint + || (buf.insn == riscv_ibreakpoint[0] + && target_read_memory (pc + sizeof (buf.insn), buf.bytes, + sizeof (buf.insn)) == 0 + && buf.insn == riscv_ibreakpoint[1]))) + return 1; + else + return 0; +} + +struct linux_target_ops the_low_target = +{ + riscv_arch_setup, + riscv_regs_info, + NULL, /* cannot_fetch_register */ + NULL, /* cannot_store_register */ + riscv_fetch_register, + riscv_get_pc, + riscv_set_pc, + riscv_breakpoint_kind_from_pc, + riscv_sw_breakpoint_from_kind, + NULL, /* get_next_pcs */ + 0, /* decr_pc_after_break */ + riscv_breakpoint_at, +}; + +void +initialize_low_arch () +{ + initialize_regsets_info (&riscv_regsets_info); +} Index: binutils-gdb/gdb/nat/riscv-linux-tdesc.c =================================================================== --- binutils-gdb.orig/gdb/nat/riscv-linux-tdesc.c +++ binutils-gdb/gdb/nat/riscv-linux-tdesc.c @@ -33,7 +33,7 @@ /* Determine XLEN and FLEN and return a corresponding target description. */ -const struct target_desc * +struct target_desc * riscv_linux_read_description (int tid) { struct riscv_gdbarch_features features; Index: binutils-gdb/gdb/nat/riscv-linux-tdesc.h =================================================================== --- binutils-gdb.orig/gdb/nat/riscv-linux-tdesc.h +++ binutils-gdb/gdb/nat/riscv-linux-tdesc.h @@ -22,6 +22,6 @@ struct target_desc; /* Return a target description for the LWP identified by TID. */ -const struct target_desc *riscv_linux_read_description (int tid); +struct target_desc *riscv_linux_read_description (int tid); #endif /* NAT_RISCV_LINUX_TDESC_H */ From gdb-patches-return-163636-listarch-gdb-patches=sources.redhat.com@sourceware.org Wed Jan 29 18:39:53 2020 Return-Path: Delivered-To: listarch-gdb-patches@sources.redhat.com Received: (qmail 113575 invoked by alias); 29 Jan 2020 18:39:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 113566 invoked by uid 89); 29 Jan 2020 18:39:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammyX-HELO: esa5.hgst.iphmx.com Received: from esa5.hgst.iphmx.com (HELO esa5.hgst.iphmx.com) (216.71.153.144) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Jan 2020 18:39:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t80323183; x11859183; hÚte:from:to:cc:subject:message-id:mime-version; bh=zaF+OY66OP/2firVHRE4Mn2cTg/Q9m9ne686326GVCY=; b=CQl4CN1wyV9Wfbt8Ln+OGU+2ehzPX+FPEUc2uCiW4LjfYwADz+wReqc6 KAx9EdAQ7pzRpo0Hi6uU1aDVyBgq3FmrlmPytYXPZcqljEsGqJotl3bCN AS45shGx4Wl3dK4ZW5v5+5l4ko2yomxmuSfOw5wxgOa/oGWQKlVcqcIIo Y/lrzUst4TQuvmqQq3G/D1aio+L43D3JkCAr+1KjmorkpIcA7YY+nLbQQ a5EuEM9S2tQ+a8iHEposUTv0hSJEgZOFGjN6v9qny1nWfBUHo626lKSls oQei4lA5X8yPwXTOC3emezP3szp037j7d22IUwJ3bBPXYzxJJXOqcJEJ6 Q==; IronPort-SDR: hC8cZgharccMPy8Su+OIonnNkq1IfXw/oie0d/mBu63unJlpQb8SkiiXZPMrG/3CZI6vh6DBI1 VdCTFpcE+REPJg6SHIGM6YKojRKuU4FZMVmcp0duqk5jUCKaLP1vtBtsuadcnFj/CTrtnyTcFV Mo6Ly+eu5cphzHlc3BjDaneSGC61JzF2A8k8mWgsH2id6neG1FltI+0TvBGaFn9I8BbKcUOK1a D14+07d1q6nmJT+Krw9iqXQAiCd8puf/SR6yPxj8jhM6Ldg2gS3e41/gZVXmudw9Nr+7fLtL9I WYYReceived: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Jan 2020 02:39:41 +0800 IronPort-SDR: lBhonbsq0MWILe1BQR2WDK4TJiz3R4+zb/w/xyNRXpn3qt5cxkszKKSN7Sm1DkOEMTNjCQvCUG MV7a5wIpQ0xslNyMAGtvzQ50cQhEvX6/wvbLQKMmSU+pt+NH5r1nK+cty3FowZbh5LNpo3pn4h SGMCCNv6IEEka69iglNpkXb8UUDfNkLZnn67lDeMslcoXkLdCTquaVzjq32C0EPbB7idRLINpO pAyReDitI0ccRNrsSZGa77XHwfb3tvLqF/2FfJbQCqy069mjrMx/1HTUtBB2ctBIVvgW0UL8hF C0nu0UAPH54jnKYNrt97yTq2 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 10:32:53 -0800 IronPort-SDR: vkETWytWAFSfthzEV9O5N3J6QqN29i0FTKFl0cs9Biyjgalpl4//TrAT1V6okoLonOhQ6JsEye NLss4A3jhAkvMsFTXQitH+1NIV2j/snI/TA5Elji20NByUQiYJXhO+5buCdm53UetzAJC99Vpm zkveT2PK8aeR+xXYinTy/aLQa0ht0S2YY6zv7XWJS8n1V8q1Kaqhqj8zpWYMN3cdqsapAj79OX fU9p+oKjWvLsZjVnPi63hZ9iCHwue3lzBUM1etjEt2ho8h83AoiceU1nt+48cb3yu54f1X/NGG ae0WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 10:39:39 -0800 Date: Wed, 29 Jan 2020 18:44:00 -0000 From: "Maciej W. Rozycki" To: Pedro Franco de Carvalho cc: gdb-patches@sourceware.org, ulrich.weigand@de.ibm.com, rcardoso@linux.ibm.com Subject: [OB PATCH] gdbserver: Fix whitespace configure.srv damage for `i[34567]86-*-mingw*' Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2020-01/txt/msg00950.txt.bz2 Content-length: 1709 Fix fallout from commit 42cd72aa0279 ("gdbserver: Make `make TAGS' actually work") add a missing newline to configure.srv for `i[34567]86-*-mingw*'. gdb/gdbserver/ * configure.srv : Fix whitespace damage. --- On Wed, 29 Jan 2020, Pedro Franco de Carvalho wrote: > I also noticed that the line in configure.srv for i[34567]86-*-mingw*) > is missing a line break, but I don't have a mingw setup to test a fix > and send it. Well, this is obvious (and the terminal wrap hid the trailing tab making it pretend to be a newline). Fixed thus, and committed. Maciej --- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/configure.srv | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 3b88a9b901e..9bc965a36b3 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2020-01-29 Maciej W. Rozycki + + * configure.srv : Fix whitespace damage. + 2020-01-29 Pedro Franco de Carvalho * configure.srv (powerpc*-*-linux*): Use srv_tgtobj in second diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index f0ab14f7c33..dba0733f1d7 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -124,7 +124,8 @@ case "${target}" in srv_mingwce=yes ;; i[34567]86-*-mingw*) srv_regobj="" - srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o" srv_tgtobj="${srv_tgtobj} win32-i386-low.o" + srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o" + srv_tgtobj="${srv_tgtobj} win32-i386-low.o" srv_tgtobj="${srv_tgtobj} arch/i386.o" srv_mingw=yes ;; -- 2.11.0