From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99371 invoked by alias); 4 Dec 2015 15:43:16 -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 99354 invoked by uid 89); 4 Dec 2015 15:43:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 04 Dec 2015 15:43:15 +0000 Received: from EUSAAHC005.ericsson.se (Unknown_Domain [147.117.188.87]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id C1.E2.32102.D84B1665; Fri, 4 Dec 2015 16:43:09 +0100 (CET) Received: from [142.133.110.95] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.89) with Microsoft SMTP Server id 14.3.248.2; Fri, 4 Dec 2015 10:43:12 -0500 Subject: Re: [PATCH v5 3/7] Refactor arm_software_single_step to use regcache. References: <1449234783-11424-1-git-send-email-antoine.tremblay@ericsson.com> <1449234783-11424-4-git-send-email-antoine.tremblay@ericsson.com> <5661ACDE.5080606@redhat.com> <5661B1CA.3080503@ericsson.com> To: Pedro Alves , From: Antoine Tremblay Message-ID: <5661B490.5020309@ericsson.com> Date: Fri, 04 Dec 2015 15:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5661B1CA.3080503@ericsson.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00087.txt.bz2 On 12/04/2015 10:31 AM, Antoine Tremblay wrote: > > > On 12/04/2015 10:10 AM, Pedro Alves wrote: >> On 12/04/2015 01:12 PM, Antoine Tremblay wrote: >>> @@ -4727,7 +4754,8 @@ thumb_get_next_pc_raw (struct frame_info >>> *frame, CORE_ADDR pc) >>> { >>> /* CBNZ or CBZ. */ >>> int imm = (bit (inst1, 9) << 6) + (bits (inst1, 3, 7) << 1); >>> - ULONGEST reg = get_frame_register_unsigned (frame, bits >>> (inst1, 0, 2)); >>> + ULONGEST reg; >>> + regcache_raw_read_unsigned (regcache, bits (inst1, 0, 2), ®); >> >> Missing empty line. > > Fixed. > >> >> Note that get_frame_register_unsigned throws if the register is >> unavailable, while regcache_raw_read_unsigned uses the return value as >> status indication. >> >> Shouldn't really happen normally in get_next_pcs to see an unavailable >> register, but, wouldn't it be nicer to add a small wrapper like: >> >> ULONGEST >> get_regcache_raw_unsigned (struct regcache *regcache, int regnum) >> { >> ULONGEST value; >> enum register_status status; >> >> status = regcache_raw_read_unsigned (regcache, regnum, &value); >> if (status == REG_UNAVAILABLE) >> throw_error (NOT_AVAILABLE_ERROR, >> _("Register %s is not available"), regnum); >> return value; >> } >> >> ? > > OK. However thinking about it since I will add this to regcache.h and then to common-regcache.h. I think I will call it regcache_raw_read_unsigned_throw. Thanks, Antoine