From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79325 invoked by alias); 16 Nov 2016 15:09:55 -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 79209 invoked by uid 89); 16 Nov 2016 15:09:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2095, 66,9 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Nov 2016 15:09:44 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1c71qJ-00071n-5t from Luis_Gustavo@mentor.com ; Wed, 16 Nov 2016 07:09:43 -0800 Received: from [172.30.4.107] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 16 Nov 2016 07:09:39 -0800 Subject: Re: [PATCH 01/13] New regcache_raw_get_signed References: <1479145370-11432-1-git-send-email-yao.qi@linaro.org> <1479145370-11432-2-git-send-email-yao.qi@linaro.org> To: Yao Qi , Reply-To: Luis Machado From: Luis Machado Message-ID: <3ce80f3c-44f6-8ec6-01fb-1564f8adc365@codesourcery.com> Date: Wed, 16 Nov 2016 15:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1479145370-11432-2-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00416.txt.bz2 On 11/14/2016 11:42 AM, Yao Qi wrote: > This patch adds a new regcache api regcache_raw_get_signed. > > gdb: > > 2016-11-14 Yao Qi > > * regcache.c (regcache_raw_get_signed): New function. > * regcache.h (regcache_raw_get_signed): Declare. > --- > gdb/regcache.c | 13 +++++++++++++ > gdb/regcache.h | 3 +++ > 2 files changed, 16 insertions(+) > > diff --git a/gdb/regcache.c b/gdb/regcache.c > index a5c90a6..1fcf933 100644 > --- a/gdb/regcache.c > +++ b/gdb/regcache.c > @@ -742,6 +742,19 @@ regcache_raw_write_unsigned (struct regcache *regcache, int regnum, > regcache_raw_write (regcache, regnum, buf); > } > > +LONGEST > +regcache_raw_get_signed (struct regcache *regcache, int regnum) > +{ I don't quite like the name, but it is debatable whether it is appropriate or not. :-) Making it shorter and to the point since it gets used so much? > + LONGEST value; > + enum register_status status; > + > + status = regcache_raw_read_signed (regcache, regnum, &value); > + if (status == REG_UNAVAILABLE) > + throw_error (NOT_AVAILABLE_ERROR, > + _("Register %d is not available"), regnum); > + return value; > +} > + > enum register_status > regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf) > { > diff --git a/gdb/regcache.h b/gdb/regcache.h > index 1bb0ce0..19ea976 100644 > --- a/gdb/regcache.h > +++ b/gdb/regcache.h > @@ -66,6 +66,9 @@ extern void regcache_raw_write_signed (struct regcache *regcache, > extern void regcache_raw_write_unsigned (struct regcache *regcache, > int regnum, ULONGEST val); > > +extern LONGEST regcache_raw_get_signed (struct regcache *regcache, > + int regnum); > + > /* Set a raw register's value in the regcache's buffer. Unlike > regcache_raw_write, this is not write-through. The intention is > allowing to change the buffer contents of a read-only regcache > I understand this command just mimics what get_frame_register_signed does, but is it worth having some documentation to make it clear what this does and that it throws when a register is not available?