From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114174 invoked by alias); 4 Dec 2015 15:10:32 -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 114134 invoked by uid 89); 4 Dec 2015 15:10:26 -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,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 04 Dec 2015 15:10:25 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 53BE637EE2; Fri, 4 Dec 2015 15:10:24 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tB4FAMvw026601; Fri, 4 Dec 2015 10:10:23 -0500 Message-ID: <5661ACDE.5080606@redhat.com> Date: Fri, 04 Dec 2015 15:10:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Antoine Tremblay , gdb-patches@sourceware.org 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> In-Reply-To: <1449234783-11424-4-git-send-email-antoine.tremblay@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-12/txt/msg00082.txt.bz2 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. 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; } ? Then the rest of the patch would look like: > - ULONGEST reg = get_frame_register_unsigned (frame, bits (inst1, 0, 2)); > + ULONGEST reg = get_regcache_register_unsigned (frame, bits (inst1, 0, 2)); etc., and the reader no longer need to worry about considering why is the return value of regcache_raw_read_unsigned ignored. > > if (bit (inst1, 11) && reg != 0) > nextpc = pc_val + imm; > @@ -4746,20 +4774,21 @@ thumb_get_next_pc_raw (struct frame_info *frame, CORE_ADDR pc) Thanks, Pedro Alves