From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123438 invoked by alias); 5 Apr 2017 10:00:52 -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 123408 invoked by uid 89); 5 Apr 2017 10:00:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-wr0-f194.google.com Received: from mail-wr0-f194.google.com (HELO mail-wr0-f194.google.com) (209.85.128.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Apr 2017 10:00:50 +0000 Received: by mail-wr0-f194.google.com with SMTP id g19so1165598wrb.0 for ; Wed, 05 Apr 2017 03:00:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=kVNtd96c9nVMI6C1erkyUYWqVcntTRXMtoXJq0d2NGg=; b=UFy6/dpwqZMie5oiMOte7U9BLHvh3WbZJ56GDyHcAtIrt8jY4H9Hr47BzWri+ccH6E oPdfP20Sl+iuXWv7XJYtsFPjODvC8qUfPEX+Q7HhWRoUKiSqtXjI94byTe5Rtf9zcsk8 hfkAN9VzA3ZA9IABDGx5VcLKlgzxYKl6ivj08lrhpUnNlDoRoG2ccx4LvzrHcu23VWPk Rtgqa2a3VK9AogIuDvwO75VMgyWm3QuSF1SW0lURziHKq1szIE79Cbt7EA1tLEbyBx5P TpqO+R5NMj8xnr9JkJYeR71lkEGfVwLk0f0Utl8BT5+nSpPXGFs0sC81owRcypubttOQ Sxvg== X-Gm-Message-State: AFeK/H33GQjA/hhyuQDIPzRTyyOadpFRKxEQ5HMkLZnVURH3Kq8bNmLjxAaoWZW4xCXr8w== X-Received: by 10.223.153.9 with SMTP id x9mr7296534wrb.117.1491386449498; Wed, 05 Apr 2017 03:00:49 -0700 (PDT) Received: from E107787-LIN ([194.214.185.158]) by smtp.gmail.com with ESMTPSA id x131sm21719372wme.28.2017.04.05.03.00.48 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 05 Apr 2017 03:00:48 -0700 (PDT) From: Yao Qi To: Alan Hayward Cc: "gdb-patches\@sourceware.org" , nd Subject: Re: [PATCH 2/11] Add IA64_MAX_REGISTER_SIZE References: Date: Wed, 05 Apr 2017 10:00:00 -0000 In-Reply-To: (Alan Hayward's message of "Tue, 4 Apr 2017 10:12:13 +0000") Message-ID: <8637dnqils.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00088.txt.bz2 Alan Hayward writes: Hi Alan, We have to define such macro if we have no other ways to remove MAX_REGISTER_SIZE. AFAIK, there are some ways to remove many usages of MAX_REGISTER_SIZE. > @@ -1516,7 +1516,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, > else if (qp =3D=3D 0 && rN =3D=3D 2 > && ((rM =3D=3D fp_reg && fp_reg !=3D 0) || rM =3D=3D 12)) > { > - gdb_byte buf[MAX_REGISTER_SIZE]; > + gdb_byte buf[IA64_MAX_REGISTER_SIZE]; > CORE_ADDR saved_sp =3D 0; > /* adds r2, spilloffset, rFramePointer > or "buf" is used in the code below, get_frame_register (this_frame, sp_regnum, buf); saved_sp =3D extract_unsigned_integer (buf, 8, byte_order); why don't we use get_frame_register_unsigned, so the "buf" can be removed completely. saved_sp =3D get_frame_register_unsigned (this_frame, sp_regnum); > @@ -2289,7 +2289,7 @@ static struct value * > ia64_sigtramp_frame_prev_register (struct frame_info *this_frame, > void **this_cache, int regnum) > { > - gdb_byte buf[MAX_REGISTER_SIZE]; > + gdb_byte buf[IA64_MAX_REGISTER_SIZE]; > "buf" is used in the code below, read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM)); pc =3D extract_unsigned_integer (buf, 8, byte_order); so it is for IP register. Its size is 8-byte, so we can move "buf" here, gdb_byte buf[8]; read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM)); pc =3D extract_unsigned_integer (buf, sizeof (buf), byte_order); > struct gdbarch *gdbarch =3D get_frame_arch (this_frame); > enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); > @@ -2495,7 +2495,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t = uw_regnum, unw_word_t *val, > struct gdbarch *gdbarch =3D get_frame_arch (this_frame); > enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); > long new_sof, old_sof; > - gdb_byte buf[MAX_REGISTER_SIZE]; > + gdb_byte buf[IA64_MAX_REGISTER_SIZE]; > Use get_frame_register_{,un}signed, so we can remove "buf" completely. > /* We never call any libunwind routines that need to write registers. = */ > gdb_assert (!write); > @@ -2575,7 +2575,7 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnu= m_t uw_regnum, > struct gdbarch *gdbarch =3D get_regcache_arch (regcache); > enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); > long new_sof, old_sof; > - gdb_byte buf[MAX_REGISTER_SIZE]; > + gdb_byte buf[IA64_MAX_REGISTER_SIZE]; > "buf" is used regcache_cooked_read (regcache, IA64_IP_REGNUM, buf); ip =3D extract_unsigned_integer (buf, 8, byte_order); so we can use regcache_cooked_read_unsigned, regcache_cooked_read_unsigned (regcache, IA64_IP_REGNUM, &ip); > /* We never call any libunwind routines that need to write registers. = */ > gdb_assert (!write); > @@ -2982,7 +2982,7 @@ ia64_libunwind_frame_prev_register (struct frame_in= fo *this_frame, > { > int rrb_pr =3D 0; > ULONGEST cfm; > - gdb_byte buf[MAX_REGISTER_SIZE]; > + gdb_byte buf[IA64_MAX_REGISTER_SIZE]; > Use get_frame_register_unsigned. > /* Fetch predicate register rename base from current frame > marker for this frame. */ The only leftover of MAX_REGISTER_SIZE is about floating type conversion, in ia64_register_to_value, ia64_push_dummy_call, etc. Then, we can define an macro for the size of floating types, and replace MAX_REGISTER_SIZE with it. --=20 Yao (=E9=BD=90=E5=B0=A7)