From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52634 invoked by alias); 12 Dec 2016 18:11:03 -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 Received: (qmail 52591 invoked by uid 89); 12 Dec 2016 18:11:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy==e5=b0=a7, willingness?= X-HELO: mail-wm0-f66.google.com Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Dec 2016 18:10:52 +0000 Received: by mail-wm0-f66.google.com with SMTP id g23so12937134wme.1 for ; Mon, 12 Dec 2016 10:10:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=uIeOEF8gaDUDPMSJ7EV9ZDKW2ZFrpnS9nHSqDOs8zDU=; b=mFVgicGVE0xoD5LWTFOOSXoVUoq7rmUy7gO3Ds3TVBPmmYDCzfKh/j0ENcnCCbCaIi DzspvDrIsnk/UZ2lUUpWFIagrHnDZLcfM+wKIWbbJcr+9e6z9BphlGW1q8lk/JKK7JLK JeUr77FocNeLai3HQbBMb8pyQB7IiGZat8Vq8JqbG7wb0W/WhaUax3sYP2lZsaLbS/KJ N+5V/1Xauk3ox6K5g18ZWs3XgLsMCdASPF2MSwYSGNOeocg+Px94hJ50s3Oj9ULjjjEi dqRZmrdC4d+N18oA03/5jNMuWi64CMruXPVtAj5bucdyc2AKqBTh9P0g8noroLIgtoWI 5O/w== X-Gm-Message-State: AKaTC03MLdvuL9trozNO4mi+rX5+pVsp83Rr9ixIxZN2VLILRcaoCR+CJyZjTWXslM3feQ== X-Received: by 10.28.111.138 with SMTP id c10mr10032359wmi.135.1481566250679; Mon, 12 Dec 2016 10:10:50 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id l2sm58380632wji.7.2016.12.12.10.10.48 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 12 Dec 2016 10:10:50 -0800 (PST) Date: Mon, 12 Dec 2016 18:11:00 -0000 From: Yao Qi To: Alan Hayward Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/8] AARCH64 SVE: Increse max register sizes Message-ID: <20161212181032.GC25542@E107787-LIN> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00271.txt.bz2 On 16-12-05 12:26:24, Alan Hayward wrote: > This is part of a series adding AARCH64 SVE support to gdb and gdbserver. > > In SVE the maximum size of a variable-length vector register is 256 bytes, > four > times the current maximum size currently supported in gdb. This patch > increases > the max register size and max gdbserver buffer size accordingly. Joel expressed the willingness that we should make MAX_REGISTER_SIZE gdbarch specific last time when it was changed from 32 to 64. https://sourceware.org/ml/gdb-patches/2010-09/msg00245.html I think we should make MAX_REGISTER_SIZE gdbarch specific, or stop using it at all. > > Alternatively, I could add a target variable using gdbarch.c, however > there are > 80+ static arrays within the code using the value, which would all need > replacing with mallocs/frees. We can use alloca to allocate memory on stack, and we can get the size of a register if gdbarch and regnum is available. For example, we can replace MAX_REGISTER_SIZE with register_size in xtensa_pseudo_register_read this way, gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum)); This can be used many places to replace MAX_REGISTER_SIZE. Hopefully, this may get rid of the use of MAX_REGISTER_SIZE except the uses in python/py-unwind.c and remote.c. We may replace array data[MAX_REGISTER_SIZE] with pointer in struct cached_reg and struct reg_info, and allocate memory dynamically, or use std::vector if it helps. -- Yao (齐尧)