From patchwork Tue Apr 4 10:12:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 19812 Received: (qmail 44159 invoked by alias); 4 Apr 2017 10:12:45 -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 44106 invoked by uid 89); 4 Apr 2017 10:12:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=Single X-HELO: EUR02-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr20077.outbound.protection.outlook.com (HELO EUR02-VE1-obe.outbound.protection.outlook.com) (40.107.2.77) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Apr 2017 10:12:41 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0102.eurprd08.prod.outlook.com (10.160.211.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Tue, 4 Apr 2017 10:12:39 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::5931:f431:f97d:943d]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::5931:f431:f97d:943d%16]) with mapi id 15.01.1005.018; Tue, 4 Apr 2017 10:12:39 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd Subject: [PATCH 3/11] Add MIPS_MAX_REGISTER_SIZE Date: Tue, 4 Apr 2017 10:12:39 +0000 Message-ID: <3C00280E-37C9-4C0A-9DA6-F3B9DB1A6E8F@arm.com> authentication-results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-microsoft-exchange-diagnostics: 1; AM3PR08MB0102; 7:oH9OVVsDc0P1sWLQ7a3+Py+CNmqW+sb9z8uMAIaWTOd6SkP7auOvZbOyQIHRoAgI7G8uxu9+a2aueHeeyKJ4/AS7cBDMFZTjEbjaCTl7YK+yXkaFmWYnWGgEtYcdpWI6Pqr/5IUVJml94h8YLLBj5OE4af/YXg7/Tzk+Tsli+ya3cLiUE9eDlXlqjRexCR70l6F/tsYBiG5PowMGueMBRk3EC8zPWZJIzSZj4ICBgGdmPGIpGWqtBo669G5SSDN1v3GZVo2vNfU5+qxw0AQEqS8Qhrm3odqcwJxiifRKaNwK+hIiMkabXqqWl7TDptD1C/70tH3rKXT0sCYTtElR7A==; 20:wAQI0t0DpzE5OZWCkJ3p8jTXEVuXvQ9q+/IobNhTKRWe5bpxLB2E7R1gmV0XlPYvI22vYtXuIiuf0O/NwBLS5ZRIcUtZ5i0QvK7QDG7SWoVbFLZXxnBbZGAzAptGz0Wj0zwaX2wxPVdJuPdQWP6K0vU2UGiLTM+lZfFELVUbb3A= x-ms-office365-filtering-correlation-id: 55d4f34e-1d50-4ed0-9238-08d47b431fd5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:AM3PR08MB0102; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:AM3PR08MB0102; BCL:0; PCL:0; RULEID:; SRVR:AM3PR08MB0102; x-forefront-prvs: 0267E514F9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39410400002)(39860400002)(39450400003)(39850400002)(39400400002)(39840400002)(377424004)(8936002)(2351001)(4326008)(81166006)(8676002)(25786009)(6916009)(5250100002)(575784001)(2906002)(86362001)(50986999)(33656002)(2900100001)(54356999)(189998001)(3660700001)(3846002)(110136004)(38730400002)(6486002)(83716003)(6506006)(66066001)(36756003)(7736002)(99286003)(5660300001)(5640700003)(82746002)(6436002)(53936002)(6116002)(305945005)(3280700002)(6512007)(102836003)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0102; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <176313D4D323CF48A22693C1E667C59A@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2017 10:12:39.2317 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0102 Max size set to 64bits, which I determined using the files regformats/mips*.dat Tested on a --enable-targets=all build using make check with board files unix and native-gdbserver. I do not have a MIPS machine to test on. Ok to commit? Alan. 2017-04-04 Alan Hayward * mips-fbsd-tdep.c (mips_fbsd_supply_reg): Use MIPS_MAX_REGISTER_SIZE. (mips_fbsd_collect_reg): Likewise. * mips-linux-tdep.c (supply_32bit_reg): Likewise. (mips_supply_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips64_supply_gregset): Likewise. (mips64_fill_gregset): Likewise. (mips64_fill_fpregset): Likewise. * mips-tdep.c (mips_eabi_push_dummy_call): Likewise. (mips_o32_return_value): Likewise. (print_gp_register_row): Likewise. * mips-tdep.h (MIPS_MAX_REGISTER_SIZE): Add diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c index 00fae0ec60ddc9e645d3236efe29f2f9e9ceab5c..cb696f7318a9da176fee2693e484ecf48346712c 100644 --- a/gdb/mips-fbsd-tdep.c +++ b/gdb/mips-fbsd-tdep.c @@ -63,7 +63,7 @@ mips_fbsd_supply_reg (struct regcache *regcache, int regnum, const void *addr, else { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - gdb_byte buf[MAX_REGISTER_SIZE]; + gdb_byte buf[MIPS_MAX_REGISTER_SIZE]; LONGEST val; val = extract_signed_integer ((const gdb_byte *) addr, len, byte_order); @@ -90,7 +90,7 @@ mips_fbsd_collect_reg (const struct regcache *regcache, int regnum, void *addr, else { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - gdb_byte buf[MAX_REGISTER_SIZE]; + gdb_byte buf[MIPS_MAX_REGISTER_SIZE]; LONGEST val; regcache_raw_collect (regcache, regnum, buf); diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 57e75b5343e1b927e9fe28dea16759f769cf4506..ce2f378854f4b66c426fd9d6683831e8795c58a6 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -118,7 +118,7 @@ supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr) { struct gdbarch *gdbarch = get_regcache_arch (regcache); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - gdb_byte buf[MAX_REGISTER_SIZE]; + gdb_byte buf[MIPS_MAX_REGISTER_SIZE]; store_signed_integer (buf, register_size (gdbarch, regnum), byte_order, extract_signed_integer ((const gdb_byte *) addr, 4, byte_order)); @@ -133,10 +133,10 @@ mips_supply_gregset (struct regcache *regcache, { int regi; const mips_elf_greg_t *regp = *gregsetp; - char zerobuf[MAX_REGISTER_SIZE]; + char zerobuf[MIPS_MAX_REGISTER_SIZE]; struct gdbarch *gdbarch = get_regcache_arch (regcache); - memset (zerobuf, 0, MAX_REGISTER_SIZE); + memset (zerobuf, 0, MIPS_MAX_REGISTER_SIZE); for (regi = EF_REG0 + 1; regi <= EF_REG31; regi++) supply_32bit_reg (regcache, regi - EF_REG0, regp + regi); @@ -245,9 +245,9 @@ mips_supply_fpregset (struct regcache *regcache, { struct gdbarch *gdbarch = get_regcache_arch (regcache); int regi; - char zerobuf[MAX_REGISTER_SIZE]; + char zerobuf[MIPS_MAX_REGISTER_SIZE]; - memset (zerobuf, 0, MAX_REGISTER_SIZE); + memset (zerobuf, 0, MIPS_MAX_REGISTER_SIZE); for (regi = 0; regi < 32; regi++) regcache_raw_supply (regcache, @@ -379,10 +379,10 @@ mips64_supply_gregset (struct regcache *regcache, { int regi; const mips64_elf_greg_t *regp = *gregsetp; - gdb_byte zerobuf[MAX_REGISTER_SIZE]; + gdb_byte zerobuf[MIPS_MAX_REGISTER_SIZE]; struct gdbarch *gdbarch = get_regcache_arch (regcache); - memset (zerobuf, 0, MAX_REGISTER_SIZE); + memset (zerobuf, 0, MIPS_MAX_REGISTER_SIZE); for (regi = MIPS64_EF_REG0 + 1; regi <= MIPS64_EF_REG31; regi++) supply_64bit_reg (regcache, regi - MIPS64_EF_REG0, @@ -470,7 +470,7 @@ mips64_fill_gregset (const struct regcache *regcache, if (regaddr != -1) { - gdb_byte buf[MAX_REGISTER_SIZE]; + gdb_byte buf[MIPS_MAX_REGISTER_SIZE]; LONGEST val; regcache_raw_collect (regcache, regno, buf); @@ -574,7 +574,7 @@ mips64_fill_fpregset (const struct regcache *regcache, } else if (regno == mips_regnum (gdbarch)->fp_control_status) { - gdb_byte buf[MAX_REGISTER_SIZE]; + gdb_byte buf[MIPS_MAX_REGISTER_SIZE]; LONGEST val; regcache_raw_collect (regcache, regno, buf); @@ -585,7 +585,7 @@ mips64_fill_fpregset (const struct regcache *regcache, } else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) { - gdb_byte buf[MAX_REGISTER_SIZE]; + gdb_byte buf[MIPS_MAX_REGISTER_SIZE]; LONGEST val; regcache_raw_collect (regcache, regno, buf); diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h index ce168cc49cd98b05136034cdafb2154b23264d7f..de443a0586c1ac5cfd55dfe02bf0a78cfd0f7de6 100644 --- a/gdb/mips-tdep.h +++ b/gdb/mips-tdep.h @@ -150,7 +150,9 @@ enum MIPS_INSN16_SIZE = 2, MIPS_INSN32_SIZE = 4, /* The number of floating-point or integer registers. */ - MIPS_NUMREGS = 32 + MIPS_NUMREGS = 32, + /* Big enough to hold the size of the largest register in bytes. */ + MIPS_MAX_REGISTER_SIZE = 8 }; /* Single step based on where the current instruction will take us. */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 41cb9d82c6ef473c1fbbf86601914f9a4f462411..51a22ba29a520639bdeb95c235c00c74ad40435b 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4527,7 +4527,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argnum = 0; argnum < nargs; argnum++) { const gdb_byte *val; - gdb_byte valbuf[MAX_REGISTER_SIZE]; + gdb_byte valbuf[MIPS_MAX_REGISTER_SIZE]; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); @@ -5758,7 +5758,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function, /* A struct that contains one or two floats. Each value is part in the least significant part of their floating point register.. */ - gdb_byte reg[MAX_REGISTER_SIZE]; + gdb_byte reg[MIPS_MAX_REGISTER_SIZE]; int regnum; int field; for (field = 0, regnum = mips_regnum (gdbarch)->fp0; @@ -6473,7 +6473,7 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, { struct gdbarch *gdbarch = get_frame_arch (frame); /* Do values for GP (int) regs. */ - gdb_byte raw_buffer[MAX_REGISTER_SIZE]; + gdb_byte raw_buffer[MIPS_MAX_REGISTER_SIZE]; int ncols = (mips_abi_regsize (gdbarch) == 8 ? 4 : 8); /* display cols per row. */ int col, byte;