From patchwork Fri May 5 08:04:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 20293 Received: (qmail 70705 invoked by alias); 5 May 2017 08:04:39 -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 68286 invoked by uid 89); 5 May 2017 08:04:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=Hard, Hx-languages-length:1751 X-HELO: EUR03-DB5-obe.outbound.protection.outlook.com Received: from mail-eopbgr40040.outbound.protection.outlook.com (HELO EUR03-DB5-obe.outbound.protection.outlook.com) (40.107.4.40) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 May 2017 08:04:35 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0104.eurprd08.prod.outlook.com (10.160.211.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12; Fri, 5 May 2017 08:04:34 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::b823:64c1:afc5:3a08]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::b823:64c1:afc5:3a08%17]) with mapi id 15.01.1061.022; Fri, 5 May 2017 08:04:34 +0000 From: Alan Hayward To: Yao Qi CC: "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH 3/11] Add MIPS_MAX_REGISTER_SIZE (4/4) Date: Fri, 5 May 2017 08:04:34 +0000 Message-ID: <0150DDF9-6204-4F4F-99E9-D757C1DBD512@arm.com> References: <3C00280E-37C9-4C0A-9DA6-F3B9DB1A6E8F@arm.com> <86y3v7uf9j.fsf@gmail.com> In-Reply-To: <86y3v7uf9j.fsf@gmail.com> authentication-results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=arm.com; x-microsoft-exchange-diagnostics: 1; AM3PR08MB0104; 7:emfIDk0CJghFmm6vMJaDGahGzqeFOpVA2h1SzlgDEeoNYA3istluU86biYudnr79eihevtY2l4zGCiOUxk4JIaWc7EV3L6+8xbJtaPgcgZPS00NE2cGOgqhFUWlAKLb8mIoUrbmNbZ5keg/Py8Sbnti3874Eg9aRpy7X3RTy4sKPkHgupd4Cwy7kn0QiYTNrGU1ptWoi/2SiGoCP/PvFQBL+GQbVM/Voy05iIjifP8xpqiibruPL2kFRiPszid0u5gQ47YlCDygQjlML4DIXhBVwNcy7lWMRbgqJuZ3OJQFCa4neoLwLnLRUzyFZ11joa6yhpDOdZIxhcwU7iD+eKA== x-ms-office365-filtering-correlation-id: 7625ab15-789b-4242-699c-08d4938d5e3a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:AM3PR08MB0104; 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)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:AM3PR08MB0104; BCL:0; PCL:0; RULEID:; SRVR:AM3PR08MB0104; x-forefront-prvs: 02981BE340 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39850400002)(39840400002)(39400400002)(39860400002)(39450400003)(39410400002)(377424004)(24454002)(82746002)(478600001)(66066001)(2900100001)(54906002)(36756003)(8676002)(50986999)(81166006)(8936002)(99286003)(54356999)(76176999)(53936002)(6512007)(6506006)(6436002)(6486002)(3846002)(5250100002)(102836003)(6116002)(33656002)(53546009)(39060400002)(83716003)(6246003)(38730400002)(110136004)(4326008)(1411001)(3660700001)(3280700002)(7736002)(86362001)(575784001)(2906002)(189998001)(305945005)(2950100002)(6916009)(229853002)(5660300001)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0104; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2017 08:04:34.5780 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0104 > On 11 Apr 2017, at 16:37, Yao Qi wrote: > > Alan Hayward writes: > > Hi Alan, > There are different ways of getting rid of MAX_REGISTER_SIZE, let us try > some simple approaches first. Some uses of MAX_REGISTER_SIZE still > can't be removed, but let us start from easy part. Patch split into multiple parts. In this part mips_eabi_push_dummy_call is extracting an address from the register. I've hardcoded the buffer to the max address size and added an assert. I've used the value 8, let me know if there is a #define to use. 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? 2017-05-05 Alan Hayward * mips-tdep.c (mips_eabi_push_dummy_call): Hard code buffer size. diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 7b247eac40e26599b80cd45187417282d03dcc85..145ac7fdc9b5335ff527c5c5c0ede8dc981c5880 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4528,7 +4528,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[8]; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); int len = TYPE_LENGTH (arg_type); @@ -4544,6 +4544,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (len > regsize && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) { + gdb_assert (regsize <= 8); store_unsigned_integer (valbuf, regsize, byte_order, value_address (arg)); typecode = TYPE_CODE_PTR;