From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60160 invoked by alias); 4 Dec 2015 15:31:27 -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 60150 invoked by uid 89); 4 Dec 2015 15:31:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 04 Dec 2015 15:31:25 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id C6.D8.06940.691B1665; Fri, 4 Dec 2015 16:30:30 +0100 (CET) Received: from [142.133.110.95] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.248.2; Fri, 4 Dec 2015 10:31:23 -0500 Subject: Re: [PATCH v5 3/7] Refactor arm_software_single_step to use regcache. To: Pedro Alves , 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> From: Antoine Tremblay Message-ID: <5661B1CA.3080503@ericsson.com> Date: Fri, 04 Dec 2015 15:31: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: <5661ACDE.5080606@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00085.txt.bz2 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.